diff --git a/2016/04/29/kw-doc/index.html b/2016/04/29/kw-doc/index.html index ac53510e369..a876c1fd49d 100644 --- a/2016/04/29/kw-doc/index.html +++ b/2016/04/29/kw-doc/index.html @@ -45,7 +45,7 @@ - + diff --git a/api/Common_Core_Base64.html b/api/Common_Core_Base64.html index cb7a1c3f4df..e10f527f082 100644 --- a/api/Common_Core_Base64.html +++ b/api/Common_Core_Base64.html @@ -48,8 +48,8 @@ - - + + @@ -152,7 +152,7 @@

diff --git a/api/Common_Core_CellArray.html b/api/Common_Core_CellArray.html index 9473b0413a0..a619479d5c7 100644 --- a/api/Common_Core_CellArray.html +++ b/api/Common_Core_CellArray.html @@ -48,8 +48,8 @@ - - + + @@ -295,7 +295,7 @@

diff --git a/api/Common_Core_ClassHierarchy.html b/api/Common_Core_ClassHierarchy.html index df699d7bdfb..05e474c792d 100644 --- a/api/Common_Core_ClassHierarchy.html +++ b/api/Common_Core_ClassHierarchy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Common_Core_DataArray.html b/api/Common_Core_DataArray.html index 75d3ea7ad81..bece177ed64 100644 --- a/api/Common_Core_DataArray.html +++ b/api/Common_Core_DataArray.html @@ -48,8 +48,8 @@ - - + + @@ -922,7 +922,7 @@

diff --git a/api/Common_Core_Endian.html b/api/Common_Core_Endian.html index 34329531895..9170d5322f3 100644 --- a/api/Common_Core_Endian.html +++ b/api/Common_Core_Endian.html @@ -48,8 +48,8 @@ - - + + @@ -141,7 +141,7 @@

diff --git a/api/Common_Core_HalfFloat.html b/api/Common_Core_HalfFloat.html index d353a4ce001..0e68e02605c 100644 --- a/api/Common_Core_HalfFloat.html +++ b/api/Common_Core_HalfFloat.html @@ -48,8 +48,8 @@ - - + + @@ -152,7 +152,7 @@

diff --git a/api/Common_Core_ImageHelper.html b/api/Common_Core_ImageHelper.html index bb9f37af4fd..7271bc50ed0 100644 --- a/api/Common_Core_ImageHelper.html +++ b/api/Common_Core_ImageHelper.html @@ -48,8 +48,8 @@ - - + + @@ -165,7 +165,7 @@

diff --git a/api/Common_Core_LookupTable.html b/api/Common_Core_LookupTable.html index 2b3514036fb..8298c50d89e 100644 --- a/api/Common_Core_LookupTable.html +++ b/api/Common_Core_LookupTable.html @@ -48,8 +48,8 @@ - - + + @@ -553,7 +553,7 @@

diff --git a/api/Common_Core_Math.html b/api/Common_Core_Math.html index 46a5dd17e46..4a4299f0a0a 100644 --- a/api/Common_Core_Math.html +++ b/api/Common_Core_Math.html @@ -48,8 +48,8 @@ - - + + @@ -2840,7 +2840,7 @@

diff --git a/api/Common_Core_MatrixBuilder.html b/api/Common_Core_MatrixBuilder.html index 080451d30b9..29703a797e4 100644 --- a/api/Common_Core_MatrixBuilder.html +++ b/api/Common_Core_MatrixBuilder.html @@ -48,8 +48,8 @@ - - + + @@ -375,7 +375,7 @@

diff --git a/api/Common_Core_Points.html b/api/Common_Core_Points.html index 046d94ec1d7..fd3ce0bdf2e 100644 --- a/api/Common_Core_Points.html +++ b/api/Common_Core_Points.html @@ -48,8 +48,8 @@ - - + + @@ -328,7 +328,7 @@

diff --git a/api/Common_Core_PriorityQueue.html b/api/Common_Core_PriorityQueue.html index a3aa80a1304..af494f9b784 100644 --- a/api/Common_Core_PriorityQueue.html +++ b/api/Common_Core_PriorityQueue.html @@ -48,8 +48,8 @@ - - + + @@ -206,7 +206,7 @@

diff --git a/api/Common_Core_ProgressHandler.html b/api/Common_Core_ProgressHandler.html index 01e17ea185a..9bd7e886794 100644 --- a/api/Common_Core_ProgressHandler.html +++ b/api/Common_Core_ProgressHandler.html @@ -48,8 +48,8 @@ - - + + @@ -198,7 +198,7 @@

diff --git a/api/Common_Core_ScalarsToColors.html b/api/Common_Core_ScalarsToColors.html index df6734315fa..bba41339216 100644 --- a/api/Common_Core_ScalarsToColors.html +++ b/api/Common_Core_ScalarsToColors.html @@ -48,8 +48,8 @@ - - + + @@ -816,7 +816,7 @@

- + PrevNext diff --git a/api/Common_Core_StringArray.html b/api/Common_Core_StringArray.html index b2c89a05cf9..52864cb8c7b 100644 --- a/api/Common_Core_StringArray.html +++ b/api/Common_Core_StringArray.html @@ -48,8 +48,8 @@ - - + + @@ -277,7 +277,7 @@

diff --git a/api/Common_Core_URLExtract.html b/api/Common_Core_URLExtract.html index 8eb615692b0..3ad1b8f7033 100644 --- a/api/Common_Core_URLExtract.html +++ b/api/Common_Core_URLExtract.html @@ -48,8 +48,8 @@ - - + + @@ -156,7 +156,7 @@

diff --git a/api/Common_Core_VariantArray.html b/api/Common_Core_VariantArray.html index 8df0e27c987..5b1f49d38b0 100644 --- a/api/Common_Core_VariantArray.html +++ b/api/Common_Core_VariantArray.html @@ -48,8 +48,8 @@ - - + + @@ -277,7 +277,7 @@

diff --git a/api/Common_DataModel_AbstractPointLocator.html b/api/Common_DataModel_AbstractPointLocator.html index 58f4a395502..0695ed9b345 100644 --- a/api/Common_DataModel_AbstractPointLocator.html +++ b/api/Common_DataModel_AbstractPointLocator.html @@ -48,8 +48,8 @@ - - + + @@ -178,7 +178,7 @@

diff --git a/api/Common_DataModel_BoundingBox.html b/api/Common_DataModel_BoundingBox.html index 58b4bf832b0..04efe60673e 100644 --- a/api/Common_DataModel_BoundingBox.html +++ b/api/Common_DataModel_BoundingBox.html @@ -48,8 +48,8 @@ - - + + @@ -1816,7 +1816,7 @@

diff --git a/api/Common_DataModel_Box.html b/api/Common_DataModel_Box.html index a51b2f5e9af..b1bc2a5fa52 100644 --- a/api/Common_DataModel_Box.html +++ b/api/Common_DataModel_Box.html @@ -48,8 +48,8 @@ - - + + @@ -295,7 +295,7 @@

diff --git a/api/Common_DataModel_CardinalSpline1D.html b/api/Common_DataModel_CardinalSpline1D.html index 8539ee78ad3..158839c71de 100644 --- a/api/Common_DataModel_CardinalSpline1D.html +++ b/api/Common_DataModel_CardinalSpline1D.html @@ -48,8 +48,8 @@ - - + + @@ -285,7 +285,7 @@

diff --git a/api/Common_DataModel_Cell.html b/api/Common_DataModel_Cell.html index ddf0c303588..8c2f698a7db 100644 --- a/api/Common_DataModel_Cell.html +++ b/api/Common_DataModel_Cell.html @@ -48,8 +48,8 @@ - - + + @@ -228,7 +228,7 @@

diff --git a/api/Common_DataModel_CellLinks.html b/api/Common_DataModel_CellLinks.html index b88656893f9..c7f467c257f 100644 --- a/api/Common_DataModel_CellLinks.html +++ b/api/Common_DataModel_CellLinks.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Common_DataModel_CellTypes.html b/api/Common_DataModel_CellTypes.html index d0b1e63e99c..f7459f615fc 100644 --- a/api/Common_DataModel_CellTypes.html +++ b/api/Common_DataModel_CellTypes.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/Common_DataModel_Collection.html b/api/Common_DataModel_Collection.html index 14be56b4cd3..59a03ebb453 100644 --- a/api/Common_DataModel_Collection.html +++ b/api/Common_DataModel_Collection.html @@ -48,8 +48,8 @@ - - + + @@ -251,7 +251,7 @@

diff --git a/api/Common_DataModel_Cone.html b/api/Common_DataModel_Cone.html index b2aa4abda83..edbc76d55ab 100644 --- a/api/Common_DataModel_Cone.html +++ b/api/Common_DataModel_Cone.html @@ -48,8 +48,8 @@ - - + + @@ -217,7 +217,7 @@

diff --git a/api/Common_DataModel_Cylinder.html b/api/Common_DataModel_Cylinder.html index 3b29c047937..7425d233ce4 100644 --- a/api/Common_DataModel_Cylinder.html +++ b/api/Common_DataModel_Cylinder.html @@ -48,8 +48,8 @@ - - + + @@ -400,7 +400,7 @@

diff --git a/api/Common_DataModel_DataSet.html b/api/Common_DataModel_DataSet.html index ce61a2b1d78..649a71296c1 100644 --- a/api/Common_DataModel_DataSet.html +++ b/api/Common_DataModel_DataSet.html @@ -48,8 +48,8 @@ - - + + @@ -223,7 +223,7 @@

diff --git a/api/Common_DataModel_DataSetAttributes.html b/api/Common_DataModel_DataSetAttributes.html index fa46d1e5fb3..177b4346cbc 100644 --- a/api/Common_DataModel_DataSetAttributes.html +++ b/api/Common_DataModel_DataSetAttributes.html @@ -48,8 +48,8 @@ - - + + @@ -706,7 +706,7 @@

diff --git a/api/Common_DataModel_EdgeLocator.html b/api/Common_DataModel_EdgeLocator.html index ea17932a258..301ca647b8f 100644 --- a/api/Common_DataModel_EdgeLocator.html +++ b/api/Common_DataModel_EdgeLocator.html @@ -48,8 +48,8 @@ - - + + @@ -137,7 +137,7 @@

diff --git a/api/Common_DataModel_ITKHelper.html b/api/Common_DataModel_ITKHelper.html index 0ce62c84171..e224d42c4db 100644 --- a/api/Common_DataModel_ITKHelper.html +++ b/api/Common_DataModel_ITKHelper.html @@ -48,8 +48,8 @@ - - + + @@ -211,7 +211,7 @@

diff --git a/api/Common_DataModel_ImageData.html b/api/Common_DataModel_ImageData.html index b76fe3acc39..0b386a40629 100644 --- a/api/Common_DataModel_ImageData.html +++ b/api/Common_DataModel_ImageData.html @@ -48,8 +48,8 @@ - - + + @@ -713,7 +713,7 @@

diff --git a/api/Common_DataModel_ImplicitBoolean.html b/api/Common_DataModel_ImplicitBoolean.html index 9f69fb15ea5..b8ea79b2c63 100644 --- a/api/Common_DataModel_ImplicitBoolean.html +++ b/api/Common_DataModel_ImplicitBoolean.html @@ -48,8 +48,8 @@ - - + + @@ -123,7 +123,7 @@

diff --git a/api/Common_DataModel_IncrementalOctreeNode.html b/api/Common_DataModel_IncrementalOctreeNode.html index 4d60e215e4d..46f9931a39e 100644 --- a/api/Common_DataModel_IncrementalOctreeNode.html +++ b/api/Common_DataModel_IncrementalOctreeNode.html @@ -48,8 +48,8 @@ - - + + @@ -600,7 +600,7 @@

diff --git a/api/Common_DataModel_IncrementalOctreePointLocator.html b/api/Common_DataModel_IncrementalOctreePointLocator.html index 8018040a349..463f7897885 100644 --- a/api/Common_DataModel_IncrementalOctreePointLocator.html +++ b/api/Common_DataModel_IncrementalOctreePointLocator.html @@ -48,8 +48,8 @@ - - + + @@ -165,7 +165,7 @@

diff --git a/api/Common_DataModel_KochanekSpline1D.html b/api/Common_DataModel_KochanekSpline1D.html index 6df1ba0de46..79a62512c8e 100644 --- a/api/Common_DataModel_KochanekSpline1D.html +++ b/api/Common_DataModel_KochanekSpline1D.html @@ -48,8 +48,8 @@ - - + + @@ -285,7 +285,7 @@

diff --git a/api/Common_DataModel_Line.html b/api/Common_DataModel_Line.html index 3da03d54a7f..7667b68c1c4 100644 --- a/api/Common_DataModel_Line.html +++ b/api/Common_DataModel_Line.html @@ -48,8 +48,8 @@ - - + + @@ -319,7 +319,7 @@

diff --git a/api/Common_DataModel_Locator.html b/api/Common_DataModel_Locator.html index b0f95b278be..3b449f4761d 100644 --- a/api/Common_DataModel_Locator.html +++ b/api/Common_DataModel_Locator.html @@ -48,8 +48,8 @@ - - + + @@ -148,7 +148,7 @@

diff --git a/api/Common_DataModel_Molecule.html b/api/Common_DataModel_Molecule.html index 49fe14624da..864e7f93066 100644 --- a/api/Common_DataModel_Molecule.html +++ b/api/Common_DataModel_Molecule.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Common_DataModel_PiecewiseFunction.html b/api/Common_DataModel_PiecewiseFunction.html index fed0a4da370..d05e3436205 100644 --- a/api/Common_DataModel_PiecewiseFunction.html +++ b/api/Common_DataModel_PiecewiseFunction.html @@ -48,8 +48,8 @@ - - + + @@ -508,7 +508,7 @@

diff --git a/api/Common_DataModel_Plane.html b/api/Common_DataModel_Plane.html index cfcbe50f803..be62dbedbab 100644 --- a/api/Common_DataModel_Plane.html +++ b/api/Common_DataModel_Plane.html @@ -48,8 +48,8 @@ - - + + @@ -779,7 +779,7 @@

diff --git a/api/Common_DataModel_PointSet.html b/api/Common_DataModel_PointSet.html index efa824dd584..7096fcab073 100644 --- a/api/Common_DataModel_PointSet.html +++ b/api/Common_DataModel_PointSet.html @@ -48,8 +48,8 @@ - - + + @@ -168,7 +168,7 @@

- + PrevNext diff --git a/api/Common_DataModel_PolyData.html b/api/Common_DataModel_PolyData.html index d0eecd1f517..59abdcfb3b6 100644 --- a/api/Common_DataModel_PolyData.html +++ b/api/Common_DataModel_PolyData.html @@ -48,8 +48,8 @@ - - + + @@ -367,7 +367,7 @@

diff --git a/api/Common_DataModel_PolyLine.html b/api/Common_DataModel_PolyLine.html index 6cf37a1f41c..43a5d24d0b2 100644 --- a/api/Common_DataModel_PolyLine.html +++ b/api/Common_DataModel_PolyLine.html @@ -48,8 +48,8 @@ - - + + @@ -353,7 +353,7 @@

diff --git a/api/Common_DataModel_Polygon.html b/api/Common_DataModel_Polygon.html index fce7729edc3..fadf17cad0e 100644 --- a/api/Common_DataModel_Polygon.html +++ b/api/Common_DataModel_Polygon.html @@ -48,8 +48,8 @@ - - + + @@ -233,7 +233,7 @@

diff --git a/api/Common_DataModel_Quad.html b/api/Common_DataModel_Quad.html index cf64b3ea682..1ac60432a39 100644 --- a/api/Common_DataModel_Quad.html +++ b/api/Common_DataModel_Quad.html @@ -48,8 +48,8 @@ - - + + @@ -241,7 +241,7 @@

diff --git a/api/Common_DataModel_SelectionNode.html b/api/Common_DataModel_SelectionNode.html index 0dde21838de..f719a45f4ad 100644 --- a/api/Common_DataModel_SelectionNode.html +++ b/api/Common_DataModel_SelectionNode.html @@ -48,8 +48,8 @@ - - + + @@ -177,7 +177,7 @@

diff --git a/api/Common_DataModel_Sphere.html b/api/Common_DataModel_Sphere.html index 3beb10cf640..8b25391df12 100644 --- a/api/Common_DataModel_Sphere.html +++ b/api/Common_DataModel_Sphere.html @@ -48,8 +48,8 @@ - - + + @@ -282,7 +282,7 @@

diff --git a/api/Common_DataModel_Spline1D.html b/api/Common_DataModel_Spline1D.html index 120aba7f20f..96e5112c95e 100644 --- a/api/Common_DataModel_Spline1D.html +++ b/api/Common_DataModel_Spline1D.html @@ -48,8 +48,8 @@ - - + + @@ -286,7 +286,7 @@

diff --git a/api/Common_DataModel_Spline3D.html b/api/Common_DataModel_Spline3D.html index c2a75b6218d..10b85cd0cd6 100644 --- a/api/Common_DataModel_Spline3D.html +++ b/api/Common_DataModel_Spline3D.html @@ -48,8 +48,8 @@ - - + + @@ -205,7 +205,7 @@

diff --git a/api/Common_DataModel_StructuredData.html b/api/Common_DataModel_StructuredData.html index f475c0ab681..1c2e8aebda5 100644 --- a/api/Common_DataModel_StructuredData.html +++ b/api/Common_DataModel_StructuredData.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/Common_DataModel_Triangle.html b/api/Common_DataModel_Triangle.html index e8278a55490..ccfa1a2422a 100644 --- a/api/Common_DataModel_Triangle.html +++ b/api/Common_DataModel_Triangle.html @@ -48,8 +48,8 @@ - - + + @@ -372,7 +372,7 @@

diff --git a/api/Common_System_MobileVR.html b/api/Common_System_MobileVR.html index 5e7a5bb70a9..3596373bdfe 100644 --- a/api/Common_System_MobileVR.html +++ b/api/Common_System_MobileVR.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

diff --git a/api/Common_System_TimerLog.html b/api/Common_System_TimerLog.html index 265d864e30d..0c6d57b6587 100644 --- a/api/Common_System_TimerLog.html +++ b/api/Common_System_TimerLog.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Common_Transform_LandmarkTransform.html b/api/Common_Transform_LandmarkTransform.html index eb899e3bbd1..112e4747eea 100644 --- a/api/Common_Transform_LandmarkTransform.html +++ b/api/Common_Transform_LandmarkTransform.html @@ -48,8 +48,8 @@ - - + + @@ -229,7 +229,7 @@

diff --git a/api/Common_Transform_Transform.html b/api/Common_Transform_Transform.html index bdc717d0ff4..7293c91914a 100644 --- a/api/Common_Transform_Transform.html +++ b/api/Common_Transform_Transform.html @@ -48,8 +48,8 @@ - - + + @@ -445,7 +445,7 @@

diff --git a/api/Filters_Core_Cutter.html b/api/Filters_Core_Cutter.html index f9f8115d07d..55fbb3f1e1f 100644 --- a/api/Filters_Core_Cutter.html +++ b/api/Filters_Core_Cutter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_Core_PolyDataNormals.html b/api/Filters_Core_PolyDataNormals.html index 463ab44c8f9..54cd989b633 100644 --- a/api/Filters_Core_PolyDataNormals.html +++ b/api/Filters_Core_PolyDataNormals.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html b/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html index df528a8856a..b5e3df6f0b7 100644 --- a/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html +++ b/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_General_AppendPolyData.html b/api/Filters_General_AppendPolyData.html index 9e2c6e7efc6..74c287f2e98 100644 --- a/api/Filters_General_AppendPolyData.html +++ b/api/Filters_General_AppendPolyData.html @@ -48,8 +48,8 @@ - - + + @@ -210,7 +210,7 @@

diff --git a/api/Filters_General_Calculator.html b/api/Filters_General_Calculator.html index e422638faa0..51df10a1bfd 100644 --- a/api/Filters_General_Calculator.html +++ b/api/Filters_General_Calculator.html @@ -48,8 +48,8 @@ - - + + @@ -157,7 +157,7 @@

diff --git a/api/Filters_General_ClipClosedSurface.html b/api/Filters_General_ClipClosedSurface.html index 40c5fc35ea0..93636de7b28 100644 --- a/api/Filters_General_ClipClosedSurface.html +++ b/api/Filters_General_ClipClosedSurface.html @@ -48,8 +48,8 @@ - - + + @@ -191,7 +191,7 @@

diff --git a/api/Filters_General_ClosedPolyLineToSurfaceFilter.html b/api/Filters_General_ClosedPolyLineToSurfaceFilter.html index 5194f721be9..5ceaf2a643c 100644 --- a/api/Filters_General_ClosedPolyLineToSurfaceFilter.html +++ b/api/Filters_General_ClosedPolyLineToSurfaceFilter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_General_ContourTriangulator.html b/api/Filters_General_ContourTriangulator.html index 69efd679d70..d9352029c1c 100644 --- a/api/Filters_General_ContourTriangulator.html +++ b/api/Filters_General_ContourTriangulator.html @@ -48,8 +48,8 @@ - - + + @@ -327,7 +327,7 @@

diff --git a/api/Filters_General_ImageCropFilter.html b/api/Filters_General_ImageCropFilter.html index f591ec49142..a89cada60c1 100644 --- a/api/Filters_General_ImageCropFilter.html +++ b/api/Filters_General_ImageCropFilter.html @@ -48,8 +48,8 @@ - - + + @@ -222,7 +222,7 @@

diff --git a/api/Filters_General_ImageDataOutlineFilter.html b/api/Filters_General_ImageDataOutlineFilter.html index 40215bc9a80..c21e9791db9 100644 --- a/api/Filters_General_ImageDataOutlineFilter.html +++ b/api/Filters_General_ImageDataOutlineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -248,7 +248,7 @@

diff --git a/api/Filters_General_ImageMarchingCubes.html b/api/Filters_General_ImageMarchingCubes.html index abbac804fcf..2edf093230a 100644 --- a/api/Filters_General_ImageMarchingCubes.html +++ b/api/Filters_General_ImageMarchingCubes.html @@ -48,8 +48,8 @@ - - + + @@ -123,7 +123,7 @@

diff --git a/api/Filters_General_ImageMarchingSquares.html b/api/Filters_General_ImageMarchingSquares.html index 5b0ec21324d..a7e3503d0d5 100644 --- a/api/Filters_General_ImageMarchingSquares.html +++ b/api/Filters_General_ImageMarchingSquares.html @@ -48,8 +48,8 @@ - - + + @@ -124,7 +124,7 @@

diff --git a/api/Filters_General_ImageOutlineFilter.html b/api/Filters_General_ImageOutlineFilter.html index 1470a0770ba..47a021bf56a 100644 --- a/api/Filters_General_ImageOutlineFilter.html +++ b/api/Filters_General_ImageOutlineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -220,7 +220,7 @@

diff --git a/api/Filters_General_ImageSliceFilter.html b/api/Filters_General_ImageSliceFilter.html index 95e26858a23..bce61fe1bcb 100644 --- a/api/Filters_General_ImageSliceFilter.html +++ b/api/Filters_General_ImageSliceFilter.html @@ -48,8 +48,8 @@ - - + + @@ -218,7 +218,7 @@

diff --git a/api/Filters_General_ImageStreamline.html b/api/Filters_General_ImageStreamline.html index a6425cdf0e2..7e6df88799e 100644 --- a/api/Filters_General_ImageStreamline.html +++ b/api/Filters_General_ImageStreamline.html @@ -48,8 +48,8 @@ - - + + @@ -429,7 +429,7 @@

diff --git a/api/Filters_General_LineFilter.html b/api/Filters_General_LineFilter.html index 3e0cece7dd5..aadb4cc91cf 100644 --- a/api/Filters_General_LineFilter.html +++ b/api/Filters_General_LineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -188,7 +188,7 @@

diff --git a/api/Filters_General_MoleculeToRepresentation.html b/api/Filters_General_MoleculeToRepresentation.html index eab6a3dda1d..4e22a478934 100644 --- a/api/Filters_General_MoleculeToRepresentation.html +++ b/api/Filters_General_MoleculeToRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_General_OBBTree.html b/api/Filters_General_OBBTree.html index afca897d9e8..3a4cb7d2627 100644 --- a/api/Filters_General_OBBTree.html +++ b/api/Filters_General_OBBTree.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

diff --git a/api/Filters_General_OutlineFilter.html b/api/Filters_General_OutlineFilter.html index aa9169f05d3..ea6312a06c8 100644 --- a/api/Filters_General_OutlineFilter.html +++ b/api/Filters_General_OutlineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -188,7 +188,7 @@

diff --git a/api/Filters_General_PaintFilter.html b/api/Filters_General_PaintFilter.html index 527cee20151..4875ed51330 100644 --- a/api/Filters_General_PaintFilter.html +++ b/api/Filters_General_PaintFilter.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/Filters_General_ScalarToRGBA.html b/api/Filters_General_ScalarToRGBA.html index fac13abccc9..620b1b0720c 100644 --- a/api/Filters_General_ScalarToRGBA.html +++ b/api/Filters_General_ScalarToRGBA.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_General_TriangleFilter.html b/api/Filters_General_TriangleFilter.html index 2b9cfe84eb1..dc1b5cd984f 100644 --- a/api/Filters_General_TriangleFilter.html +++ b/api/Filters_General_TriangleFilter.html @@ -48,8 +48,8 @@ - - + + @@ -189,7 +189,7 @@

diff --git a/api/Filters_General_TubeFilter.html b/api/Filters_General_TubeFilter.html index ac3dc64eb83..13d54a68f4a 100644 --- a/api/Filters_General_TubeFilter.html +++ b/api/Filters_General_TubeFilter.html @@ -48,8 +48,8 @@ - - + + @@ -426,7 +426,7 @@

diff --git a/api/Filters_General_WarpScalar.html b/api/Filters_General_WarpScalar.html index a5afd4f4500..1b42b3b6393 100644 --- a/api/Filters_General_WarpScalar.html +++ b/api/Filters_General_WarpScalar.html @@ -48,8 +48,8 @@ - - + + @@ -126,7 +126,7 @@

diff --git a/api/Filters_General_WindowedSincPolyDataFilter.html b/api/Filters_General_WindowedSincPolyDataFilter.html index e2798123a88..6ee64b95a22 100644 --- a/api/Filters_General_WindowedSincPolyDataFilter.html +++ b/api/Filters_General_WindowedSincPolyDataFilter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_Sources_Arrow2DSource.html b/api/Filters_Sources_Arrow2DSource.html index 3f7282dd046..f6e36ac2270 100644 --- a/api/Filters_Sources_Arrow2DSource.html +++ b/api/Filters_Sources_Arrow2DSource.html @@ -48,8 +48,8 @@ - - + + @@ -374,7 +374,7 @@

diff --git a/api/Filters_Sources_ArrowSource.html b/api/Filters_Sources_ArrowSource.html index 1cdbbbfdd55..e941ac0321a 100644 --- a/api/Filters_Sources_ArrowSource.html +++ b/api/Filters_Sources_ArrowSource.html @@ -48,8 +48,8 @@ - - + + @@ -363,7 +363,7 @@

diff --git a/api/Filters_Sources_CircleSource.html b/api/Filters_Sources_CircleSource.html index c237561dbd4..f4a9cad6306 100644 --- a/api/Filters_Sources_CircleSource.html +++ b/api/Filters_Sources_CircleSource.html @@ -48,8 +48,8 @@ - - + + @@ -372,7 +372,7 @@

diff --git a/api/Filters_Sources_ConcentricCylinderSource.html b/api/Filters_Sources_ConcentricCylinderSource.html index 2ace2c31e68..1310837df08 100644 --- a/api/Filters_Sources_ConcentricCylinderSource.html +++ b/api/Filters_Sources_ConcentricCylinderSource.html @@ -48,8 +48,8 @@ - - + + @@ -127,7 +127,7 @@

diff --git a/api/Filters_Sources_ConeSource.html b/api/Filters_Sources_ConeSource.html index 29feabcb555..9864de40c35 100644 --- a/api/Filters_Sources_ConeSource.html +++ b/api/Filters_Sources_ConeSource.html @@ -48,8 +48,8 @@ - - + + @@ -410,7 +410,7 @@

diff --git a/api/Filters_Sources_CubeSource.html b/api/Filters_Sources_CubeSource.html index 9213a5b6dfa..74f913d3960 100644 --- a/api/Filters_Sources_CubeSource.html +++ b/api/Filters_Sources_CubeSource.html @@ -48,8 +48,8 @@ - - + + @@ -512,7 +512,7 @@

diff --git a/api/Filters_Sources_Cursor3D.html b/api/Filters_Sources_Cursor3D.html index 59fd5094099..136d71443f1 100644 --- a/api/Filters_Sources_Cursor3D.html +++ b/api/Filters_Sources_Cursor3D.html @@ -48,8 +48,8 @@ - - + + @@ -352,7 +352,7 @@

diff --git a/api/Filters_Sources_CylinderSource.html b/api/Filters_Sources_CylinderSource.html index a3dfadb0926..59c8d4787bf 100644 --- a/api/Filters_Sources_CylinderSource.html +++ b/api/Filters_Sources_CylinderSource.html @@ -48,8 +48,8 @@ - - + + @@ -411,7 +411,7 @@

diff --git a/api/Filters_Sources_ImageGridSource.html b/api/Filters_Sources_ImageGridSource.html index 5bd7c86e0c7..bb85a791d54 100644 --- a/api/Filters_Sources_ImageGridSource.html +++ b/api/Filters_Sources_ImageGridSource.html @@ -48,8 +48,8 @@ - - + + @@ -125,7 +125,7 @@

diff --git a/api/Filters_Sources_LineSource.html b/api/Filters_Sources_LineSource.html index 87316304805..629ae3ba97a 100644 --- a/api/Filters_Sources_LineSource.html +++ b/api/Filters_Sources_LineSource.html @@ -48,8 +48,8 @@ - - + + @@ -321,7 +321,7 @@

diff --git a/api/Filters_Sources_PlaneSource.html b/api/Filters_Sources_PlaneSource.html index 2564126df5d..69291ddd388 100644 --- a/api/Filters_Sources_PlaneSource.html +++ b/api/Filters_Sources_PlaneSource.html @@ -48,8 +48,8 @@ - - + + @@ -546,7 +546,7 @@

diff --git a/api/Filters_Sources_PointSource.html b/api/Filters_Sources_PointSource.html index d82f7027e18..c184134277a 100644 --- a/api/Filters_Sources_PointSource.html +++ b/api/Filters_Sources_PointSource.html @@ -48,8 +48,8 @@ - - + + @@ -291,7 +291,7 @@

diff --git a/api/Filters_Sources_RTAnalyticSource.html b/api/Filters_Sources_RTAnalyticSource.html index f2e7c0ea87b..a2bab498ea3 100644 --- a/api/Filters_Sources_RTAnalyticSource.html +++ b/api/Filters_Sources_RTAnalyticSource.html @@ -48,8 +48,8 @@ - - + + @@ -130,7 +130,7 @@

diff --git a/api/Filters_Sources_SLICSource.html b/api/Filters_Sources_SLICSource.html index 48eeb2c1399..d5d7914486d 100644 --- a/api/Filters_Sources_SLICSource.html +++ b/api/Filters_Sources_SLICSource.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/Filters_Sources_SphereSource.html b/api/Filters_Sources_SphereSource.html index b6ba269dc9a..0e7c47a86ac 100644 --- a/api/Filters_Sources_SphereSource.html +++ b/api/Filters_Sources_SphereSource.html @@ -48,8 +48,8 @@ - - + + @@ -398,7 +398,7 @@

diff --git a/api/Filters_Sources_ViewFinderSource.html b/api/Filters_Sources_ViewFinderSource.html index 88e7a6ec5ab..d7ad70000fe 100644 --- a/api/Filters_Sources_ViewFinderSource.html +++ b/api/Filters_Sources_ViewFinderSource.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Filters_Texture_TextureMapToPlane.html b/api/Filters_Texture_TextureMapToPlane.html index b1b2c9dcee6..708fe898b9f 100644 --- a/api/Filters_Texture_TextureMapToPlane.html +++ b/api/Filters_Texture_TextureMapToPlane.html @@ -48,8 +48,8 @@ - - + + @@ -583,7 +583,7 @@

diff --git a/api/Filters_Texture_TextureMapToSphere.html b/api/Filters_Texture_TextureMapToSphere.html index 92fd8c28b1e..ded7d092ff8 100644 --- a/api/Filters_Texture_TextureMapToSphere.html +++ b/api/Filters_Texture_TextureMapToSphere.html @@ -48,8 +48,8 @@ - - + + @@ -293,7 +293,7 @@

diff --git a/api/IO_Core_BinaryHelper.html b/api/IO_Core_BinaryHelper.html index 823cd7dc6e0..91102683d30 100644 --- a/api/IO_Core_BinaryHelper.html +++ b/api/IO_Core_BinaryHelper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Core_DataAccessHelper.html b/api/IO_Core_DataAccessHelper.html index ad13dd77b64..0eafa81c690 100644 --- a/api/IO_Core_DataAccessHelper.html +++ b/api/IO_Core_DataAccessHelper.html @@ -48,8 +48,8 @@ - - + + @@ -186,7 +186,7 @@

diff --git a/api/IO_Core_HttpDataSetReader.html b/api/IO_Core_HttpDataSetReader.html index bb571d344ef..496b34a2c5b 100644 --- a/api/IO_Core_HttpDataSetReader.html +++ b/api/IO_Core_HttpDataSetReader.html @@ -48,8 +48,8 @@ - - + + @@ -348,7 +348,7 @@

diff --git a/api/IO_Core_HttpDataSetSeriesReader.html b/api/IO_Core_HttpDataSetSeriesReader.html index 32ae96d59e0..c7beed81962 100644 --- a/api/IO_Core_HttpDataSetSeriesReader.html +++ b/api/IO_Core_HttpDataSetSeriesReader.html @@ -48,8 +48,8 @@ - - + + @@ -132,7 +132,7 @@

diff --git a/api/IO_Core_HttpSceneLoader.html b/api/IO_Core_HttpSceneLoader.html index 180662046f1..8bd4e1722ba 100644 --- a/api/IO_Core_HttpSceneLoader.html +++ b/api/IO_Core_HttpSceneLoader.html @@ -48,8 +48,8 @@ - - + + @@ -257,7 +257,7 @@

diff --git a/api/IO_Core_ImageStream.html b/api/IO_Core_ImageStream.html index 453424c96e6..6c6fd27ea15 100644 --- a/api/IO_Core_ImageStream.html +++ b/api/IO_Core_ImageStream.html @@ -48,8 +48,8 @@ - - + + @@ -207,7 +207,7 @@

- + PrevNext diff --git a/api/IO_Core_ResourceLoader.html b/api/IO_Core_ResourceLoader.html index a8f34f8fb91..5288951ee2f 100644 --- a/api/IO_Core_ResourceLoader.html +++ b/api/IO_Core_ResourceLoader.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Core_Serializer.html b/api/IO_Core_Serializer.html index 54005651d18..fdec298af79 100644 --- a/api/IO_Core_Serializer.html +++ b/api/IO_Core_Serializer.html @@ -48,8 +48,8 @@ - - + + @@ -121,7 +121,7 @@

diff --git a/api/IO_Core_WSLinkClient.html b/api/IO_Core_WSLinkClient.html index 1706d2d3cfc..dc3dafbe29a 100644 --- a/api/IO_Core_WSLinkClient.html +++ b/api/IO_Core_WSLinkClient.html @@ -48,8 +48,8 @@ - - + + @@ -400,7 +400,7 @@

diff --git a/api/IO_Core_ZipMultiDataSetReader.html b/api/IO_Core_ZipMultiDataSetReader.html index b9129d7d438..755e8a594e0 100644 --- a/api/IO_Core_ZipMultiDataSetReader.html +++ b/api/IO_Core_ZipMultiDataSetReader.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Core_ZipMultiDataSetWriter.html b/api/IO_Core_ZipMultiDataSetWriter.html index 1086a61b80e..1ddb233c36f 100644 --- a/api/IO_Core_ZipMultiDataSetWriter.html +++ b/api/IO_Core_ZipMultiDataSetWriter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Geometry_DracoReader.html b/api/IO_Geometry_DracoReader.html index 13c6d1d8f5d..3a68648664b 100644 --- a/api/IO_Geometry_DracoReader.html +++ b/api/IO_Geometry_DracoReader.html @@ -48,8 +48,8 @@ - - + + @@ -334,7 +334,7 @@

diff --git a/api/IO_Geometry_PLYReader.html b/api/IO_Geometry_PLYReader.html index fd462f8a625..d900b12e448 100644 --- a/api/IO_Geometry_PLYReader.html +++ b/api/IO_Geometry_PLYReader.html @@ -48,8 +48,8 @@ - - + + @@ -295,7 +295,7 @@

diff --git a/api/IO_Geometry_PLYWriter.html b/api/IO_Geometry_PLYWriter.html index 4c126fcc6f4..8349e8285e3 100644 --- a/api/IO_Geometry_PLYWriter.html +++ b/api/IO_Geometry_PLYWriter.html @@ -48,8 +48,8 @@ - - + + @@ -444,7 +444,7 @@

diff --git a/api/IO_Geometry_STLReader.html b/api/IO_Geometry_STLReader.html index 0dd7fbffae0..915c73815fc 100644 --- a/api/IO_Geometry_STLReader.html +++ b/api/IO_Geometry_STLReader.html @@ -48,8 +48,8 @@ - - + + @@ -295,7 +295,7 @@

diff --git a/api/IO_Geometry_STLWriter.html b/api/IO_Geometry_STLWriter.html index 71fa24fdbc6..a6a1d1102b8 100644 --- a/api/IO_Geometry_STLWriter.html +++ b/api/IO_Geometry_STLWriter.html @@ -48,8 +48,8 @@ - - + + @@ -248,7 +248,7 @@

diff --git a/api/IO_Legacy_LegacyAsciiParser.html b/api/IO_Legacy_LegacyAsciiParser.html index 03a135a0a3d..acf9016c105 100644 --- a/api/IO_Legacy_LegacyAsciiParser.html +++ b/api/IO_Legacy_LegacyAsciiParser.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Legacy_PolyDataReader.html b/api/IO_Legacy_PolyDataReader.html index ad715717a06..2917e0d10d1 100644 --- a/api/IO_Legacy_PolyDataReader.html +++ b/api/IO_Legacy_PolyDataReader.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/IO_Misc_ElevationReader.html b/api/IO_Misc_ElevationReader.html index bb47055dee0..7cd0db7b623 100644 --- a/api/IO_Misc_ElevationReader.html +++ b/api/IO_Misc_ElevationReader.html @@ -48,8 +48,8 @@ - - + + @@ -377,7 +377,7 @@

diff --git a/api/IO_Misc_HttpDataSetLODsLoader.html b/api/IO_Misc_HttpDataSetLODsLoader.html index 1a54d67e291..86de7dd0abd 100644 --- a/api/IO_Misc_HttpDataSetLODsLoader.html +++ b/api/IO_Misc_HttpDataSetLODsLoader.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_Misc_ITKImageReader.html b/api/IO_Misc_ITKImageReader.html index 5c1e64fa7eb..ea17391d015 100644 --- a/api/IO_Misc_ITKImageReader.html +++ b/api/IO_Misc_ITKImageReader.html @@ -48,8 +48,8 @@ - - + + @@ -256,7 +256,7 @@

diff --git a/api/IO_Misc_ITKPolyDataReader.html b/api/IO_Misc_ITKPolyDataReader.html index da1a5250058..45b6195ebe8 100644 --- a/api/IO_Misc_ITKPolyDataReader.html +++ b/api/IO_Misc_ITKPolyDataReader.html @@ -48,8 +48,8 @@ - - + + @@ -256,7 +256,7 @@

diff --git a/api/IO_Misc_JSONNucleoReader.html b/api/IO_Misc_JSONNucleoReader.html index 35c13b1e525..cebeac0a103 100644 --- a/api/IO_Misc_JSONNucleoReader.html +++ b/api/IO_Misc_JSONNucleoReader.html @@ -48,8 +48,8 @@ - - + + @@ -261,7 +261,7 @@

diff --git a/api/IO_Misc_JSONReader.html b/api/IO_Misc_JSONReader.html index 6dd7aa99c19..cac5364d694 100644 --- a/api/IO_Misc_JSONReader.html +++ b/api/IO_Misc_JSONReader.html @@ -48,8 +48,8 @@ - - + + @@ -277,7 +277,7 @@

diff --git a/api/IO_Misc_MTLReader.html b/api/IO_Misc_MTLReader.html index 4b79f4b2a5e..50b85946e62 100644 --- a/api/IO_Misc_MTLReader.html +++ b/api/IO_Misc_MTLReader.html @@ -48,8 +48,8 @@ - - + + @@ -385,7 +385,7 @@

diff --git a/api/IO_Misc_OBJReader.html b/api/IO_Misc_OBJReader.html index d4d096162a9..d1e32094e18 100644 --- a/api/IO_Misc_OBJReader.html +++ b/api/IO_Misc_OBJReader.html @@ -48,8 +48,8 @@ - - + + @@ -365,7 +365,7 @@

diff --git a/api/IO_Misc_PDBReader.html b/api/IO_Misc_PDBReader.html index 6642fe51a94..79551cf72ee 100644 --- a/api/IO_Misc_PDBReader.html +++ b/api/IO_Misc_PDBReader.html @@ -48,8 +48,8 @@ - - + + @@ -293,7 +293,7 @@

diff --git a/api/IO_Misc_SkyboxReader.html b/api/IO_Misc_SkyboxReader.html index d0a2c608d61..8701cc6f75d 100644 --- a/api/IO_Misc_SkyboxReader.html +++ b/api/IO_Misc_SkyboxReader.html @@ -48,8 +48,8 @@ - - + + @@ -121,7 +121,7 @@

diff --git a/api/IO_XML_XMLImageDataReader.html b/api/IO_XML_XMLImageDataReader.html index 7f523d6cb77..7b1375d4e45 100644 --- a/api/IO_XML_XMLImageDataReader.html +++ b/api/IO_XML_XMLImageDataReader.html @@ -48,8 +48,8 @@ - - + + @@ -206,7 +206,7 @@

diff --git a/api/IO_XML_XMLImageDataWriter.html b/api/IO_XML_XMLImageDataWriter.html index d67db04fa24..7b17f45552f 100644 --- a/api/IO_XML_XMLImageDataWriter.html +++ b/api/IO_XML_XMLImageDataWriter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_XML_XMLPolyDataReader.html b/api/IO_XML_XMLPolyDataReader.html index 765c86de3ee..b6c6bd6a982 100644 --- a/api/IO_XML_XMLPolyDataReader.html +++ b/api/IO_XML_XMLPolyDataReader.html @@ -48,8 +48,8 @@ - - + + @@ -206,7 +206,7 @@

diff --git a/api/IO_XML_XMLPolyDataWriter.html b/api/IO_XML_XMLPolyDataWriter.html index 171ee019012..ec37fe7492c 100644 --- a/api/IO_XML_XMLPolyDataWriter.html +++ b/api/IO_XML_XMLPolyDataWriter.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/IO_XML_XMLReader.html b/api/IO_XML_XMLReader.html index b80ed40e9cc..1605114b922 100644 --- a/api/IO_XML_XMLReader.html +++ b/api/IO_XML_XMLReader.html @@ -48,8 +48,8 @@ - - + + @@ -422,7 +422,7 @@

diff --git a/api/IO_XML_XMLWriter.html b/api/IO_XML_XMLWriter.html index 6da9d17ff68..4527ba8a3f5 100644 --- a/api/IO_XML_XMLWriter.html +++ b/api/IO_XML_XMLWriter.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

diff --git a/api/Imaging_Core_AbstractImageInterpolator.html b/api/Imaging_Core_AbstractImageInterpolator.html index 012263d5e08..bc42d3c3161 100644 --- a/api/Imaging_Core_AbstractImageInterpolator.html +++ b/api/Imaging_Core_AbstractImageInterpolator.html @@ -41,15 +41,15 @@ - + - + - - + + @@ -113,13 +113,14 @@

AbstractImageInterpolator

-

Source

Constants.js
export const ImageBorderMode = {
CLAMP: 0,
REPEAT: 1,
MIRROR: 2,
};

export const InterpolationMode = {
NEAREST: 0,
LINEAR: 1,
CUBIC: 2,
};

export default {
ImageBorderMode,
InterpolationMode,
};
+

Source

Constants.d.ts
export declare enum ImageBorderMode {
CLAMP = 0,
REPEAT = 1,
MIRROR = 2,
}

export declare enum InterpolationMode {
NEAREST = 0,
LINEAR = 1,
CUBIC = 2,
}

declare const _default: {
ImageBorderMode: typeof ImageBorderMode;
InterpolationMode: typeof InterpolationMode;
};

export default _default;
+
Constants.js
export const ImageBorderMode = {
CLAMP: 0,
REPEAT: 1,
MIRROR: 2,
};

export const InterpolationMode = {
NEAREST: 0,
LINEAR: 1,
CUBIC: 2,
};

export default {
ImageBorderMode,
InterpolationMode,
};
InterpolationInfo.js
import { ImageBorderMode, InterpolationMode } from './Constants';

export const vtkInterpolationInfo = {
pointer: null,
extent: [0, -1, 0, -1, 0, -1],
increments: [0, 0, 0],
scalarType: null, // dataType
dataTypeSize: 1, // BYTES_PER_ELEMENT
numberOfComponents: 1,
borderMode: ImageBorderMode.CLAMP,
interpolationMode: InterpolationMode.LINEAR,
extraInfo: null,
};

export const vtkInterpolationWeights = {
...vtkInterpolationInfo,
positions: [0, 0, 0],
weights: null,
weightExtent: [0, -1, 0, -1, 0, -1],
kernelSize: [1, 1, 1],
workspace: null,
lastY: null,
lastZ: null,
};

export function vtkInterpolationMathFloor(x) {
const integer = Math.floor(x);
return {
floored: integer,
error: x - integer,
};
}

export function vtkInterpolationMathRound(x) {
return Math.round(x);
}

//----------------------------------------------------------------------------
// Perform a clamp to limit an index to [b, c] and subtract b.

export function vtkInterpolationMathClamp(a, b, c) {
let clamp = a <= c ? a : c;
clamp -= b;
clamp = clamp >= 0 ? clamp : 0;
return clamp;
}

//----------------------------------------------------------------------------
// Perform a wrap to limit an index to [b, c] and subtract b.

export function vtkInterpolationMathWrap(a, b, c) {
const range = c - b + 1;
let wrap = a - b;
wrap %= range;
// required for some % implementations
wrap = wrap >= 0 ? wrap : wrap + range;
return wrap;
}

//----------------------------------------------------------------------------
// Perform a mirror to limit an index to [b, c] and subtract b.

export function vtkInterpolationMathMirror(a, b, c) {
const range = c - b;
const ifzero = range === 0 ? 1 : 0;
const range2 = 2 * range + ifzero;
let mirror = a - b;
mirror = mirror >= 0 ? mirror : -mirror;
mirror %= range2;
mirror = mirror <= range ? mirror : range2 - mirror;
return mirror;
}

export default {
vtkInterpolationInfo,
vtkInterpolationWeights,
vtkInterpolationMathFloor,
vtkInterpolationMathRound,
vtkInterpolationMathClamp,
vtkInterpolationMathWrap,
vtkInterpolationMathMirror,
};
index.js
import macro from 'vtk.js/Sources/macros';
import Constants from 'vtk.js/Sources/Imaging/Core/AbstractImageInterpolator/Constants';
import { vtkInterpolationInfo } from './InterpolationInfo';

const { ImageBorderMode } = Constants;

// ----------------------------------------------------------------------------
// Global methods
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// vtkAbstractImageInterpolator methods
// ----------------------------------------------------------------------------

function vtkAbstractImageInterpolator(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkAbstractImageInterpolator');

publicAPI.initialize = (data) => {
publicAPI.releaseData();
model.scalars = data.getPointData().getScalars();
model.spacing = data.getSpacing();
model.origin = data.getOrigin();
model.extent = data.getExtent();

publicAPI.update();
};
publicAPI.releaseData = () => {
model.scalars = null;
};
publicAPI.update = () => {
if (!model.scalars) {
model.interpolationInfo.pointer = null;
model.interpolationInfo.numberOfComponents = 1;
return;
}
model.interpolationInfo.extent = model.extent.slice();
const supportSize = publicAPI.computeSupportSize(null);
const kernelSize = Math.max(
Math.max(supportSize[0], supportSize[1]),
supportSize[2]
);
const minBound = Number.MIN_SAFE_INTEGER + kernelSize / 2;
const maxBound = Number.MAX_SAFE_INTEGER - kernelSize / 2;
for (let i = 0; i < 3; ++i) {
const newTol = Math.max(
0.5 * (model.extent[2 * i] === model.extent[2 * i + 1]),
model.tolerance
);
model.structuredBounds[2 * i] = Math.max(
model.extent[2 * i] - newTol,
minBound
);
model.structuredBounds[2 * i + 1] = Math.min(
model.extent[2 * i + 1] + newTol,
maxBound
);
}
const xdim = model.extent[1] - model.extent[0] + 1;
const ydim = model.extent[3] - model.extent[2] + 1;

const ncomp = model.scalars.getNumberOfComponents();
model.interpolationInfo.increments[0] = ncomp;
model.interpolationInfo.increments[1] =
model.interpolationInfo.increments[0] * xdim;
model.interpolationInfo.increments[2] =
model.interpolationInfo.increments[1] * ydim;

let component = model.componentOffset;
component = component > 0 ? component : 0;
component = component < ncomp ? component : ncomp - 1;

const dataSize = 1; // scalars.getDataTypeSize()
const inPtr = model.scalars.getData();
model.interpolationInfo.pointer = inPtr.subarray(component * dataSize);

model.interpolationInfo.scalarType = model.scalars.dataType;
model.interpolationInfo.dataTypeSize = 1; // model.scalars.getElementComponentSize();
model.interpolationInfo.numberOfComponents =
publicAPI.computeNumberOfComponents(ncomp);

model.interpolationInfo.borderMode = model.borderMode;
publicAPI.internalUpdate();

// TODO get functions
};
publicAPI.internalUpdate = () => {};
publicAPI.interpolateXYZ = (x, y, z, component) => {
let value = model.outValue;
const point = [x, y, z];
const p = [
(point[0] - model.origin[0]) / model.spacing[0],
(point[1] - model.origin[1]) / model.spacing[1],
(point[2] - model.origin[2]) / model.spacing[2],
];
if (publicAPI.checkBoundsIJK(p)) {
const iinfo = { ...model.interpolationInfo };
const ncomp = iinfo.increments[0] - model.componentOffset;
const dataTypeSize = 1; // iinfo.dataTypeSize; // vtkAbstractArray::getDataTypeSize(iinfo.scalarType)

let c = component > 0 ? component : 0;
c = c < ncomp ? c : ncomp - 1;
iinfo.pointer = model.interpolationInfo.pointer.subarray(
dataTypeSize * c
);
iinfo.numberOfComponents = 1;

const v = [value];
publicAPI.interpolatePoint(iinfo, p, v);
value = v[0];
}
return value;
};

publicAPI.interpolate = (point, value) => {
const p = [
(point[0] - model.origin[0]) / model.spacing[0],
(point[1] - model.origin[1]) / model.spacing[1],
(point[2] - model.origin[2]) / model.spacing[2],
];

if (publicAPI.checkBoundsIJK(p)) {
publicAPI.interpolatePoint(model.interpolationInfo, p, value);
return true;
}

for (let i = 0; i < model.interpolationInfo.numberOfComponents; ++i) {
value[i] = model.outValue;
}
return false;
};

publicAPI.computeNumberOfComponents = (inputCount) => {
const component = Math.min(
Math.max(model.componentOffset, 0),
inputCount - 1
);
const count =
model.componentCount < inputCount - component
? model.componentCount
: inputCount - component;
return count > 0 ? count : inputCount - component;
};

publicAPI.getNumberOfComponents = () =>
model.interpolationInfo.numberOfComponents;

publicAPI.interpolateIJK = (point, value) => {
publicAPI.interpolatePoint(model.interpolationInfo, point, value);
};

publicAPI.checkBoundsIJK = (point) =>
!(
point[0] < model.structuredBounds[0] ||
point[0] > model.structuredBounds[1] ||
point[1] < model.structuredBounds[2] ||
point[1] > model.structuredBounds[3] ||
point[2] < model.structuredBounds[4] ||
point[2] > model.structuredBounds[5]
);

publicAPI.computeSupportSize = null; // (matrix) => {};
publicAPI.isSeparable = null;
publicAPI.precomputeWeightsForExtent = (matrix, inExtent, checkExtent) => {};
publicAPI.FreePrecomputedWeights = (weights) => {
/*
for (let k = 0; k < 3; ++k) {
const step = weights.kernelSize[k];
// TODO: check if ok
weights.positions[k] += step * weights.weightExtent[2 * k];
if (weights.weights[k]) {
// TODO: check if ok
weights.weights[k] += step * weights.weightExtent[2 * k];
}
}

if (weights.workspace) {
for (let i = 1; i < weights.kernelSize[1]; ++i) {
// TODO
...
}
}
*/
};
publicAPI.interpolatePoint = (interpolationInfo, point, value) => {};
publicAPI.interpolateRow = (weights, xIdx, yIdx, zIdx, value, n) => {};
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
outValue: 0,
tolerance: Number.EPSILON,
componentOffset: 0,
componentCount: -1,
borderMode: ImageBorderMode.CLAMP,
slidingWindow: false,

scalars: null,
interpolationInfo: { ...vtkInterpolationInfo },
interpolationFunc: null,
rowInterpolationFunc: null,
structuredBounds: [0, -1, 0, -1, 0, -1],
spacing: null,
origin: null,
extent: null,
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Object methods
macro.obj(publicAPI, model);
macro.setGet(publicAPI, model, [
'outValue',
'tolerance',
'componentOffset',
'componentCount',
'borderMode',
'slidingWindow',
]);
macro.get(publicAPI, model, ['origin', 'spacing']);

// Object specific methods
vtkAbstractImageInterpolator(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(
extend,
'vtkAbstractImageInterpolator'
);

// ----------------------------------------------------------------------------

export default { newInstance, extend, ...Constants };
diff --git a/api/Imaging_Core_ImageInterpolator.html b/api/Imaging_Core_ImageInterpolator.html index d986ae33258..39c4dbc8bb5 100644 --- a/api/Imaging_Core_ImageInterpolator.html +++ b/api/Imaging_Core_ImageInterpolator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Imaging_Core_ImagePointDataIterator.html b/api/Imaging_Core_ImagePointDataIterator.html index 8992c8b5849..e75ed8d3141 100644 --- a/api/Imaging_Core_ImagePointDataIterator.html +++ b/api/Imaging_Core_ImagePointDataIterator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

diff --git a/api/Imaging_Core_ImageReslice.html b/api/Imaging_Core_ImageReslice.html index 18c70d2e605..471b6fe37bf 100644 --- a/api/Imaging_Core_ImageReslice.html +++ b/api/Imaging_Core_ImageReslice.html @@ -48,8 +48,8 @@ - - + + @@ -119,30 +119,1625 @@

Usage

Provide the input to the filter via the standard
SetInput(Data/Connection) methods.

-
const imageReslice = vtkImageReslice.newInstance();
imageReslice.setInputData(imageData);
imageReslice.setOutputDimensionality(2);
const axes = mat4.identity(new Float64Array(16));
mat4.rotateX(axes, axes, 45 * Math.PI / 180);
imageReslice.setResliceAxes(axes);
imageReslice.setOutputScalarType('Uint16Array');
imageReslice.setScalarScale(65535 / 255);

const obliqueSlice = imageReslice.getOutputData();
- -

Public API

ResliceAxes (set/get)

This method is used to set up the axes for the output voxels.
The output Spacing, Origin, and Extent specify the locations
of the voxels within the coordinate system defined by the axes.
The ResliceAxes are used most often to permute the data, e.g.
to extract ZY or XZ slices of a volume as 2D XY images.
The first column of the matrix specifies the x-axis
vector (the fourth element must be set to zero), the second
column specifies the y-axis, and the third column the
z-axis. The fourth column is the origin of the
axes (the fourth element must be set to one).

-

OutputDimensionality (set/get)

Force the dimensionality of the output to either 1, 2,
3 or 0 (default: 3). If the dimensionality is 2D, then
the Z extent of the output is forced to (0,0) and the Z
origin of the output is forced to 0.0 (i.e. the output
extent is confined to the xy plane). If the dimensionality
is 1D, the output extent is confined to the x axis.
For 0D, the output extent consists of a single voxel at
(0,0,0).

-

OutputOrigin (set/get)

Set the origin for the output data. The default output origin
is the input origin permuted through the ResliceAxes.

-

OutputSpacing (set/get)

Set the voxel spacing for the output data. The default output
spacing is the input spacing permuted through the ResliceAxes.

-

OutputExtent (set/get)

Set the extent for the output data. The default output extent
is the input extent permuted through the ResliceAxes.

-

OutputScalarType (set/get)

Set the scalar type of the output to be different from the input.
The default value is null, which means that the input scalar type will be
used to set the output scalar type. Otherwise, this must be set to one
of the following types: VtkDataTypes.CHAR, VtkDataTypes.SIGNED_CHAR,
VtkDataTypes.UNSIGNED_CHAR, VtkDataTypes.SHORT, VtkDataTypes.UNSIGNED_SHORT,
VtkDataTypes.INT, VtkDataTypes.UNSIGNED_INT, VtkDataTypes.FLOAT or
VtkDataTypes.DOUBLE. Other types are not permitted. If the output type
is an integer type, the output will be rounded and clamped to the limits of
the type.

-

See the documentation for vtkDataArray::getDataType() for additional data type settings.

-

ScalarShift (set/get)

Set a value to add to all the output voxels.
After a sample value has been interpolated from the input image, the
equation u = (v + ScalarShift)*ScalarScale will be applied to it before
it is written to the output image. The result will always be clamped to
the limits of the output data type.

-

ScalarScale (set/get)

Set multiplication factor to apply to all the output voxels.
After a sample value has been interpolated from the input image, the
equation u = (v + ScalarShift)*ScalarScale will be applied to it before
it is written to the output image. The result will always be clamped to
the limits of the output data type.

-

Wrap (set/get)

Turn on wrap-pad feature (default: false).

-

Mirror (set/get)

Turn on mirror-pad feature (default: false). This will override the wrap-pad.

-

Border (set/get)

Extend the apparent input border by a half voxel (default: On).
This changes how interpolation is handled at the borders of the
input image: if the center of an output voxel is beyond the edge
of the input image, but is within a half voxel width of the edge
(using the input voxel width), then the value of the output voxel
is calculated as if the input’s edge voxels were duplicated past
the edges of the input.
This has no effect if Mirror or Wrap are on.

-

BackgroundColor (set/get)

Set the background color (for multi-component images).

-

TransformInputSampling (set/get)

Specify whether to transform the spacing, origin and extent
of the Input (or the InformationInput) according to the
direction cosines and origin of the ResliceAxes before applying
them as the default output spacing, origin and extent
(default: true).

-

AutoCropOutput (set/get)

Turn this on if you want to guarantee that the extent of the
output will be large enough to ensure that none of the
data will be cropped (default: false).

-

Source

Constants.js
export const SlabMode = {
MIN: 0,
MAX: 1,
MEAN: 2,
SUM: 3,
};

export default {
SlabMode,
};
-
index.js
import { vec4, mat4 } from 'gl-matrix';

import macro, { vtkWarningMacro } from 'vtk.js/Sources/macros';
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray';
import vtkMath from 'vtk.js/Sources/Common/Core/Math';
import vtkMatrixBuilder from 'vtk.js/Sources/Common/Core/MatrixBuilder';
import { VtkDataTypes } from 'vtk.js/Sources/Common/Core/DataArray/Constants';
import vtkBoundingBox from 'vtk.js/Sources/Common/DataModel/BoundingBox';
import vtkImageData from 'vtk.js/Sources/Common/DataModel/ImageData';
import vtkImageInterpolator from 'vtk.js/Sources/Imaging/Core/ImageInterpolator';
import vtkImagePointDataIterator from 'vtk.js/Sources/Imaging/Core/ImagePointDataIterator';
import {
ImageBorderMode,
InterpolationMode,
} from 'vtk.js/Sources/Imaging/Core/AbstractImageInterpolator/Constants';
import {
vtkInterpolationMathFloor,
vtkInterpolationMathRound,
vtkInterpolationMathClamp,
} from 'vtk.js/Sources/Imaging/Core/AbstractImageInterpolator/InterpolationInfo';
import Constants from 'vtk.js/Sources/Imaging/Core/ImageReslice/Constants';

const { SlabMode } = Constants;

const { vtkErrorMacro } = macro;

// ----------------------------------------------------------------------------
// vtkImageReslice methods
// ----------------------------------------------------------------------------

function vtkImageReslice(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkImageReslice');
const superClass = { ...publicAPI };

const indexMatrix = mat4.identity(new Float64Array(16));
let optimizedTransform = null;

function getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f) {
const n = sampleCount - 1;
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i] * 0.5;
for (let j = 1; j < n; j += 1) {
result += tmpPtr[i + j * inComponents];
}
result += tmpPtr[i + n * inComponents] * 0.5;
tmpPtr[i] = result * f;
}
}

function getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result += tmpPtr[i + j * inComponents];
}
tmpPtr[i] = result * f;
}
}

function getImageResliceCompositeMinValue(tmpPtr, inComponents, sampleCount) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result = Math.min(result, tmpPtr[i + j * inComponents]);
}
tmpPtr[i] = result;
}
}

function getImageResliceCompositeMaxValue(tmpPtr, inComponents, sampleCount) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result = Math.max(result, tmpPtr[i + j * inComponents]);
}
tmpPtr[i] = result;
}
}

function getImageResliceCompositeMeanValue(
tmpPtr,
inComponents,
sampleCount
) {
const f = 1.0 / sampleCount;
getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeMeanTrap(tmpPtr, inComponents, sampleCount) {
const f = 1.0 / (sampleCount - 1);
getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeSumValue(tmpPtr, inComponents, sampleCount) {
const f = 1.0;
getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeSumTrap(tmpPtr, inComponents, sampleCount) {
const f = 1.0;
getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
}

publicAPI.getMTime = () => {
let mTime = superClass.getMTime();
if (model.resliceTransform) {
mTime = Math.max(mTime, model.resliceTransform.getMTime());
}
return mTime;
};

publicAPI.setResliceAxes = (resliceAxes) => {
if (!model.resliceAxes) {
model.resliceAxes = mat4.identity(new Float64Array(16));
}

if (!mat4.exactEquals(model.resliceAxes, resliceAxes)) {
mat4.copy(model.resliceAxes, resliceAxes);

publicAPI.modified();
return true;
}
return null;
};

publicAPI.requestData = (inData, outData) => {
// implement requestData
const input = inData[0];

if (!input) {
vtkErrorMacro('Invalid or missing input');
return;
}

// console.time('reslice');

// Retrieve output and volume data
const origin = input.getOrigin();
const inSpacing = input.getSpacing();
const dims = input.getDimensions();
const inScalars = input.getPointData().getScalars();
const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];

const outOrigin = [0, 0, 0];
const outSpacing = [1, 1, 1];
const outWholeExt = [0, 0, 0, 0, 0, 0];
const outDims = [0, 0, 0];

const matrix = mat4.identity(new Float64Array(16));
if (model.resliceAxes) {
mat4.multiply(matrix, matrix, model.resliceAxes);
}
const imatrix = new Float64Array(16);
mat4.invert(imatrix, matrix);

const inCenter = [
origin[0] + 0.5 * (inWholeExt[0] + inWholeExt[1]) * inSpacing[0],
origin[1] + 0.5 * (inWholeExt[2] + inWholeExt[3]) * inSpacing[1],
origin[2] + 0.5 * (inWholeExt[4] + inWholeExt[5]) * inSpacing[2],
];

let maxBounds = null;
if (model.autoCropOutput) {
maxBounds = publicAPI.getAutoCroppedOutputBounds(input);
}

for (let i = 0; i < 3; i++) {
let s = 0; // default output spacing
let d = 0; // default linear dimension
let e = 0; // default extent start
let c = 0; // transformed center-of-volume

if (model.transformInputSampling) {
let r = 0.0;
for (let j = 0; j < 3; j++) {
c += imatrix[4 * j + i] * (inCenter[j] - matrix[4 * 3 + j]);
const tmp = matrix[4 * i + j] * matrix[4 * i + j];
s += tmp * Math.abs(inSpacing[j]);
d +=
tmp *
(inWholeExt[2 * j + 1] - inWholeExt[2 * j]) *
Math.abs(inSpacing[j]);
e += tmp * inWholeExt[2 * j];
r += tmp;
}
s /= r;
d /= r * Math.sqrt(r);
e /= r;
} else {
c = inCenter[i];
s = inSpacing[i];
d = (inWholeExt[2 * i + 1] - inWholeExt[2 * i]) * s;
e = inWholeExt[2 * i];
}

if (model.outputSpacing == null) {
outSpacing[i] = s;
} else {
outSpacing[i] = model.outputSpacing[i];
}

if (i >= model.outputDimensionality) {
outWholeExt[2 * i] = 0;
outWholeExt[2 * i + 1] = 0;
} else if (model.outputExtent == null) {
if (model.autoCropOutput) {
d = maxBounds[2 * i + 1] - maxBounds[2 * i];
}
outWholeExt[2 * i] = Math.round(e);
outWholeExt[2 * i + 1] = Math.round(
outWholeExt[2 * i] + Math.abs(d / outSpacing[i])
);
} else {
outWholeExt[2 * i] = model.outputExtent[2 * i];
outWholeExt[2 * i + 1] = model.outputExtent[2 * i + 1];
}

if (i >= model.outputDimensionality) {
outOrigin[i] = 0;
} else if (model.outputOrigin == null) {
if (model.autoCropOutput) {
// set origin so edge of extent is edge of bounds
outOrigin[i] = maxBounds[2 * i] - outWholeExt[2 * i] * outSpacing[i];
} else {
// center new bounds over center of input bounds
outOrigin[i] =
c -
0.5 * (outWholeExt[2 * i] + outWholeExt[2 * i + 1]) * outSpacing[i];
}
} else {
outOrigin[i] = model.outputOrigin[i];
}
outDims[i] = outWholeExt[2 * i + 1] - outWholeExt[2 * i] + 1;
}

let dataType = inScalars.getDataType();
if (model.outputScalarType) {
dataType = model.outputScalarType;
}

const numComponents = input
.getPointData()
.getScalars()
.getNumberOfComponents(); // or s.numberOfComponents;

const outScalarsData = macro.newTypedArray(
dataType,
outDims[0] * outDims[1] * outDims[2] * numComponents
);
const outScalars = vtkDataArray.newInstance({
name: 'Scalars',
values: outScalarsData,
numberOfComponents: numComponents,
});

// Update output
const output = vtkImageData.newInstance();
output.setDimensions(outDims);
output.setOrigin(outOrigin);
output.setSpacing(outSpacing);
if (model.outputDirection) {
output.setDirection(model.outputDirection);
}
output.getPointData().setScalars(outScalars);

publicAPI.getIndexMatrix(input, output);

let interpolationMode = model.interpolationMode;
model.usePermuteExecute = false;
if (model.optimization) {
if (
optimizedTransform == null &&
model.slabSliceSpacingFraction === 1.0 &&
model.interpolator.isSeparable() &&
publicAPI.isPermutationMatrix(indexMatrix)
) {
model.usePermuteExecute = true;
if (publicAPI.canUseNearestNeighbor(indexMatrix, outWholeExt)) {
interpolationMode = InterpolationMode.NEAREST;
}
}
}
model.interpolator.setInterpolationMode(interpolationMode);

let borderMode = ImageBorderMode.CLAMP;
borderMode = model.wrap ? ImageBorderMode.REPEAT : borderMode;
borderMode = model.mirror ? ImageBorderMode.MIRROR : borderMode;
model.interpolator.setBorderMode(borderMode);

const mintol = 7.62939453125e-6;
const maxtol = 2.0 * 2147483647;
let tol = 0.5 * model.border;
tol = borderMode === ImageBorderMode.CLAMP ? tol : maxtol;
tol = tol > mintol ? tol : mintol;
model.interpolator.setTolerance(tol);

model.interpolator.initialize(input);

publicAPI.vtkImageResliceExecute(input, output);

model.interpolator.releaseData();

outData[0] = output;

// console.timeEnd('reslice');
};

publicAPI.vtkImageResliceExecute = (input, output) => {
// const outDims = output.getDimensions();
const inScalars = input.getPointData().getScalars();
const outScalars = output.getPointData().getScalars();
let outPtr = outScalars.getData();
const outExt = output.getExtent();
const newmat = indexMatrix;
const outputStencil = null;

// multiple samples for thick slabs
const nsamples = Math.max(model.slabNumberOfSlices, 1);

// spacing between slab samples (as a fraction of slice spacing).
const slabSampleSpacing = model.slabSliceSpacingFraction;

// check for perspective transformation
const perspective = publicAPI.isPerspectiveMatrix(newmat);

// extra scalar info for nearest-neighbor optimization
let inPtr = inScalars.getData();
const inputScalarSize = 1; // inScalars.getElementComponentSize(); // inScalars.getDataTypeSize();
const inputScalarType = inScalars.getDataType();
const inComponents = inScalars.getNumberOfComponents(); // interpolator.GetNumberOfComponents();
const componentOffset = model.interpolator.getComponentOffset();
const borderMode = model.interpolator.getBorderMode();
const inDims = input.getDimensions();
const inExt = [0, inDims[0] - 1, 0, inDims[1] - 1, 0, inDims[2] - 1]; // interpolator->GetExtent();
const inInc = [0, 0, 0];
inInc[0] = inScalars.getNumberOfComponents();
inInc[1] = inInc[0] * inDims[0];
inInc[2] = inInc[1] * inDims[1];

const fullSize = inDims[0] * inDims[1] * inDims[2];
if (componentOffset > 0 && componentOffset + inComponents < inInc[0]) {
inPtr = inPtr.subarray(inputScalarSize * componentOffset);
}

let interpolationMode = InterpolationMode.NEAREST;
if (model.interpolator.isA('vtkImageInterpolator')) {
interpolationMode = model.interpolator.getInterpolationMode();
}

const convertScalars = null;
const rescaleScalars =
model.scalarShift !== 0.0 || model.scalarScale !== 1.0;

// is nearest neighbor optimization possible?
const optimizeNearest =
interpolationMode === InterpolationMode.NEAREST &&
borderMode === ImageBorderMode.CLAMP &&
!(
optimizedTransform != null ||
perspective ||
convertScalars != null ||
rescaleScalars
) &&
inputScalarType === outScalars.getDataType() &&
fullSize === inScalars.getNumberOfTuples() &&
model.border === true &&
nsamples <= 1;

// get pixel information
const scalarType = outScalars.getDataType();
const scalarSize = 1; // outScalars.getElementComponentSize() // outScalars.scalarSize;
const outComponents = outScalars.getNumberOfComponents();

// break matrix into a set of axes plus an origin
// (this allows us to calculate the transform Incrementally)
const xAxis = [0, 0, 0, 0];
const yAxis = [0, 0, 0, 0];
const zAxis = [0, 0, 0, 0];
const origin = [0, 0, 0, 0];
for (let i = 0; i < 4; ++i) {
xAxis[i] = newmat[4 * 0 + i];
yAxis[i] = newmat[4 * 1 + i];
zAxis[i] = newmat[4 * 2 + i];
origin[i] = newmat[4 * 3 + i];
}

// allocate an output row of type double
let floatPtr = null;
if (!optimizeNearest) {
floatPtr = new Float64Array(
inComponents * (outExt[1] - outExt[0] + nsamples)
);
}

const background = macro.newTypedArray(
inputScalarType,
model.backgroundColor
);

// set color for area outside of input volume extent
// void *background;
// vtkAllocBackgroundPixel(&background,
// self->GetBackgroundColor(), scalarType, scalarSize, outComponents);

// get various helper functions
const forceClamping =
interpolationMode > InterpolationMode.LINEAR ||
(nsamples > 1 && model.slabMode === SlabMode.SUM);
const convertpixels = publicAPI.getConversionFunc(
inputScalarType,
scalarType,
model.scalarShift,
model.scalarScale,
forceClamping
);
const setpixels = publicAPI.getSetPixelsFunc(
scalarType,
scalarSize,
outComponents,
outPtr
);
const composite = publicAPI.getCompositeFunc(
model.slabMode,
model.slabTrapezoidIntegration
);

// create some variables for when we march through the data
let idY = outExt[2] - 1;
let idZ = outExt[4] - 1;
const inPoint0 = [0.0, 0.0, 0.0, 0.0];
const inPoint1 = [0.0, 0.0, 0.0, 0.0];

// create an iterator to march through the data
const iter = vtkImagePointDataIterator.newInstance();
iter.initialize(output, outExt, model.stencil, null);
const outPtr0 = iter.getScalars(output, 0);
let outPtrIndex = 0;
const outTmp = macro.newTypedArray(
scalarType,
vtkBoundingBox.getDiagonalLength(outExt) * outComponents * 2
);

const interpolatedPtr = new Float64Array(inComponents * nsamples);
const interpolatedPoint = new Float64Array(inComponents);

for (; !iter.isAtEnd(); iter.nextSpan()) {
const span = iter.spanEndId() - iter.getId();
outPtrIndex = iter.getId() * scalarSize * outComponents;

if (!iter.isInStencil()) {
// clear any regions that are outside the stencil
const n = setpixels(outTmp, background, outComponents, span);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}
} else {
// get output index, and compute position in input image
const outIndex = iter.getIndex();

// if Z index increased, then advance position along Z axis
if (outIndex[2] > idZ) {
idZ = outIndex[2];
inPoint0[0] = origin[0] + idZ * zAxis[0];
inPoint0[1] = origin[1] + idZ * zAxis[1];
inPoint0[2] = origin[2] + idZ * zAxis[2];
inPoint0[3] = origin[3] + idZ * zAxis[3];
idY = outExt[2] - 1;
}

// if Y index increased, then advance position along Y axis
if (outIndex[1] > idY) {
idY = outIndex[1];
inPoint1[0] = inPoint0[0] + idY * yAxis[0];
inPoint1[1] = inPoint0[1] + idY * yAxis[1];
inPoint1[2] = inPoint0[2] + idY * yAxis[2];
inPoint1[3] = inPoint0[3] + idY * yAxis[3];
}

// march through one row of the output image
const idXmin = outIndex[0];
const idXmax = idXmin + span - 1;

if (!optimizeNearest) {
let wasInBounds = 1;
let isInBounds = 1;
let startIdX = idXmin;
let idX = idXmin;
const tmpPtr = floatPtr;
let pixelIndex = 0;

while (startIdX <= idXmax) {
for (; idX <= idXmax && isInBounds === wasInBounds; idX++) {
const inPoint2 = [
inPoint1[0] + idX * xAxis[0],
inPoint1[1] + idX * xAxis[1],
inPoint1[2] + idX * xAxis[2],
inPoint1[3] + idX * xAxis[3],
];

const inPoint3 = [0, 0, 0, 0];
let inPoint = inPoint2;
isInBounds = false;

let interpolatedPtrIndex = 0;
for (let sample = 0; sample < nsamples; ++sample) {
if (nsamples > 1) {
let s = sample - 0.5 * (nsamples - 1);
s *= slabSampleSpacing;
inPoint3[0] = inPoint2[0] + s * zAxis[0];
inPoint3[1] = inPoint2[1] + s * zAxis[1];
inPoint3[2] = inPoint2[2] + s * zAxis[2];
inPoint3[3] = inPoint2[3] + s * zAxis[3];
inPoint = inPoint3;
}

if (perspective) {
// only do perspective if necessary
const f = 1 / inPoint[3];
inPoint[0] *= f;
inPoint[1] *= f;
inPoint[2] *= f;
}

if (optimizedTransform !== null) {
// get the input origin and spacing for conversion purposes
const inOrigin = model.interpolator.getOrigin();
const inSpacing = model.interpolator.getSpacing();
const inInvSpacing = [
1.0 / inSpacing[0],
1.0 / inSpacing[1],
1.0 / inSpacing[2],
];

// apply the AbstractTransform if there is one
// TBD: handle inDirection
publicAPI.applyTransform(
optimizedTransform,
inPoint,
inOrigin,
inInvSpacing
);
}

if (model.interpolator.checkBoundsIJK(inPoint)) {
// do the interpolation
isInBounds = 1;
model.interpolator.interpolateIJK(inPoint, interpolatedPoint);
for (let i = 0; i < inComponents; ++i) {
interpolatedPtr[interpolatedPtrIndex++] =
interpolatedPoint[i];
}
}
}

if (interpolatedPtrIndex > inComponents) {
composite(
interpolatedPtr,
inComponents,
interpolatedPtrIndex / inComponents
);
}
for (let i = 0; i < inComponents; ++i) {
tmpPtr[pixelIndex++] = interpolatedPtr[i];
}

// set "was in" to "is in" if first pixel
wasInBounds = idX > idXmin ? wasInBounds : isInBounds;
}

// write a segment to the output
const endIdX = idX - 1 - (isInBounds !== wasInBounds);
const numpixels = endIdX - startIdX + 1;

let n = 0;
if (wasInBounds) {
if (outputStencil) {
outputStencil.insertNextExtent(startIdX, endIdX, idY, idZ);
}

if (rescaleScalars) {
publicAPI.rescaleScalars(
floatPtr,
inComponents,
idXmax - idXmin + 1,
model.scalarShift,
model.scalarScale
);
}

if (convertScalars) {
convertScalars(
floatPtr.subarray(startIdX * inComponents),
outTmp,
inputScalarType,
inComponents,
numpixels,
startIdX,
idY,
idZ
);
n = numpixels * outComponents * scalarSize;
} else {
n = convertpixels(
outTmp,
floatPtr.subarray(startIdX * inComponents),
outComponents,
numpixels
);
}
} else {
n = setpixels(outTmp, background, outComponents, numpixels);
}
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}

startIdX += numpixels;
wasInBounds = isInBounds;
}
} else {
// optimize for nearest-neighbor interpolation
const inPtrTmp0 = inPtr;
const outPtrTmp = outPtr;

const inIncX = inInc[0] * inputScalarSize;
const inIncY = inInc[1] * inputScalarSize;
const inIncZ = inInc[2] * inputScalarSize;

const inExtX = inExt[1] - inExt[0] + 1;
const inExtY = inExt[3] - inExt[2] + 1;
const inExtZ = inExt[5] - inExt[4] + 1;

let startIdX = idXmin;
let endIdX = idXmin - 1;
let isInBounds = false;
const bytesPerPixel = inputScalarSize * inComponents;

for (let iidX = idXmin; iidX <= idXmax; iidX++) {
const inPoint = [
inPoint1[0] + iidX * xAxis[0],
inPoint1[1] + iidX * xAxis[1],
inPoint1[2] + iidX * xAxis[2],
];

const inIdX = vtkInterpolationMathRound(inPoint[0]) - inExt[0];
const inIdY = vtkInterpolationMathRound(inPoint[1]) - inExt[2];
const inIdZ = vtkInterpolationMathRound(inPoint[2]) - inExt[4];

if (
inIdX >= 0 &&
inIdX < inExtX &&
inIdY >= 0 &&
inIdY < inExtY &&
inIdZ >= 0 &&
inIdZ < inExtZ
) {
if (!isInBounds) {
// clear leading out-of-bounds pixels
startIdX = iidX;
isInBounds = true;
const n = setpixels(
outTmp,
background,
outComponents,
startIdX - idXmin
);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}
}
// set the final index that was within input bounds
endIdX = iidX;

// perform nearest-neighbor interpolation via pixel copy
let offset = inIdX * inIncX + inIdY * inIncY + inIdZ * inIncZ;

// when memcpy is used with a constant size, the compiler will
// optimize away the function call and use the minimum number
// of instructions necessary to perform the copy
switch (bytesPerPixel) {
case 1:
outPtr0[outPtrIndex++] = inPtrTmp0[offset];
break;
case 2:
case 3:
case 4:
case 8:
case 12:
case 16:
for (let i = 0; i < bytesPerPixel; ++i) {
outPtr0[outPtrIndex++] = inPtrTmp0[offset + i];
}
break;
default: {
// TODO: check bytes
let oc = 0;
do {
outPtr0[outPtrIndex++] = inPtrTmp0[offset++];
} while (++oc !== bytesPerPixel);
break;
}
}
} else if (isInBounds) {
// leaving input bounds
break;
}
}

// clear trailing out-of-bounds pixels
outPtr = outPtrTmp;
const n = setpixels(
outTmp,
background,
outComponents,
idXmax - endIdX
);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}

if (outputStencil && endIdX >= startIdX) {
outputStencil.insertNextExtent(startIdX, endIdX, idY, idZ);
}
}
}
}
};
/**
* The transform matrix supplied by the user converts output coordinates
* to input coordinates.
* To speed up the pixel lookup, the following function provides a
* matrix which converts output pixel indices to input pixel indices.
* This will also concatenate the ResliceAxes and the ResliceTransform
* if possible (if the ResliceTransform is a 4x4 matrix transform).
* If it does, this->OptimizedTransform will be set to nullptr, otherwise
* this->OptimizedTransform will be equal to this->ResliceTransform.
* @param {vtkPolyData} input
* @param {vtkPolyData} output
* @returns
*/
publicAPI.getIndexMatrix = (input, output) => {
const transform = mat4.identity(new Float64Array(16));
optimizedTransform = null;

if (model.resliceAxes) {
mat4.copy(transform, model.resliceAxes);
}
if (model.resliceTransform) {
if (model.resliceTransform.isA('vtkHomogeneousTransform')) {
mat4.multiply(transform, model.resliceTransform.getMatrix(), transform);
} else {
// TODO
vtkWarningMacro('Non homogeneous transform have not yet been ported');
}
}

// the outMatrix takes OutputData indices to OutputData coordinates,
const outMatrix = output.getIndexToWorld();
mat4.multiply(transform, transform, outMatrix);

// the inMatrix takes InputData coordinates to InputData indices
// the optimizedTransform requires data coords, not index coords, as its input
if (optimizedTransform == null) {
const inMatrix = input.getWorldToIndex();
mat4.multiply(transform, inMatrix, transform);
}

mat4.copy(indexMatrix, transform);

return indexMatrix;
};

publicAPI.getAutoCroppedOutputBounds = (input) => {
const inOrigin = input.getOrigin();
const inSpacing = input.getSpacing();
const inDirection = input.getDirection();
const dims = input.getDimensions();
const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];

const matrix = new Float64Array(16);
if (model.resliceAxes) {
mat4.invert(matrix, model.resliceAxes);
} else {
mat4.identity(matrix);
}
let transform = null;
if (model.resliceTransform) {
transform = model.resliceTransform.getInverse();
}
let imageTransform = null;
if (!vtkMath.isIdentity3x3(inDirection)) {
imageTransform = vtkMatrixBuilder
.buildFromRadian()
.translate(inOrigin[0], inOrigin[1], inOrigin[2])
.multiply3x3(inDirection)
.translate(-inOrigin[0], -inOrigin[1], -inOrigin[2])
.invert()
.getMatrix();
}

const bounds = [
Number.MAX_VALUE,
-Number.MAX_VALUE,
Number.MAX_VALUE,
-Number.MAX_VALUE,
Number.MAX_VALUE,
-Number.MAX_VALUE,
];

const point = [0, 0, 0, 0];
for (let i = 0; i < 8; ++i) {
point[0] = inOrigin[0] + inWholeExt[i % 2] * inSpacing[0];
point[1] =
inOrigin[1] + inWholeExt[2 + (Math.floor(i / 2) % 2)] * inSpacing[1];
point[2] =
inOrigin[2] + inWholeExt[4 + (Math.floor(i / 4) % 2)] * inSpacing[2];
point[3] = 1.0;

if (imageTransform) {
vec4.transformMat4(point, point, imageTransform);
}

if (model.resliceTransform) {
transform.transformPoint(point, point);
}

vec4.transformMat4(point, point, matrix);

const f = 1.0 / point[3];
point[0] *= f;
point[1] *= f;
point[2] *= f;

for (let j = 0; j < 3; ++j) {
if (point[j] > bounds[2 * j + 1]) {
bounds[2 * j + 1] = point[j];
}
if (point[j] < bounds[2 * j]) {
bounds[2 * j] = point[j];
}
}
}
return bounds;
};

publicAPI.getDataTypeMinMax = (dataType) => {
switch (dataType) {
case 'Int8Array':
return { min: -128, max: 127 };
case 'Int16Array':
return { min: -32768, max: 32767 };
case 'Uint16Array':
return { min: 0, max: 65535 };
case 'Int32Array':
return { min: -2147483648, max: 2147483647 };
case 'Uint32Array':
return { min: 0, max: 4294967295 };
case 'Float32Array':
return { min: -1.2e38, max: 1.2e38 };
case 'Float64Array':
return { min: -1.2e38, max: 1.2e38 };
case 'Uint8Array':
case 'Uint8ClampedArray':
default:
return { min: 0, max: 255 };
}
};

publicAPI.clamp = (outPtr, inPtr, numscalars, n, min, max) => {
const count = n * numscalars;
for (let i = 0; i < count; ++i) {
outPtr[i] = vtkInterpolationMathClamp(inPtr[i], min, max);
}
return count;
};

publicAPI.convert = (outPtr, inPtr, numscalars, n) => {
const count = n * numscalars;
for (let i = 0; i < count; ++i) {
outPtr[i] = Math.round(inPtr[i]);
}
return count;
};

publicAPI.getConversionFunc = (
inputType,
dataType,
scalarShift,
scalarScale,
forceClamping
) => {
let useClamping = forceClamping;
if (
dataType !== VtkDataTypes.FLOAT &&
dataType !== VtkDataTypes.DOUBLE &&
!forceClamping
) {
const inMinMax = publicAPI.getDataTypeMinMax(inputType);
let checkMin = (inMinMax.min + scalarShift) * scalarScale;
let checkMax = (inMinMax.max + scalarShift) * scalarScale;
const outMinMax = publicAPI.getDataTypeMinMax(dataType);
const outputMin = outMinMax.min;
const outputMax = outMinMax.max;
if (checkMin > checkMax) {
const tmp = checkMax;
checkMax = checkMin;
checkMin = tmp;
}
useClamping = checkMin < outputMin || checkMax > outputMax;
}

if (
useClamping &&
dataType !== VtkDataTypes.FLOAT &&
dataType !== VtkDataTypes.DOUBLE
) {
const minMax = publicAPI.getDataTypeMinMax(dataType);
const clamp = (outPtr, inPtr, numscalars, n) =>
publicAPI.clamp(outPtr, inPtr, numscalars, n, minMax.min, minMax.max);
return clamp;
}
return publicAPI.convert;
};

publicAPI.set = (outPtr, inPtr, numscalars, n) => {
const count = numscalars * n;
for (let i = 0; i < n; ++i) {
outPtr[i] = inPtr[i];
}
return count;
};

publicAPI.set1 = (outPtr, inPtr, numscalars, n) => {
outPtr.fill(inPtr[0], 0, n);
return n;
};

publicAPI.getSetPixelsFunc = (dataType, dataSize, numscalars, dataPtr) =>
numscalars === 1 ? publicAPI.set1 : publicAPI.set;

publicAPI.getCompositeFunc = (slabMode, slabTrapezoidIntegration) => {
let composite = null;
// eslint-disable-next-line default-case
switch (slabMode) {
case SlabMode.MIN:
composite = getImageResliceCompositeMinValue;
break;
case SlabMode.MAX:
composite = getImageResliceCompositeMaxValue;
break;
case SlabMode.MEAN:
if (slabTrapezoidIntegration) {
composite = getImageResliceCompositeMeanTrap;
} else {
composite = getImageResliceCompositeMeanValue;
}
break;
case SlabMode.SUM:
if (slabTrapezoidIntegration) {
composite = getImageResliceCompositeSumTrap;
} else {
composite = getImageResliceCompositeSumValue;
}
break;
}

return composite;
};

publicAPI.applyTransform = (newTrans, inPoint, inOrigin, inInvSpacing) => {
inPoint[3] = 1;
vec4.transformMat4(inPoint, inPoint, newTrans);
inPoint[0] -= inOrigin[0];
inPoint[1] -= inOrigin[1];
inPoint[2] -= inOrigin[2];
inPoint[0] *= inInvSpacing[0];
inPoint[1] *= inInvSpacing[1];
inPoint[2] *= inInvSpacing[2];
};

publicAPI.rescaleScalars = (
floatData,
components,
n,
scalarShift,
scalarScale
) => {
const m = n * components;
for (let i = 0; i < m; ++i) {
floatData[i] = (floatData[i] + scalarShift) * scalarScale;
}
};

publicAPI.isPermutationMatrix = (matrix) => {
for (let i = 0; i < 3; i++) {
if (matrix[4 * i + 3] !== 0) {
return false;
}
}
if (matrix[4 * 3 + 3] !== 1) {
return false;
}
for (let j = 0; j < 3; j++) {
let k = 0;
for (let i = 0; i < 3; i++) {
if (matrix[4 * j + i] !== 0) {
k++;
}
}
if (k !== 1) {
return 0;
}
}
return 1;
};

// TODO: to move in vtkMath and add tolerance
publicAPI.isIdentityMatrix = (matrix) => {
for (let i = 0; i < 4; ++i) {
for (let j = 0; j < 4; ++j) {
if ((i === j ? 1.0 : 0.0) !== matrix[4 * j + i]) {
return false;
}
}
}
return true;
};

publicAPI.isPerspectiveMatrix = (matrix) =>
matrix[4 * 0 + 3] !== 0 ||
matrix[4 * 1 + 3] !== 0 ||
matrix[4 * 2 + 3] !== 0 ||
matrix[4 * 3 + 3] !== 1;

publicAPI.canUseNearestNeighbor = (matrix, outExt) => {
// loop through dimensions
for (let i = 0; i < 3; i++) {
let j;
for (j = 0; j < 3; j++) {
if (matrix[4 * j + i] !== 0) {
break;
}
}
if (j >= 3) {
return 0;
}
let x = matrix[4 * j + i];
let y = matrix[4 * 3 + i];
if (outExt[2 * j] === outExt[2 * j + 1]) {
y += x * outExt[2 * i];
x = 0;
}
const fx = vtkInterpolationMathFloor(x, 0).error;
const fy = vtkInterpolationMathFloor(y, 0).error;
if (fx !== 0 || fy !== 0) {
return 0;
}
}
return 1;
};
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
transformInputSampling: true,
autoCropOutput: false,
outputDimensionality: 3,
outputSpacing: null, // automatically computed if null
outputOrigin: null, // automatically computed if null
outputDirection: null, // identity if null
outputExtent: null, // automatically computed if null
outputScalarType: null,
wrap: false, // don't wrap
mirror: false, // don't mirror
border: true, // apply a border
interpolationMode: InterpolationMode.NEAREST, // only NEAREST supported so far
slabMode: SlabMode.MIN,
slabTrapezoidIntegration: false,
slabNumberOfSlices: 1,
slabSliceSpacingFraction: 1,
optimization: false, // not supported yet
scalarShift: 0, // for rescaling the data
scalarScale: 1,
backgroundColor: [0, 0, 0, 0],
resliceAxes: null,
// resliceTransform: null,
interpolator: vtkImageInterpolator.newInstance(),
usePermuteExecute: false, // no supported yet
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Make this a VTK object
macro.obj(publicAPI, model);

// Also make it an algorithm with one input and one output
macro.algo(publicAPI, model, 1, 1);

macro.setGet(publicAPI, model, [
'outputDimensionality',
'outputScalarType',
'scalarShift',
'scalarScale',
'transformInputSampling',
'autoCropOutput',
'wrap',
'mirror',
'border',
'interpolationMode',
'resliceTransform',
'slabMode',
'slabTrapezoidIntegration',
'slabNumberOfSlices',
'slabSliceSpacingFraction',
]);

macro.setGetArray(publicAPI, model, ['outputOrigin', 'outputSpacing'], 3);
macro.setGetArray(publicAPI, model, ['outputExtent'], 6);
macro.setGetArray(publicAPI, model, ['outputDirection'], 9);
macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);

macro.get(publicAPI, model, ['resliceAxes']);

// Object specific methods
macro.algo(publicAPI, model, 1, 1);
vtkImageReslice(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkImageReslice');

// ----------------------------------------------------------------------------

export default { newInstance, extend, ...Constants };
+

Methods

applyTransform

Apply newTrans, then translate by -origin, then scale by inInvSpacing

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
newTransYes
inPointYes
inOriginYes
inInvSpacingYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

canUseNearestNeighbor

+ + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
matrixYes
outExtYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

clamp

Internal function uses vtkInterpolationMathClamp on numscalars * n elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outPtrYes
inPtrYes
numscalarsYes
nYes
minYes
maxYes
+

Returns

+ + + + + + + + + + +
TypeDescription
The number of elements processed
+

convert

Internal function uses Math.round on numscalars * n elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outPtrYes
inPtrYes
numscalarsYes
nYes
+

Returns

+ + + + + + + + + + +
TypeDescription
The number of elements processed
+

extend

Method used to decorate a given object (publicAPI+model) with vtkImageReslice characteristics.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIImageResliceInitialValuesNo(default: {})
+

getAutoCropOutput

Returns

+ + + + + + + + + + +
TypeDescription
+

getAutoCroppedOutputBounds

Compute the bounds required to ensure that none of the data will be cropped

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
inputYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

getBackgroundColor

Returns

+ + + + + + + + + + +
TypeDescription
+

getBorder

Returns

+ + + + + + + + + + +
TypeDescription
+

getCompositeFunc

Returns the right composition function

+ + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
slabModeYes
slabTrapezoidIntegrationYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

getConversionFunc

Setup the conversion function and return the right one

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
inputTypeYes
dataTypeYes
scalarShiftYes
scalarScaleYes
forceClampingYes
+

Returns

+ + + + + + + + + + +
TypeDescription
publicAPI.convert or publicAPI.clamp
+

getDataTypeMinMax

The min and max of each data type
Defaults to a range of 0 to 255

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
dataTypeYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

getIndexMatrix

The transform matrix supplied by the user converts output coordinates
to input coordinates.
To speed up the pixel lookup, the following function provides a
matrix which converts output pixel indices to input pixel indices.
This will also concatenate the ResliceAxes and the ResliceTransform
if possible (if the ResliceTransform is a 4x4 matrix transform).
If it does, this->OptimizedTransform will be set to nullptr, otherwise
this->OptimizedTransform will be equal to this->ResliceTransform.

+ + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
inputvtkImageDataYes
outputvtkImageDataYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

getInterpolationMode

Returns

+ + + + + + + + + + +
TypeDescription
+

getMirror

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputDimensionality

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputDirection

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputExtent

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputOrigin

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputScalarType

Returns

+ + + + + + + + + + +
TypeDescription
+

getOutputSpacing

Returns

+ + + + + + + + + + +
TypeDescription
+

getResliceAxes

Returns

+ + + + + + + + + + +
TypeDescription
+

getResliceTransform

Returns

+ + + + + + + + + + +
TypeDescription
+

getScalarScale

Returns

+ + + + + + + + + + +
TypeDescription
+

getScalarShift

Returns

+ + + + + + + + + + +
TypeDescription
+

getSetPixelsFunc

Returns the right function used to copy the pixels

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
dataTypeYes
dataSizeYes
numscalarsYes
dataPtrYes
+

Returns

+ + + + + + + + + + +
TypeDescription
publicAPI.set or publicAPI.set1
+

getSlabMode

Returns

+ + + + + + + + + + +
TypeDescription
+

getSlabNumberOfSlices

Returns

+ + + + + + + + + + +
TypeDescription
+

getSlabSliceSpacingFraction

Returns

+ + + + + + + + + + +
TypeDescription
+

getSlabTrapezoidIntegration

Returns

+ + + + + + + + + + +
TypeDescription
+

getTransformInputSampling

Returns

+ + + + + + + + + + +
TypeDescription
+

getWrap

Returns

+ + + + + + + + + + +
TypeDescription
+

isIdentityMatrix

+ + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
matrixYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

isPermutationMatrix

A permutation matrix is the identity matrix with the colomn (or rows) shuffled

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
matrixYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

isPerspectiveMatrix

+ + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
matrixYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

newInstance

Method used to create a new instance of vtkImageReslice

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
initialValuesIImageResliceInitialValuesNofor pre-setting some of its content
+

requestData

+ + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
inDataYes
outDataYes
+

rescaleScalars

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
floatDataYes
componentsYes
nYes
scalarShiftYes
scalarScaleYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

set

Copy the numscalars * n first elements from an array to another

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outPtrYes
inPtrYes
numscalarsYes
nYes
+

Returns

+ + + + + + + + + + +
TypeDescription
The number of copied elements
+

set1

Fill the n first elements of the output array with the very first element of the input array

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outPtrYes
inPtrYes
numscalarsYes
nYes
+

Returns

+ + + + + + + + + + +
TypeDescription
The number of elements set in the output array
+

setAutoCropOutput

Turn this on if you want to guarantee that the extent of the output will
be large enough to ensure that none of the data will be cropped.
Defaults to false.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
autoCropOutputYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setBackgroundColor

Set the background color (for multi-component images).
Defaults to full opaque black.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
backgroundColorYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setBorder

Extend the apparent input border by a half voxel.
This changes how interpolation is handled at the borders of the
input image: if the center of an output voxel is beyond the edge
of the input image, but is within a half voxel width of the edge
(using the input voxel width), then the value of the output voxel
is calculated as if the input’s edge voxels were duplicated past
the edges of the input.
This has no effect if Mirror or Wrap are on.
Defaults to true.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
borderYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setInterpolationMode

Set interpolation mode.
Only nearest neighbor is supported at the moment.
Defaults to nearest neighbor.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
interpolationModeYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setMirror

Turn on mirror-pad feature. This will override the wrap-pad.
Defaults to false.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
mirrorYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputDimensionality

Force the dimensionality of the output to either 1, 2, 3 or 0.
If the dimensionality is 2D, then the Z extent of the output is forced to
(0,0) and the Z origin of the output is forced to 0.0 (i.e. the output
extent is confined to the xy plane). If the dimensionality is 1D, the
output extent is confined to the x axis. For 0D, the output extent
consists of a single voxel at (0,0,0).
Defaults to 3.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputDimensionalityYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputDirection

Set the direction for the output data.
By default, the direction of the input data is passed to the output.
But if SetOutputDirection() is used, then the image will be resliced
according to the new output direction. Unlike SetResliceAxes(), this does
not change the physical coordinate system for the image. Instead, it
changes the orientation of the sampling grid while maintaining the same
physical coordinate system.
Defaults to null (automatically computed).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputDirectionYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputExtent

Set the extent for the output data.
The default output extent is the input extent permuted through the
ResliceAxes.
Defaults to null (automatically computed).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputExtentYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputOrigin

Set the origin for the output data.
The default output origin is the input origin permuted through the
ResliceAxes.
Defaults to null (automatically computed).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputOriginYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputScalarType

Set the scalar type of the output to be different from the input.
The default value is null, which means that the input scalar type will be
used to set the output scalar type. Otherwise, this must be set to one
of the following types: VtkDataTypes.CHAR, VtkDataTypes.SIGNED_CHAR,
VtkDataTypes.UNSIGNED_CHAR, VtkDataTypes.SHORT, VtkDataTypes.UNSIGNED_SHORT,
VtkDataTypes.INT, VtkDataTypes.UNSIGNED_INT, VtkDataTypes.FLOAT or
VtkDataTypes.DOUBLE. Other types are not permitted. If the output type
is an integer type, the output will be rounded and clamped to the limits of
the type.

+

See the documentation for vtkDataArray::getDataType() for additional data type settings.
Defaults to null (automatically computed).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputScalarTypeYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setOutputSpacing

Set the voxel spacing for the output data.
The default output spacing is the input spacing permuted through the
ResliceAxes.
Defaults to null (automatically computed).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
outputSpacingYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setResliceAxes

This method is used to set up the axes for the output voxels.
The output Spacing, Origin, and Extent specify the locations
of the voxels within the coordinate system defined by the axes.
The ResliceAxes are used most often to permute the data, e.g.
to extract ZY or XZ slices of a volume as 2D XY images.
The first column of the matrix specifies the x-axis
vector (the fourth element must be set to zero), the second
column specifies the y-axis, and the third column the
z-axis. The fourth column is the origin of the
axes (the fourth element must be set to one).

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
resliceAxesYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setResliceTransform

Set a transform to be applied to the resampling grid that has been
defined via the ResliceAxes and the output Origin, Spacing and Extent.
Note that applying a transform to the resampling grid (which lies in
the output coordinate system) is equivalent to applying the inverse of
that transform to the input volume. Nonlinear transforms such as
vtkGridTransform and vtkThinPlateSplineTransform can be used here.
Defaults to undefined.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
resliceTransformYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setScalarScale

Set multiplication factor to apply to all the output voxels.
After a sample value has been interpolated from the input image, the
equation u = (v + ScalarShift)*ScalarScale will be applied to it before
it is written to the output image. The result will always be clamped to
the limits of the output data type.
Defaults to 1.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
scalarScaleYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setScalarShift

Set a value to add to all the output voxels.
After a sample value has been interpolated from the input image, the
equation u = (v + ScalarShift)*ScalarScale will be applied to it before
it is written to the output image. The result will always be clamped to
the limits of the output data type.
Defaults to 0.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
scalarShiftYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setSlabMode

Set the slab mode, for generating thick slices.
The default is SlabMode.MIN. If SetSlabNumberOfSlices(N) is called with N
greater than one, then each output slice will actually be a composite of N
slices. This method specifies the compositing mode to be used.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
slabModeYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setSlabNumberOfSlices

Set the number of slices that will be combined to create the slab.
Defaults to 1.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
numberOfSlicesYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setSlabSliceSpacingFraction

The slab spacing as a fraction of the output slice spacing.
When one of the various slab modes is chosen, each output slice is
produced by generating several “temporary” output slices and then
combining them according to the slab mode. By default, the spacing between
these temporary slices is the Z component of the OutputSpacing. This
method sets the spacing between these temporary slices to be a fraction of
the output spacing.
Defaults to 1.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
slabSliceSpacingFractionYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setSlabTrapezoidIntegration

Use trapezoid integration for slab computation.
All this does is weigh the first and last slices by half when doing sum
and mean. It is off by default.
Defaults to false.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
slabTrapezoidIntegrationYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setTransformInputSampling

Specify whether to transform the spacing, origin and extent of the Input
(or the InformationInput) according to the direction cosines and origin of
the ResliceAxes before applying them as the default output spacing, origin
and extent.
Defaults to false.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
transformInputSamplingYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

setWrap

Turn on wrap-pad feature.
Defaults to false.

+ + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
wrapYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

vtkImageResliceExecute

Main filter logic

+ + + + + + + + + + + + + + + + + + + + + +
ArgumentTypeRequiredDescription
inputYes
outputYes
+

Returns

+ + + + + + + + + + +
TypeDescription
+

Source

Constants.d.ts
export declare enum SlabMode {
MIN = 0,
MAX = 1,
MEAN = 2,
SUM = 3,
}

declare const _default: {
SlabMode: typeof SlabMode;
};

export default _default;
+
Constants.js
export const SlabMode = {
MIN: 0,
MAX: 1,
MEAN: 2,
SUM: 3,
};

export default {
SlabMode,
};
+
index.d.ts
import { Bounds, Extent, Nullable, RGBAColor, TypedArray } from "../../../types";
import { InterpolationMode } from "../AbstractImageInterpolator/Constants";
import { SlabMode } from "./Constants";
import { vtkAlgorithm, vtkObject, vtkRange } from "../../../interfaces";
import vtkImageData from "../../../Common/DataModel/ImageData";
import vtkTransform from "../../../Common/Transform/Transform";

import { mat3, mat4, vec3, vec4 } from 'gl-matrix';

/**
*
*/
export interface IImageResliceInitialValues {
transformInputSampling: boolean,
autoCropOutput: boolean,
outputDimensionality: number,
outputSpacing: Nullable<vec3>, // automatically computed if null
outputOrigin: Nullable<vec3>, // automatically computed if null
outputDirection: Nullable<mat3>, // identity if null
outputExtent: Nullable<Extent>, // automatically computed if null
outputScalarType: Nullable<string>,
wrap: boolean, // don't wrap
mirror: boolean, // don't mirror
border: boolean, // apply a border
interpolationMode: InterpolationMode, // only NEAREST supported so far
slabMode: SlabMode,
slabTrapezoidIntegration: boolean,
slabNumberOfSlices: number,
slabSliceSpacingFraction: number,
optimization: boolean, // not supported yet
scalarShift: number, // for rescaling the data
scalarScale: number,
backgroundColor: RGBAColor,
resliceAxes: Nullable<mat4>,
resliceTransform?: vtkTransform,
interpolator: any, // A vtkImageInterpolator (missing typescript header)
usePermuteExecute: boolean, // no supported yet
}

type vtkImageResliceBase = Omit<vtkObject, 'set'> & vtkAlgorithm;

export interface vtkImageReslice extends vtkImageResliceBase {
/**
*
* @param inData
* @param outData
*/
requestData(inData: any, outData: any): void;

/**
* Main filter logic
* @param input
* @param output
* @returns
*/
vtkImageResliceExecute: (input: vtkImageData, output: vtkImageData) => void;

/**
* The transform matrix supplied by the user converts output coordinates
* to input coordinates.
* To speed up the pixel lookup, the following function provides a
* matrix which converts output pixel indices to input pixel indices.
* This will also concatenate the ResliceAxes and the ResliceTransform
* if possible (if the ResliceTransform is a 4x4 matrix transform).
* If it does, this->OptimizedTransform will be set to nullptr, otherwise
* this->OptimizedTransform will be equal to this->ResliceTransform.
* @param {vtkImageData} input
* @param {vtkImageData} output
* @returns
*/
getIndexMatrix: (input: vtkImageData, output: vtkImageData) => mat4;

/**
* Compute the bounds required to ensure that none of the data will be cropped
* @param input
* @returns
*/
getAutoCroppedOutputBounds: (input: vtkImageData) => Bounds;

/**
* The min and max of each data type
* Defaults to a range of 0 to 255
* @param dataType
* @returns
*/
getDataTypeMinMax: (dataType: string) => vtkRange;

/**
* Internal function uses vtkInterpolationMathClamp on `numscalars * n` elements
* @param outPtr
* @param inPtr
* @param numscalars
* @param n
* @param min
* @param max
* @returns The number of elements processed
*/
clamp: (outPtr: TypedArray, inPtr: TypedArray, numscalars: number, n: number, min: number, max: number) => number;

/**
* Internal function uses Math.round on `numscalars * n` elements
* @param outPtr
* @param inPtr
* @param numscalars
* @param n
* @returns The number of elements processed
*/
convert: (outPtr: TypedArray, inPtr: TypedArray, numscalars: number, n: number) => number;

/**
* Setup the conversion function and return the right one
* @param inputType
* @param dataType
* @param scalarShift
* @param scalarScale
* @param forceClamping
* @returns publicAPI.convert or publicAPI.clamp
*/
getConversionFunc: (inputType: string, dataType: string, scalarShift: number, scalarScale: number, forceClamping: boolean) => (this["convert"] & this["clamp"]);

/**
* Copy the `numscalars * n` first elements from an array to another
* @param outPtr
* @param inPtr
* @param numscalars
* @param n
* @returns The number of copied elements
*/
set: (outPtr: TypedArray, inPtr: TypedArray, numscalars: number, n: number) => number;

/**
* Fill the `n` first elements of the output array with the very first element of the input array
* @param outPtr
* @param inPtr
* @param numscalars
* @param n
* @returns The number of elements set in the output array
*/
set1: (outPtr: TypedArray, inPtr: TypedArray, numscalars: number, n: number) => number;

/**
* Returns the right function used to copy the pixels
* @param dataType
* @param dataSize
* @param numscalars
* @param dataPtr
* @returns publicAPI.set or publicAPI.set1
*/
getSetPixelsFunc: (dataType: any, dataSize: any, numscalars: number, dataPtr: any) => (this["set"] & this["set1"]);

/**
* Returns the right composition function
* @param slabMode
* @param slabTrapezoidIntegration
* @returns
*/
getCompositeFunc: (slabMode: SlabMode, slabTrapezoidIntegration: boolean) => ((tmpPtr: TypedArray, inComponents: number, sampleCount: number) => void);

/**
* Apply `newTrans`, then translate by `-origin`, then scale by `inInvSpacing`
* @param newTrans
* @param inPoint
* @param inOrigin
* @param inInvSpacing
* @returns
*/
applyTransform: (newTrans: mat4, inPoint: vec4, inOrigin: vec3, inInvSpacing: vec3) => void;

/**
*
* @param floatData
* @param components
* @param n
* @param scalarShift
* @param scalarScale
* @returns
*/
rescaleScalars: (floatData: TypedArray, components: number, n: number, scalarShift: number, scalarScale: number) => void;

/**
* A permutation matrix is the identity matrix with the colomn (or rows) shuffled
* @param matrix
* @returns
*/
isPermutationMatrix: (matrix: mat4) => boolean;

/**
*
* @param matrix
* @returns
*/
isIdentityMatrix: (matrix: mat4) => boolean;

/**
*
* @param matrix
* @returns
*/
isPerspectiveMatrix: (matrix: mat4) => boolean;

/**
*
* @param matrix
* @param outExt
* @returns
*/
canUseNearestNeighbor: (matrix: mat4, outExt: Extent) => boolean;

// Setters and getters

/**
* Set the slab mode, for generating thick slices.
* The default is SlabMode.MIN. If SetSlabNumberOfSlices(N) is called with N
* greater than one, then each output slice will actually be a composite of N
* slices. This method specifies the compositing mode to be used.
* @param slabMode
* @returns
*/
setSlabMode: (slabMode: SlabMode) => boolean;

/**
* @see setSlabMode
* @returns
*/
getSlabMode: () => SlabMode;

/**
* Set the number of slices that will be combined to create the slab.
* Defaults to 1.
* @param numberOfSlices
* @returns
*/
setSlabNumberOfSlices: (slabNumberOfSlices: number) => boolean;

/**
* @see setSlabNumberOfSlices
* @returns
*/
getSlabNumberOfSlices: () => number;

/**
* Specify whether to transform the spacing, origin and extent of the Input
* (or the InformationInput) according to the direction cosines and origin of
* the ResliceAxes before applying them as the default output spacing, origin
* and extent.
* Defaults to false.
* @param transformInputSampling
* @returns
*/
setTransformInputSampling: (transformInputSampling: boolean) => boolean;

/**
* @see setTransformInputSampling
* @returns
*/
getTransformInputSampling: () => boolean;

/**
* Turn this on if you want to guarantee that the extent of the output will
* be large enough to ensure that none of the data will be cropped.
* Defaults to false.
* @param autoCropOutput
* @returns
*/
setAutoCropOutput: (autoCropOutput: boolean) => boolean;

/**
* @see setAutoCropOutput
* @returns
*/
getAutoCropOutput: () => boolean;

/**
* Force the dimensionality of the output to either 1, 2, 3 or 0.
* If the dimensionality is 2D, then the Z extent of the output is forced to
* (0,0) and the Z origin of the output is forced to 0.0 (i.e. the output
* extent is confined to the xy plane). If the dimensionality is 1D, the
* output extent is confined to the x axis. For 0D, the output extent
* consists of a single voxel at (0,0,0).
* Defaults to 3.
* @param outputDimensionality
* @returns
*/
setOutputDimensionality: (outputDimensionality: number) => boolean;

/**
* @see setOutputDimensionality
* @returns
*/
getOutputDimensionality: () => number;

/**
* Set the voxel spacing for the output data.
* The default output spacing is the input spacing permuted through the
* ResliceAxes.
* Defaults to null (automatically computed).
* @param outputSpacing
* @returns
*/
setOutputSpacing: (outputSpacing: vec3 | null) => boolean;

/**
* @see setOutputSpacing
* @returns
*/
getOutputSpacing: () => vec3 | null;

/**
* Set the origin for the output data.
* The default output origin is the input origin permuted through the
* ResliceAxes.
* Defaults to null (automatically computed).
* @param outputOrigin
* @returns
*/
setOutputOrigin: (outputOrigin: vec3 | null) => boolean;

/**
* @see setOutputOrigin
* @returns
*/
getOutputOrigin: () => vec3 | null;

/**
* Set the extent for the output data.
* The default output extent is the input extent permuted through the
* ResliceAxes.
* Defaults to null (automatically computed).
* @param outputExtent
* @returns
*/
setOutputExtent: (outputExtent: Extent | null) => boolean;

/**
* @see setOutputExtent
* @returns
*/
getOutputExtent: () => Extent | null;

/**
* Set the direction for the output data.
* By default, the direction of the input data is passed to the output.
* But if SetOutputDirection() is used, then the image will be resliced
* according to the new output direction. Unlike SetResliceAxes(), this does
* not change the physical coordinate system for the image. Instead, it
* changes the orientation of the sampling grid while maintaining the same
* physical coordinate system.
* Defaults to null (automatically computed).
* @param outputDirection
* @returns
*/
setOutputDirection: (outputDirection: mat3 | null) => boolean;

/**
* @see setOutputDirection
* @returns
*/
getOutputDirection: () => mat3 | null;

/**
* Set the background color (for multi-component images).
* Defaults to full opaque black.
* @param backgroundColor
* @returns
*/
setBackgroundColor: (backgroundColor: RGBAColor) => boolean;

/**
* @see setBackgroundColor
* @returns
*/
getBackgroundColor: () => RGBAColor;

/**
* This method is used to set up the axes for the output voxels.
* The output Spacing, Origin, and Extent specify the locations
* of the voxels within the coordinate system defined by the axes.
* The ResliceAxes are used most often to permute the data, e.g.
* to extract ZY or XZ slices of a volume as 2D XY images.
* The first column of the matrix specifies the x-axis
* vector (the fourth element must be set to zero), the second
* column specifies the y-axis, and the third column the
* z-axis. The fourth column is the origin of the
* axes (the fourth element must be set to one).
* @param resliceAxes
* @returns
*/
setResliceAxes: (resliceAxes: mat4) => boolean;

/**
* @see setResliceAxes
* @returns
*/
getResliceAxes: () => mat4;

/**
* Set the scalar type of the output to be different from the input.
* The default value is null, which means that the input scalar type will be
* used to set the output scalar type. Otherwise, this must be set to one
* of the following types: VtkDataTypes.CHAR, VtkDataTypes.SIGNED_CHAR,
* VtkDataTypes.UNSIGNED_CHAR, VtkDataTypes.SHORT, VtkDataTypes.UNSIGNED_SHORT,
* VtkDataTypes.INT, VtkDataTypes.UNSIGNED_INT, VtkDataTypes.FLOAT or
* VtkDataTypes.DOUBLE. Other types are not permitted. If the output type
* is an integer type, the output will be rounded and clamped to the limits of
* the type.
*
* See the documentation for [vtkDataArray::getDataType()](../api/Common_Core_DataArray.html#getDataType-String) for additional data type settings.
* Defaults to null (automatically computed).
* @param outputScalarType
* @returns
*/
setOutputScalarType: (outputScalarType: string | null) => boolean;

/**
* @see setOutputScalarType
* @returns
*/
getOutputScalarType: () => string | null;

/**
* Set a value to add to all the output voxels.
* After a sample value has been interpolated from the input image, the
* equation u = (v + ScalarShift)*ScalarScale will be applied to it before
* it is written to the output image. The result will always be clamped to
* the limits of the output data type.
* Defaults to 0.
* @param scalarShift
* @returns
*/
setScalarShift: (scalarShift: number) => boolean;

/**
* @see setScalarShift
* @returns
*/
getScalarShift: () => number;

/**
* Set multiplication factor to apply to all the output voxels.
* After a sample value has been interpolated from the input image, the
* equation u = (v + ScalarShift)*ScalarScale will be applied to it before
* it is written to the output image. The result will always be clamped to
* the limits of the output data type.
* Defaults to 1.
* @param scalarScale
* @returns
*/
setScalarScale: (scalarScale: number) => boolean;

/**
* @see setScalarScale
* @returns
*/
getScalarScale: () => number;

/**
* Turn on wrap-pad feature.
* Defaults to false.
* @param wrap
* @returns
*/
setWrap: (wrap: boolean) => boolean;

/**
* @see setWrap
* @returns
*/
getWrap: () => boolean;

/**
* Turn on mirror-pad feature. This will override the wrap-pad.
* Defaults to false.
* @param mirror
* @returns
*/
setMirror: (mirror: boolean) => boolean;

/**
* @see setMirror
* @returns
*/
getMirror: () => boolean;

/**
* Extend the apparent input border by a half voxel.
* This changes how interpolation is handled at the borders of the
* input image: if the center of an output voxel is beyond the edge
* of the input image, but is within a half voxel width of the edge
* (using the input voxel width), then the value of the output voxel
* is calculated as if the input's edge voxels were duplicated past
* the edges of the input.
* This has no effect if Mirror or Wrap are on.
* Defaults to true.
* @param border
* @returns
*/
setBorder: (border: boolean) => boolean;

/**
* @see setBorder
* @returns
*/
getBorder: () => boolean;

/**
* Set interpolation mode.
* Only nearest neighbor is supported at the moment.
* Defaults to nearest neighbor.
* @param interpolationMode
* @returns
*/
setInterpolationMode: (interpolationMode: InterpolationMode) => boolean;

/**
* @see setInterpolationMode
* @returns
*/
getInterpolationMode: () => InterpolationMode;

/**
* Set a transform to be applied to the resampling grid that has been
* defined via the ResliceAxes and the output Origin, Spacing and Extent.
* Note that applying a transform to the resampling grid (which lies in
* the output coordinate system) is equivalent to applying the inverse of
* that transform to the input volume. Nonlinear transforms such as
* vtkGridTransform and vtkThinPlateSplineTransform can be used here.
* Defaults to undefined.
* @param resliceTransform
* @returns
*/
setResliceTransform: (resliceTransform: vtkTransform | undefined) => boolean;

/**
* @see setResliceTransform
* @returns
*/
getResliceTransform: () => vtkTransform | undefined;

/**
* Use trapezoid integration for slab computation.
* All this does is weigh the first and last slices by half when doing sum
* and mean. It is off by default.
* Defaults to false.
* @param slabTrapezoidIntegration
* @returns
*/
setSlabTrapezoidIntegration: (slabTrapezoidIntegration: boolean) => boolean;

/**
* @see setSlabTrapezoidIntegration
* @returns
*/
getSlabTrapezoidIntegration: () => boolean;

/**
* The slab spacing as a fraction of the output slice spacing.
* When one of the various slab modes is chosen, each output slice is
* produced by generating several "temporary" output slices and then
* combining them according to the slab mode. By default, the spacing between
* these temporary slices is the Z component of the OutputSpacing. This
* method sets the spacing between these temporary slices to be a fraction of
* the output spacing.
* Defaults to 1.
* @param slabSliceSpacingFraction
* @returns
*/
setSlabSliceSpacingFraction: (slabSliceSpacingFraction: number) => boolean;

/**
* @see setSlabSliceSpacingFraction
* @returns
*/
getSlabSliceSpacingFraction: () => number;
}

/**
* Method used to decorate a given object (publicAPI+model) with vtkImageReslice characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {IImageResliceInitialValues} [initialValues] (default: {})
*/
export function extend(publicAPI: object, model: object, initialValues?: IImageResliceInitialValues): void;

/**
* Method used to create a new instance of vtkImageReslice
* @param {IImageResliceInitialValues} [initialValues] for pre-setting some of its content
*/
export function newInstance(initialValues?: IImageResliceInitialValues): vtkImageReslice;


/**
* vtkImageReslice - Reslices a volume along a new set of axes
*
* vtkImageReslice is the swiss-army-knife of image geometry filters:
* It can permute, rotate, flip, scale, resample, deform, and pad image
* data in any combination with reasonably high efficiency. Simple
* operations such as permutation, resampling and padding are done
* with similar efficiently to the specialized vtkImagePermute,
* vtkImageResample, and vtkImagePad filters. There are a number of
* tasks that vtkImageReslice is well suited for:
* 1) Application of simple rotations, scales, and translations to
* an image. It is often a good idea to use vtkImageChangeInformation
* to center the image first, so that scales and rotations occur around
* the center rather than around the lower-left corner of the image.
* 2) Extraction of slices from an image volume. The method
* SetOutputDimensionality(2) is used to specify that want to output a
* slice rather than a volume. You can use both the resliceAxes and the
* resliceTransform at the same time, in order to extract slices from a
* volume that you have applied a transformation to.
* */
export declare const vtkImageReslice: {
newInstance: typeof newInstance;
extend: typeof extend;
}
export default vtkImageReslice;
+
index.js
import { vec4, mat4 } from 'gl-matrix';

import macro, { vtkWarningMacro } from 'vtk.js/Sources/macros';
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray';
import vtkMath from 'vtk.js/Sources/Common/Core/Math';
import vtkMatrixBuilder from 'vtk.js/Sources/Common/Core/MatrixBuilder';
import { VtkDataTypes } from 'vtk.js/Sources/Common/Core/DataArray/Constants';
import vtkBoundingBox from 'vtk.js/Sources/Common/DataModel/BoundingBox';
import vtkImageData from 'vtk.js/Sources/Common/DataModel/ImageData';
import vtkImageInterpolator from 'vtk.js/Sources/Imaging/Core/ImageInterpolator';
import vtkImagePointDataIterator from 'vtk.js/Sources/Imaging/Core/ImagePointDataIterator';
import {
ImageBorderMode,
InterpolationMode,
} from 'vtk.js/Sources/Imaging/Core/AbstractImageInterpolator/Constants';
import {
vtkInterpolationMathFloor,
vtkInterpolationMathRound,
vtkInterpolationMathClamp,
} from 'vtk.js/Sources/Imaging/Core/AbstractImageInterpolator/InterpolationInfo';
import Constants from 'vtk.js/Sources/Imaging/Core/ImageReslice/Constants';

const { SlabMode } = Constants;

const { vtkErrorMacro } = macro;

// ----------------------------------------------------------------------------
// vtkImageReslice methods
// ----------------------------------------------------------------------------

function vtkImageReslice(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkImageReslice');
const superClass = { ...publicAPI };

const indexMatrix = mat4.identity(new Float64Array(16));
let optimizedTransform = null;

function getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f) {
const n = sampleCount - 1;
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i] * 0.5;
for (let j = 1; j < n; j += 1) {
result += tmpPtr[i + j * inComponents];
}
result += tmpPtr[i + n * inComponents] * 0.5;
tmpPtr[i] = result * f;
}
}

function getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result += tmpPtr[i + j * inComponents];
}
tmpPtr[i] = result * f;
}
}

function getImageResliceCompositeMinValue(tmpPtr, inComponents, sampleCount) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result = Math.min(result, tmpPtr[i + j * inComponents]);
}
tmpPtr[i] = result;
}
}

function getImageResliceCompositeMaxValue(tmpPtr, inComponents, sampleCount) {
for (let i = 0; i < inComponents; i += 1) {
let result = tmpPtr[i];
for (let j = 1; j < sampleCount; j += 1) {
result = Math.max(result, tmpPtr[i + j * inComponents]);
}
tmpPtr[i] = result;
}
}

function getImageResliceCompositeMeanValue(
tmpPtr,
inComponents,
sampleCount
) {
const f = 1.0 / sampleCount;
getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeMeanTrap(tmpPtr, inComponents, sampleCount) {
const f = 1.0 / (sampleCount - 1);
getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeSumValue(tmpPtr, inComponents, sampleCount) {
const f = 1.0;
getImageResliceSlabSum(tmpPtr, inComponents, sampleCount, f);
}

function getImageResliceCompositeSumTrap(tmpPtr, inComponents, sampleCount) {
const f = 1.0;
getImageResliceSlabTrap(tmpPtr, inComponents, sampleCount, f);
}

publicAPI.getMTime = () => {
let mTime = superClass.getMTime();
if (model.resliceTransform) {
mTime = Math.max(mTime, model.resliceTransform.getMTime());
}
return mTime;
};

publicAPI.setResliceAxes = (resliceAxes) => {
if (!model.resliceAxes) {
model.resliceAxes = mat4.identity(new Float64Array(16));
}

if (!mat4.exactEquals(model.resliceAxes, resliceAxes)) {
mat4.copy(model.resliceAxes, resliceAxes);

publicAPI.modified();
return true;
}
return false;
};

publicAPI.requestData = (inData, outData) => {
// implement requestData
const input = inData[0];

if (!input) {
vtkErrorMacro('Invalid or missing input');
return;
}

// console.time('reslice');

// Retrieve output and volume data
const origin = input.getOrigin();
const inSpacing = input.getSpacing();
const dims = input.getDimensions();
const inScalars = input.getPointData().getScalars();
const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];

const outOrigin = [0, 0, 0];
const outSpacing = [1, 1, 1];
const outWholeExt = [0, 0, 0, 0, 0, 0];
const outDims = [0, 0, 0];

const matrix = mat4.identity(new Float64Array(16));
if (model.resliceAxes) {
mat4.multiply(matrix, matrix, model.resliceAxes);
}
const imatrix = new Float64Array(16);
mat4.invert(imatrix, matrix);

const inCenter = [
origin[0] + 0.5 * (inWholeExt[0] + inWholeExt[1]) * inSpacing[0],
origin[1] + 0.5 * (inWholeExt[2] + inWholeExt[3]) * inSpacing[1],
origin[2] + 0.5 * (inWholeExt[4] + inWholeExt[5]) * inSpacing[2],
];

let maxBounds = null;
if (model.autoCropOutput) {
maxBounds = publicAPI.getAutoCroppedOutputBounds(input);
}

for (let i = 0; i < 3; i++) {
let s = 0; // default output spacing
let d = 0; // default linear dimension
let e = 0; // default extent start
let c = 0; // transformed center-of-volume

if (model.transformInputSampling) {
let r = 0.0;
for (let j = 0; j < 3; j++) {
c += imatrix[4 * j + i] * (inCenter[j] - matrix[4 * 3 + j]);
const tmp = matrix[4 * i + j] * matrix[4 * i + j];
s += tmp * Math.abs(inSpacing[j]);
d +=
tmp *
(inWholeExt[2 * j + 1] - inWholeExt[2 * j]) *
Math.abs(inSpacing[j]);
e += tmp * inWholeExt[2 * j];
r += tmp;
}
s /= r;
d /= r * Math.sqrt(r);
e /= r;
} else {
c = inCenter[i];
s = inSpacing[i];
d = (inWholeExt[2 * i + 1] - inWholeExt[2 * i]) * s;
e = inWholeExt[2 * i];
}

if (model.outputSpacing == null) {
outSpacing[i] = s;
} else {
outSpacing[i] = model.outputSpacing[i];
}

if (i >= model.outputDimensionality) {
outWholeExt[2 * i] = 0;
outWholeExt[2 * i + 1] = 0;
} else if (model.outputExtent == null) {
if (model.autoCropOutput) {
d = maxBounds[2 * i + 1] - maxBounds[2 * i];
}
outWholeExt[2 * i] = Math.round(e);
outWholeExt[2 * i + 1] = Math.round(
outWholeExt[2 * i] + Math.abs(d / outSpacing[i])
);
} else {
outWholeExt[2 * i] = model.outputExtent[2 * i];
outWholeExt[2 * i + 1] = model.outputExtent[2 * i + 1];
}

if (i >= model.outputDimensionality) {
outOrigin[i] = 0;
} else if (model.outputOrigin == null) {
if (model.autoCropOutput) {
// set origin so edge of extent is edge of bounds
outOrigin[i] = maxBounds[2 * i] - outWholeExt[2 * i] * outSpacing[i];
} else {
// center new bounds over center of input bounds
outOrigin[i] =
c -
0.5 * (outWholeExt[2 * i] + outWholeExt[2 * i + 1]) * outSpacing[i];
}
} else {
outOrigin[i] = model.outputOrigin[i];
}
outDims[i] = outWholeExt[2 * i + 1] - outWholeExt[2 * i] + 1;
}

let dataType = inScalars.getDataType();
if (model.outputScalarType) {
dataType = model.outputScalarType;
}

const numComponents = input
.getPointData()
.getScalars()
.getNumberOfComponents(); // or s.numberOfComponents;

const outScalarsData = macro.newTypedArray(
dataType,
outDims[0] * outDims[1] * outDims[2] * numComponents
);
const outScalars = vtkDataArray.newInstance({
name: 'Scalars',
values: outScalarsData,
numberOfComponents: numComponents,
});

// Update output
const output = vtkImageData.newInstance();
output.setDimensions(outDims);
output.setOrigin(outOrigin);
output.setSpacing(outSpacing);
if (model.outputDirection) {
output.setDirection(model.outputDirection);
}
output.getPointData().setScalars(outScalars);

publicAPI.getIndexMatrix(input, output);

let interpolationMode = model.interpolationMode;
model.usePermuteExecute = false;
if (model.optimization) {
if (
optimizedTransform == null &&
model.slabSliceSpacingFraction === 1.0 &&
model.interpolator.isSeparable() &&
publicAPI.isPermutationMatrix(indexMatrix)
) {
model.usePermuteExecute = true;
if (publicAPI.canUseNearestNeighbor(indexMatrix, outWholeExt)) {
interpolationMode = InterpolationMode.NEAREST;
}
}
}
model.interpolator.setInterpolationMode(interpolationMode);

let borderMode = ImageBorderMode.CLAMP;
borderMode = model.wrap ? ImageBorderMode.REPEAT : borderMode;
borderMode = model.mirror ? ImageBorderMode.MIRROR : borderMode;
model.interpolator.setBorderMode(borderMode);

const mintol = 7.62939453125e-6;
const maxtol = 2.0 * 2147483647;
let tol = 0.5 * model.border;
tol = borderMode === ImageBorderMode.CLAMP ? tol : maxtol;
tol = tol > mintol ? tol : mintol;
model.interpolator.setTolerance(tol);

model.interpolator.initialize(input);

publicAPI.vtkImageResliceExecute(input, output);

model.interpolator.releaseData();

outData[0] = output;

// console.timeEnd('reslice');
};

publicAPI.vtkImageResliceExecute = (input, output) => {
// const outDims = output.getDimensions();
const inScalars = input.getPointData().getScalars();
const outScalars = output.getPointData().getScalars();
let outPtr = outScalars.getData();
const outExt = output.getExtent();
const newmat = indexMatrix;
const outputStencil = null;

// multiple samples for thick slabs
const nsamples = Math.max(model.slabNumberOfSlices, 1);

// spacing between slab samples (as a fraction of slice spacing).
const slabSampleSpacing = model.slabSliceSpacingFraction;

// check for perspective transformation
const perspective = publicAPI.isPerspectiveMatrix(newmat);

// extra scalar info for nearest-neighbor optimization
let inPtr = inScalars.getData();
const inputScalarSize = 1; // inScalars.getElementComponentSize(); // inScalars.getDataTypeSize();
const inputScalarType = inScalars.getDataType();
const inComponents = inScalars.getNumberOfComponents(); // interpolator.GetNumberOfComponents();
const componentOffset = model.interpolator.getComponentOffset();
const borderMode = model.interpolator.getBorderMode();
const inDims = input.getDimensions();
const inExt = [0, inDims[0] - 1, 0, inDims[1] - 1, 0, inDims[2] - 1]; // interpolator->GetExtent();
const inInc = [0, 0, 0];
inInc[0] = inScalars.getNumberOfComponents();
inInc[1] = inInc[0] * inDims[0];
inInc[2] = inInc[1] * inDims[1];

const fullSize = inDims[0] * inDims[1] * inDims[2];
if (componentOffset > 0 && componentOffset + inComponents < inInc[0]) {
inPtr = inPtr.subarray(inputScalarSize * componentOffset);
}

let interpolationMode = InterpolationMode.NEAREST;
if (model.interpolator.isA('vtkImageInterpolator')) {
interpolationMode = model.interpolator.getInterpolationMode();
}

const convertScalars = null;
const rescaleScalars =
model.scalarShift !== 0.0 || model.scalarScale !== 1.0;

// is nearest neighbor optimization possible?
const optimizeNearest =
interpolationMode === InterpolationMode.NEAREST &&
borderMode === ImageBorderMode.CLAMP &&
!(
optimizedTransform != null ||
perspective ||
convertScalars != null ||
rescaleScalars
) &&
inputScalarType === outScalars.getDataType() &&
fullSize === inScalars.getNumberOfTuples() &&
model.border === true &&
nsamples <= 1;

// get pixel information
const scalarType = outScalars.getDataType();
const scalarSize = 1; // outScalars.getElementComponentSize() // outScalars.scalarSize;
const outComponents = outScalars.getNumberOfComponents();

// break matrix into a set of axes plus an origin
// (this allows us to calculate the transform Incrementally)
const xAxis = [0, 0, 0, 0];
const yAxis = [0, 0, 0, 0];
const zAxis = [0, 0, 0, 0];
const origin = [0, 0, 0, 0];
for (let i = 0; i < 4; ++i) {
xAxis[i] = newmat[4 * 0 + i];
yAxis[i] = newmat[4 * 1 + i];
zAxis[i] = newmat[4 * 2 + i];
origin[i] = newmat[4 * 3 + i];
}

// allocate an output row of type double
let floatPtr = null;
if (!optimizeNearest) {
floatPtr = new Float64Array(
inComponents * (outExt[1] - outExt[0] + nsamples)
);
}

const background = macro.newTypedArray(
inputScalarType,
model.backgroundColor
);

// set color for area outside of input volume extent
// void *background;
// vtkAllocBackgroundPixel(&background,
// self->GetBackgroundColor(), scalarType, scalarSize, outComponents);

// get various helper functions
const forceClamping =
interpolationMode > InterpolationMode.LINEAR ||
(nsamples > 1 && model.slabMode === SlabMode.SUM);
const convertpixels = publicAPI.getConversionFunc(
inputScalarType,
scalarType,
model.scalarShift,
model.scalarScale,
forceClamping
);
const setpixels = publicAPI.getSetPixelsFunc(
scalarType,
scalarSize,
outComponents,
outPtr
);
const composite = publicAPI.getCompositeFunc(
model.slabMode,
model.slabTrapezoidIntegration
);

// create some variables for when we march through the data
let idY = outExt[2] - 1;
let idZ = outExt[4] - 1;
const inPoint0 = [0.0, 0.0, 0.0, 0.0];
const inPoint1 = [0.0, 0.0, 0.0, 0.0];

// create an iterator to march through the data
const iter = vtkImagePointDataIterator.newInstance();
iter.initialize(output, outExt, model.stencil, null);
const outPtr0 = iter.getScalars(output, 0);
let outPtrIndex = 0;
const outTmp = macro.newTypedArray(
scalarType,
vtkBoundingBox.getDiagonalLength(outExt) * outComponents * 2
);

const interpolatedPtr = new Float64Array(inComponents * nsamples);
const interpolatedPoint = new Float64Array(inComponents);

for (; !iter.isAtEnd(); iter.nextSpan()) {
const span = iter.spanEndId() - iter.getId();
outPtrIndex = iter.getId() * scalarSize * outComponents;

if (!iter.isInStencil()) {
// clear any regions that are outside the stencil
const n = setpixels(outTmp, background, outComponents, span);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}
} else {
// get output index, and compute position in input image
const outIndex = iter.getIndex();

// if Z index increased, then advance position along Z axis
if (outIndex[2] > idZ) {
idZ = outIndex[2];
inPoint0[0] = origin[0] + idZ * zAxis[0];
inPoint0[1] = origin[1] + idZ * zAxis[1];
inPoint0[2] = origin[2] + idZ * zAxis[2];
inPoint0[3] = origin[3] + idZ * zAxis[3];
idY = outExt[2] - 1;
}

// if Y index increased, then advance position along Y axis
if (outIndex[1] > idY) {
idY = outIndex[1];
inPoint1[0] = inPoint0[0] + idY * yAxis[0];
inPoint1[1] = inPoint0[1] + idY * yAxis[1];
inPoint1[2] = inPoint0[2] + idY * yAxis[2];
inPoint1[3] = inPoint0[3] + idY * yAxis[3];
}

// march through one row of the output image
const idXmin = outIndex[0];
const idXmax = idXmin + span - 1;

if (!optimizeNearest) {
let wasInBounds = 1;
let isInBounds = 1;
let startIdX = idXmin;
let idX = idXmin;
const tmpPtr = floatPtr;
let pixelIndex = 0;

while (startIdX <= idXmax) {
for (; idX <= idXmax && isInBounds === wasInBounds; idX++) {
const inPoint2 = [
inPoint1[0] + idX * xAxis[0],
inPoint1[1] + idX * xAxis[1],
inPoint1[2] + idX * xAxis[2],
inPoint1[3] + idX * xAxis[3],
];

const inPoint3 = [0, 0, 0, 0];
let inPoint = inPoint2;
isInBounds = false;

let interpolatedPtrIndex = 0;
for (let sample = 0; sample < nsamples; ++sample) {
if (nsamples > 1) {
let s = sample - 0.5 * (nsamples - 1);
s *= slabSampleSpacing;
inPoint3[0] = inPoint2[0] + s * zAxis[0];
inPoint3[1] = inPoint2[1] + s * zAxis[1];
inPoint3[2] = inPoint2[2] + s * zAxis[2];
inPoint3[3] = inPoint2[3] + s * zAxis[3];
inPoint = inPoint3;
}

if (perspective) {
// only do perspective if necessary
const f = 1 / inPoint[3];
inPoint[0] *= f;
inPoint[1] *= f;
inPoint[2] *= f;
}

if (optimizedTransform !== null) {
// get the input origin and spacing for conversion purposes
const inOrigin = model.interpolator.getOrigin();
const inSpacing = model.interpolator.getSpacing();
const inInvSpacing = [
1.0 / inSpacing[0],
1.0 / inSpacing[1],
1.0 / inSpacing[2],
];

// apply the AbstractTransform if there is one
// TBD: handle inDirection
publicAPI.applyTransform(
optimizedTransform,
inPoint,
inOrigin,
inInvSpacing
);
}

if (model.interpolator.checkBoundsIJK(inPoint)) {
// do the interpolation
isInBounds = 1;
model.interpolator.interpolateIJK(inPoint, interpolatedPoint);
for (let i = 0; i < inComponents; ++i) {
interpolatedPtr[interpolatedPtrIndex++] =
interpolatedPoint[i];
}
}
}

if (interpolatedPtrIndex > inComponents) {
composite(
interpolatedPtr,
inComponents,
interpolatedPtrIndex / inComponents
);
}
for (let i = 0; i < inComponents; ++i) {
tmpPtr[pixelIndex++] = interpolatedPtr[i];
}

// set "was in" to "is in" if first pixel
wasInBounds = idX > idXmin ? wasInBounds : isInBounds;
}

// write a segment to the output
const endIdX = idX - 1 - (isInBounds !== wasInBounds);
const numpixels = endIdX - startIdX + 1;

let n = 0;
if (wasInBounds) {
if (outputStencil) {
outputStencil.insertNextExtent(startIdX, endIdX, idY, idZ);
}

if (rescaleScalars) {
publicAPI.rescaleScalars(
floatPtr,
inComponents,
idXmax - idXmin + 1,
model.scalarShift,
model.scalarScale
);
}

if (convertScalars) {
convertScalars(
floatPtr.subarray(startIdX * inComponents),
outTmp,
inputScalarType,
inComponents,
numpixels,
startIdX,
idY,
idZ
);
n = numpixels * outComponents * scalarSize;
} else {
n = convertpixels(
outTmp,
floatPtr.subarray(startIdX * inComponents),
outComponents,
numpixels
);
}
} else {
n = setpixels(outTmp, background, outComponents, numpixels);
}
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}

startIdX += numpixels;
wasInBounds = isInBounds;
}
} else {
// optimize for nearest-neighbor interpolation
const inPtrTmp0 = inPtr;
const outPtrTmp = outPtr;

const inIncX = inInc[0] * inputScalarSize;
const inIncY = inInc[1] * inputScalarSize;
const inIncZ = inInc[2] * inputScalarSize;

const inExtX = inExt[1] - inExt[0] + 1;
const inExtY = inExt[3] - inExt[2] + 1;
const inExtZ = inExt[5] - inExt[4] + 1;

let startIdX = idXmin;
let endIdX = idXmin - 1;
let isInBounds = false;
const bytesPerPixel = inputScalarSize * inComponents;

for (let iidX = idXmin; iidX <= idXmax; iidX++) {
const inPoint = [
inPoint1[0] + iidX * xAxis[0],
inPoint1[1] + iidX * xAxis[1],
inPoint1[2] + iidX * xAxis[2],
];

const inIdX = vtkInterpolationMathRound(inPoint[0]) - inExt[0];
const inIdY = vtkInterpolationMathRound(inPoint[1]) - inExt[2];
const inIdZ = vtkInterpolationMathRound(inPoint[2]) - inExt[4];

if (
inIdX >= 0 &&
inIdX < inExtX &&
inIdY >= 0 &&
inIdY < inExtY &&
inIdZ >= 0 &&
inIdZ < inExtZ
) {
if (!isInBounds) {
// clear leading out-of-bounds pixels
startIdX = iidX;
isInBounds = true;
const n = setpixels(
outTmp,
background,
outComponents,
startIdX - idXmin
);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}
}
// set the final index that was within input bounds
endIdX = iidX;

// perform nearest-neighbor interpolation via pixel copy
let offset = inIdX * inIncX + inIdY * inIncY + inIdZ * inIncZ;

// when memcpy is used with a constant size, the compiler will
// optimize away the function call and use the minimum number
// of instructions necessary to perform the copy
switch (bytesPerPixel) {
case 1:
outPtr0[outPtrIndex++] = inPtrTmp0[offset];
break;
case 2:
case 3:
case 4:
case 8:
case 12:
case 16:
for (let i = 0; i < bytesPerPixel; ++i) {
outPtr0[outPtrIndex++] = inPtrTmp0[offset + i];
}
break;
default: {
// TODO: check bytes
let oc = 0;
do {
outPtr0[outPtrIndex++] = inPtrTmp0[offset++];
} while (++oc !== bytesPerPixel);
break;
}
}
} else if (isInBounds) {
// leaving input bounds
break;
}
}

// clear trailing out-of-bounds pixels
outPtr = outPtrTmp;
const n = setpixels(
outTmp,
background,
outComponents,
idXmax - endIdX
);
for (let i = 0; i < n; ++i) {
outPtr0[outPtrIndex++] = outTmp[i];
}

if (outputStencil && endIdX >= startIdX) {
outputStencil.insertNextExtent(startIdX, endIdX, idY, idZ);
}
}
}
}
};
/**
* The transform matrix supplied by the user converts output coordinates
* to input coordinates.
* To speed up the pixel lookup, the following function provides a
* matrix which converts output pixel indices to input pixel indices.
* This will also concatenate the ResliceAxes and the ResliceTransform
* if possible (if the ResliceTransform is a 4x4 matrix transform).
* If it does, this->OptimizedTransform will be set to nullptr, otherwise
* this->OptimizedTransform will be equal to this->ResliceTransform.
* @param {vtkImageData} input
* @param {vtkImageData} output
* @returns
*/
publicAPI.getIndexMatrix = (input, output) => {
const transform = mat4.identity(new Float64Array(16));
optimizedTransform = null;

if (model.resliceAxes) {
mat4.copy(transform, model.resliceAxes);
}
if (model.resliceTransform) {
if (model.resliceTransform.isA('vtkHomogeneousTransform')) {
mat4.multiply(transform, model.resliceTransform.getMatrix(), transform);
} else {
// TODO
vtkWarningMacro('Non homogeneous transform have not yet been ported');
}
}

// the outMatrix takes OutputData indices to OutputData coordinates,
const outMatrix = output.getIndexToWorld();
mat4.multiply(transform, transform, outMatrix);

// the inMatrix takes InputData coordinates to InputData indices
// the optimizedTransform requires data coords, not index coords, as its input
if (optimizedTransform == null) {
const inMatrix = input.getWorldToIndex();
mat4.multiply(transform, inMatrix, transform);
}

mat4.copy(indexMatrix, transform);

return indexMatrix;
};

publicAPI.getAutoCroppedOutputBounds = (input) => {
const inOrigin = input.getOrigin();
const inSpacing = input.getSpacing();
const inDirection = input.getDirection();
const dims = input.getDimensions();
const inWholeExt = [0, dims[0] - 1, 0, dims[1] - 1, 0, dims[2] - 1];

const matrix = new Float64Array(16);
if (model.resliceAxes) {
mat4.invert(matrix, model.resliceAxes);
} else {
mat4.identity(matrix);
}
let transform = null;
if (model.resliceTransform) {
transform = model.resliceTransform.getInverse();
}
let imageTransform = null;
if (!vtkMath.isIdentity3x3(inDirection)) {
imageTransform = vtkMatrixBuilder
.buildFromRadian()
.translate(inOrigin[0], inOrigin[1], inOrigin[2])
.multiply3x3(inDirection)
.translate(-inOrigin[0], -inOrigin[1], -inOrigin[2])
.invert()
.getMatrix();
}

const bounds = [
Number.MAX_VALUE,
-Number.MAX_VALUE,
Number.MAX_VALUE,
-Number.MAX_VALUE,
Number.MAX_VALUE,
-Number.MAX_VALUE,
];

const point = [0, 0, 0, 0];
for (let i = 0; i < 8; ++i) {
point[0] = inOrigin[0] + inWholeExt[i % 2] * inSpacing[0];
point[1] =
inOrigin[1] + inWholeExt[2 + (Math.floor(i / 2) % 2)] * inSpacing[1];
point[2] =
inOrigin[2] + inWholeExt[4 + (Math.floor(i / 4) % 2)] * inSpacing[2];
point[3] = 1.0;

if (imageTransform) {
vec4.transformMat4(point, point, imageTransform);
}

if (model.resliceTransform) {
transform.transformPoint(point, point);
}

vec4.transformMat4(point, point, matrix);

const f = 1.0 / point[3];
point[0] *= f;
point[1] *= f;
point[2] *= f;

for (let j = 0; j < 3; ++j) {
if (point[j] > bounds[2 * j + 1]) {
bounds[2 * j + 1] = point[j];
}
if (point[j] < bounds[2 * j]) {
bounds[2 * j] = point[j];
}
}
}
return bounds;
};

publicAPI.getDataTypeMinMax = (dataType) => {
switch (dataType) {
case 'Int8Array':
return { min: -128, max: 127 };
case 'Int16Array':
return { min: -32768, max: 32767 };
case 'Uint16Array':
return { min: 0, max: 65535 };
case 'Int32Array':
return { min: -2147483648, max: 2147483647 };
case 'Uint32Array':
return { min: 0, max: 4294967295 };
case 'Float32Array':
return { min: -1.2e38, max: 1.2e38 };
case 'Float64Array':
return { min: -1.2e38, max: 1.2e38 };
case 'Uint8Array':
case 'Uint8ClampedArray':
default:
return { min: 0, max: 255 };
}
};

publicAPI.clamp = (outPtr, inPtr, numscalars, n, min, max) => {
const count = n * numscalars;
for (let i = 0; i < count; ++i) {
outPtr[i] = vtkInterpolationMathClamp(inPtr[i], min, max);
}
return count;
};

publicAPI.convert = (outPtr, inPtr, numscalars, n) => {
const count = n * numscalars;
for (let i = 0; i < count; ++i) {
outPtr[i] = Math.round(inPtr[i]);
}
return count;
};

publicAPI.getConversionFunc = (
inputType,
dataType,
scalarShift,
scalarScale,
forceClamping
) => {
let useClamping = forceClamping;
if (
dataType !== VtkDataTypes.FLOAT &&
dataType !== VtkDataTypes.DOUBLE &&
!forceClamping
) {
const inMinMax = publicAPI.getDataTypeMinMax(inputType);
let checkMin = (inMinMax.min + scalarShift) * scalarScale;
let checkMax = (inMinMax.max + scalarShift) * scalarScale;
const outMinMax = publicAPI.getDataTypeMinMax(dataType);
const outputMin = outMinMax.min;
const outputMax = outMinMax.max;
if (checkMin > checkMax) {
const tmp = checkMax;
checkMax = checkMin;
checkMin = tmp;
}
useClamping = checkMin < outputMin || checkMax > outputMax;
}

if (
useClamping &&
dataType !== VtkDataTypes.FLOAT &&
dataType !== VtkDataTypes.DOUBLE
) {
const minMax = publicAPI.getDataTypeMinMax(dataType);
const clamp = (outPtr, inPtr, numscalars, n) =>
publicAPI.clamp(outPtr, inPtr, numscalars, n, minMax.min, minMax.max);
return clamp;
}
return publicAPI.convert;
};

publicAPI.set = (outPtr, inPtr, numscalars, n) => {
const count = numscalars * n;
for (let i = 0; i < n; ++i) {
outPtr[i] = inPtr[i];
}
return count;
};

publicAPI.set1 = (outPtr, inPtr, numscalars, n) => {
outPtr.fill(inPtr[0], 0, n);
return n;
};

publicAPI.getSetPixelsFunc = (dataType, dataSize, numscalars, dataPtr) =>
numscalars === 1 ? publicAPI.set1 : publicAPI.set;

publicAPI.getCompositeFunc = (slabMode, slabTrapezoidIntegration) => {
let composite = null;
// eslint-disable-next-line default-case
switch (slabMode) {
case SlabMode.MIN:
composite = getImageResliceCompositeMinValue;
break;
case SlabMode.MAX:
composite = getImageResliceCompositeMaxValue;
break;
case SlabMode.MEAN:
if (slabTrapezoidIntegration) {
composite = getImageResliceCompositeMeanTrap;
} else {
composite = getImageResliceCompositeMeanValue;
}
break;
case SlabMode.SUM:
if (slabTrapezoidIntegration) {
composite = getImageResliceCompositeSumTrap;
} else {
composite = getImageResliceCompositeSumValue;
}
break;
}

return composite;
};

publicAPI.applyTransform = (newTrans, inPoint, inOrigin, inInvSpacing) => {
inPoint[3] = 1;
vec4.transformMat4(inPoint, inPoint, newTrans);
inPoint[0] -= inOrigin[0];
inPoint[1] -= inOrigin[1];
inPoint[2] -= inOrigin[2];
inPoint[0] *= inInvSpacing[0];
inPoint[1] *= inInvSpacing[1];
inPoint[2] *= inInvSpacing[2];
};

publicAPI.rescaleScalars = (
floatData,
components,
n,
scalarShift,
scalarScale
) => {
const m = n * components;
for (let i = 0; i < m; ++i) {
floatData[i] = (floatData[i] + scalarShift) * scalarScale;
}
};

publicAPI.isPermutationMatrix = (matrix) => {
for (let i = 0; i < 3; i++) {
if (matrix[4 * i + 3] !== 0) {
return false;
}
}
if (matrix[4 * 3 + 3] !== 1) {
return false;
}
for (let j = 0; j < 3; j++) {
let k = 0;
for (let i = 0; i < 3; i++) {
if (matrix[4 * j + i] !== 0) {
k++;
}
}
if (k !== 1) {
return false;
}
}
return true;
};

// TODO: to move in vtkMath and add tolerance
publicAPI.isIdentityMatrix = (matrix) => {
for (let i = 0; i < 4; ++i) {
for (let j = 0; j < 4; ++j) {
if ((i === j ? 1.0 : 0.0) !== matrix[4 * j + i]) {
return false;
}
}
}
return true;
};

publicAPI.isPerspectiveMatrix = (matrix) =>
matrix[4 * 0 + 3] !== 0 ||
matrix[4 * 1 + 3] !== 0 ||
matrix[4 * 2 + 3] !== 0 ||
matrix[4 * 3 + 3] !== 1;

publicAPI.canUseNearestNeighbor = (matrix, outExt) => {
// loop through dimensions
for (let i = 0; i < 3; i++) {
let j;
for (j = 0; j < 3; j++) {
if (matrix[4 * j + i] !== 0) {
break;
}
}
if (j >= 3) {
return false;
}
let x = matrix[4 * j + i];
let y = matrix[4 * 3 + i];
if (outExt[2 * j] === outExt[2 * j + 1]) {
y += x * outExt[2 * i];
x = 0;
}
const fx = vtkInterpolationMathFloor(x, 0).error;
const fy = vtkInterpolationMathFloor(y, 0).error;
if (fx !== 0 || fy !== 0) {
return false;
}
}
return true;
};
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
transformInputSampling: true,
autoCropOutput: false,
outputDimensionality: 3,
outputSpacing: null, // automatically computed if null
outputOrigin: null, // automatically computed if null
outputDirection: null, // identity if null
outputExtent: null, // automatically computed if null
outputScalarType: null,
wrap: false, // don't wrap
mirror: false, // don't mirror
border: true, // apply a border
interpolationMode: InterpolationMode.NEAREST, // only NEAREST supported so far
slabMode: SlabMode.MIN,
slabTrapezoidIntegration: false,
slabNumberOfSlices: 1,
slabSliceSpacingFraction: 1,
optimization: false, // not supported yet
scalarShift: 0, // for rescaling the data
scalarScale: 1,
backgroundColor: [0, 0, 0, 0],
resliceAxes: null,
// resliceTransform: null,
interpolator: vtkImageInterpolator.newInstance(),
usePermuteExecute: false, // no supported yet
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Make this a VTK object
macro.obj(publicAPI, model);

// Also make it an algorithm with one input and one output
macro.algo(publicAPI, model, 1, 1);

macro.setGet(publicAPI, model, [
'outputDimensionality',
'outputScalarType',
'scalarShift',
'scalarScale',
'transformInputSampling',
'autoCropOutput',
'wrap',
'mirror',
'border',
'interpolationMode',
'resliceTransform',
'slabMode',
'slabTrapezoidIntegration',
'slabNumberOfSlices',
'slabSliceSpacingFraction',
]);

macro.setGetArray(publicAPI, model, ['outputOrigin', 'outputSpacing'], 3);
macro.setGetArray(publicAPI, model, ['outputExtent'], 6);
macro.setGetArray(publicAPI, model, ['outputDirection'], 9);
macro.setGetArray(publicAPI, model, ['backgroundColor'], 4);

macro.get(publicAPI, model, ['resliceAxes']);

// Object specific methods
vtkImageReslice(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkImageReslice');

// ----------------------------------------------------------------------------

export default { newInstance, extend, ...Constants };
@@ -151,7 +1746,7 @@

Contents -
  1. Introduction
  2. Usage
  3. Public API
    1. ResliceAxes (set/get)
    2. OutputDimensionality (set/get)
    3. OutputOrigin (set/get)
    4. OutputSpacing (set/get)
    5. OutputExtent (set/get)
    6. OutputScalarType (set/get)
    7. ScalarShift (set/get)
    8. ScalarScale (set/get)
    9. Wrap (set/get)
    10. Mirror (set/get)
    11. Border (set/get)
    12. BackgroundColor (set/get)
    13. TransformInputSampling (set/get)
    14. AutoCropOutput (set/get)
  • Source +
    1. Introduction
    2. Methods
      1. applyTransform
        1. Returns
      2. canUseNearestNeighbor
        1. Returns
      3. clamp
        1. Returns
      4. convert
        1. Returns
      5. extend
      6. getAutoCropOutput
        1. Returns
      7. getAutoCroppedOutputBounds
        1. Returns
      8. getBackgroundColor
        1. Returns
      9. getBorder
        1. Returns
      10. getCompositeFunc
        1. Returns
      11. getConversionFunc
        1. Returns
      12. getDataTypeMinMax
        1. Returns
      13. getIndexMatrix
        1. Returns
      14. getInterpolationMode
        1. Returns
      15. getMirror
        1. Returns
      16. getOutputDimensionality
        1. Returns
      17. getOutputDirection
        1. Returns
      18. getOutputExtent
        1. Returns
      19. getOutputOrigin
        1. Returns
      20. getOutputScalarType
        1. Returns
      21. getOutputSpacing
        1. Returns
      22. getResliceAxes
        1. Returns
      23. getResliceTransform
        1. Returns
      24. getScalarScale
        1. Returns
      25. getScalarShift
        1. Returns
      26. getSetPixelsFunc
        1. Returns
      27. getSlabMode
        1. Returns
      28. getSlabNumberOfSlices
        1. Returns
      29. getSlabSliceSpacingFraction
        1. Returns
      30. getSlabTrapezoidIntegration
        1. Returns
      31. getTransformInputSampling
        1. Returns
      32. getWrap
        1. Returns
      33. isIdentityMatrix
        1. Returns
      34. isPermutationMatrix
        1. Returns
      35. isPerspectiveMatrix
        1. Returns
      36. newInstance
      37. requestData
      38. rescaleScalars
        1. Returns
      39. set
        1. Returns
      40. set1
        1. Returns
      41. setAutoCropOutput
        1. Returns
      42. setBackgroundColor
        1. Returns
      43. setBorder
        1. Returns
      44. setInterpolationMode
        1. Returns
      45. setMirror
        1. Returns
      46. setOutputDimensionality
        1. Returns
      47. setOutputDirection
        1. Returns
      48. setOutputExtent
        1. Returns
      49. setOutputOrigin
        1. Returns
      50. setOutputScalarType
        1. Returns
      51. setOutputSpacing
        1. Returns
      52. setResliceAxes
        1. Returns
      53. setResliceTransform
        1. Returns
      54. setScalarScale
        1. Returns
      55. setScalarShift
        1. Returns
      56. setSlabMode
        1. Returns
      57. setSlabNumberOfSlices
        1. Returns
      58. setSlabSliceSpacingFraction
        1. Returns
      59. setSlabTrapezoidIntegration
        1. Returns
      60. setTransformInputSampling
        1. Returns
      61. setWrap
        1. Returns
      62. vtkImageResliceExecute
        1. Returns
  • Source Back to Top
  • diff --git a/api/Imaging_Hybrid_SampleFunction.html b/api/Imaging_Hybrid_SampleFunction.html index 507fa73e454..71555cf3c0f 100644 --- a/api/Imaging_Hybrid_SampleFunction.html +++ b/api/Imaging_Hybrid_SampleFunction.html @@ -48,8 +48,8 @@ - - + + @@ -121,7 +121,7 @@

    diff --git a/api/Interaction_Animations_TimeStepBasedAnimationHandler.html b/api/Interaction_Animations_TimeStepBasedAnimationHandler.html index b10905e7f50..f06223beca6 100644 --- a/api/Interaction_Animations_TimeStepBasedAnimationHandler.html +++ b/api/Interaction_Animations_TimeStepBasedAnimationHandler.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_CompositeCameraManipulator.html b/api/Interaction_Manipulators_CompositeCameraManipulator.html index fded1ef71d7..6b11634ad43 100644 --- a/api/Interaction_Manipulators_CompositeCameraManipulator.html +++ b/api/Interaction_Manipulators_CompositeCameraManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -195,7 +195,7 @@

    diff --git a/api/Interaction_Manipulators_CompositeGestureManipulator.html b/api/Interaction_Manipulators_CompositeGestureManipulator.html index aaca3eaa979..5411fe23248 100644 --- a/api/Interaction_Manipulators_CompositeGestureManipulator.html +++ b/api/Interaction_Manipulators_CompositeGestureManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -402,7 +402,7 @@

    diff --git a/api/Interaction_Manipulators_CompositeKeyboardManipulator.html b/api/Interaction_Manipulators_CompositeKeyboardManipulator.html index b41217de364..affa91b0bf1 100644 --- a/api/Interaction_Manipulators_CompositeKeyboardManipulator.html +++ b/api/Interaction_Manipulators_CompositeKeyboardManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -205,7 +205,7 @@

    diff --git a/api/Interaction_Manipulators_CompositeMouseManipulator.html b/api/Interaction_Manipulators_CompositeMouseManipulator.html index 593276ffb6f..8b6e0afb1d4 100644 --- a/api/Interaction_Manipulators_CompositeMouseManipulator.html +++ b/api/Interaction_Manipulators_CompositeMouseManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -349,7 +349,7 @@

    diff --git a/api/Interaction_Manipulators_CompositeVRManipulator.html b/api/Interaction_Manipulators_CompositeVRManipulator.html index 727a9e3ef7d..35fb00145a5 100644 --- a/api/Interaction_Manipulators_CompositeVRManipulator.html +++ b/api/Interaction_Manipulators_CompositeVRManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_GestureCameraManipulator.html b/api/Interaction_Manipulators_GestureCameraManipulator.html index 72a15a7e3fb..0ddb5c830b1 100644 --- a/api/Interaction_Manipulators_GestureCameraManipulator.html +++ b/api/Interaction_Manipulators_GestureCameraManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_KeyboardCameraManipulator.html b/api/Interaction_Manipulators_KeyboardCameraManipulator.html index 91dceba02cc..69f0fea7a10 100644 --- a/api/Interaction_Manipulators_KeyboardCameraManipulator.html +++ b/api/Interaction_Manipulators_KeyboardCameraManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html b/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html index 451eadf6292..e0eaaf49f1f 100644 --- a/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html +++ b/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -208,7 +208,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html b/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html index aef791fff59..c1ba1011107 100644 --- a/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraSliceManipulator.html b/api/Interaction_Manipulators_MouseCameraSliceManipulator.html index de1ad0d457c..c6cb00a4967 100644 --- a/api/Interaction_Manipulators_MouseCameraSliceManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraSliceManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html index 1ce7817bf4f..6ace3d659e2 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html index d6a98b0c131..4072153efa3 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html index 474dcbf97d5..73f7e43a904 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballRollManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballRollManipulator.html index 48142e47b52..e23f0730560 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballRollManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballRollManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballRotateManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballRotateManipulator.html index 38e7c1acbec..25c4f80c16d 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballRotateManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballRotateManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -171,7 +171,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballZoomManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballZoomManipulator.html index 737aa546095..fc206e26609 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballZoomManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballZoomManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -136,7 +136,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html b/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html index 19a93747009..dfae4f6e3a1 100644 --- a/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html b/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html index e62477ae40f..8e3b88f6906 100644 --- a/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html b/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html index 92edc05e03b..26a5a07d927 100644 --- a/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html +++ b/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Manipulators_MouseRangeManipulator.html b/api/Interaction_Manipulators_MouseRangeManipulator.html index 65f1c55bd88..594039a5ad0 100644 --- a/api/Interaction_Manipulators_MouseRangeManipulator.html +++ b/api/Interaction_Manipulators_MouseRangeManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Manipulators_VRButtonPanManipulator.html b/api/Interaction_Manipulators_VRButtonPanManipulator.html index aac60bd959b..ab53f152b01 100644 --- a/api/Interaction_Manipulators_VRButtonPanManipulator.html +++ b/api/Interaction_Manipulators_VRButtonPanManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Misc_DeviceOrientationToCamera.html b/api/Interaction_Misc_DeviceOrientationToCamera.html index b0093cc8d79..bedec9df72d 100644 --- a/api/Interaction_Misc_DeviceOrientationToCamera.html +++ b/api/Interaction_Misc_DeviceOrientationToCamera.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleImage.html b/api/Interaction_Style_InteractorStyleImage.html index adeb85935a9..82811de52f4 100644 --- a/api/Interaction_Style_InteractorStyleImage.html +++ b/api/Interaction_Style_InteractorStyleImage.html @@ -48,8 +48,8 @@ - - + + @@ -301,7 +301,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleMPRSlice.html b/api/Interaction_Style_InteractorStyleMPRSlice.html index d0ae3b3f987..adf4962afaf 100644 --- a/api/Interaction_Style_InteractorStyleMPRSlice.html +++ b/api/Interaction_Style_InteractorStyleMPRSlice.html @@ -48,8 +48,8 @@ - - + + @@ -131,7 +131,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleManipulator.html b/api/Interaction_Style_InteractorStyleManipulator.html index 453e1db1797..545db050dbc 100644 --- a/api/Interaction_Style_InteractorStyleManipulator.html +++ b/api/Interaction_Style_InteractorStyleManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -879,7 +879,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleRemoteMouse.html b/api/Interaction_Style_InteractorStyleRemoteMouse.html index 8ff9d01433e..671eee94f76 100644 --- a/api/Interaction_Style_InteractorStyleRemoteMouse.html +++ b/api/Interaction_Style_InteractorStyleRemoteMouse.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleTrackballCamera.html b/api/Interaction_Style_InteractorStyleTrackballCamera.html index c039c28dc95..90828be9623 100644 --- a/api/Interaction_Style_InteractorStyleTrackballCamera.html +++ b/api/Interaction_Style_InteractorStyleTrackballCamera.html @@ -48,8 +48,8 @@ - - + + @@ -539,7 +539,7 @@

    diff --git a/api/Interaction_Style_InteractorStyleUnicam.html b/api/Interaction_Style_InteractorStyleUnicam.html index a34307fd649..81ab6a49803 100644 --- a/api/Interaction_Style_InteractorStyleUnicam.html +++ b/api/Interaction_Style_InteractorStyleUnicam.html @@ -48,8 +48,8 @@ - - + + @@ -132,7 +132,7 @@

    diff --git a/api/Interaction_UI_CornerAnnotation.html b/api/Interaction_UI_CornerAnnotation.html index e84e1922071..3a4ec702ef5 100644 --- a/api/Interaction_UI_CornerAnnotation.html +++ b/api/Interaction_UI_CornerAnnotation.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_UI_FPSMonitor.html b/api/Interaction_UI_FPSMonitor.html index 6ba9de1f535..ae6c2386e26 100644 --- a/api/Interaction_UI_FPSMonitor.html +++ b/api/Interaction_UI_FPSMonitor.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_UI_Icons.html b/api/Interaction_UI_Icons.html index f465a205962..240946f49a5 100644 --- a/api/Interaction_UI_Icons.html +++ b/api/Interaction_UI_Icons.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Interaction_UI_Slider.html b/api/Interaction_UI_Slider.html index ef8d8f0da17..fdc14879fc8 100644 --- a/api/Interaction_UI_Slider.html +++ b/api/Interaction_UI_Slider.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Interaction_UI_VolumeController.html b/api/Interaction_UI_VolumeController.html index fb51fe2fd88..824a0141bca 100644 --- a/api/Interaction_UI_VolumeController.html +++ b/api/Interaction_UI_VolumeController.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Interaction_Widgets_OrientationMarkerWidget.html b/api/Interaction_Widgets_OrientationMarkerWidget.html index 871007a17f4..52ce57ae637 100644 --- a/api/Interaction_Widgets_OrientationMarkerWidget.html +++ b/api/Interaction_Widgets_OrientationMarkerWidget.html @@ -48,8 +48,8 @@ - - + + @@ -315,7 +315,7 @@

    diff --git a/api/Interaction_Widgets_PiecewiseGaussianWidget.html b/api/Interaction_Widgets_PiecewiseGaussianWidget.html index d83a6f50319..a0a91b9dc4d 100644 --- a/api/Interaction_Widgets_PiecewiseGaussianWidget.html +++ b/api/Interaction_Widgets_PiecewiseGaussianWidget.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Animation_AbstractAnimationProxy.html b/api/Proxy_Animation_AbstractAnimationProxy.html index 85d969fc0a3..41d8c8c8340 100644 --- a/api/Proxy_Animation_AbstractAnimationProxy.html +++ b/api/Proxy_Animation_AbstractAnimationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Animation_AnimationProxyManager.html b/api/Proxy_Animation_AnimationProxyManager.html index 1c3840f29ce..843b878a9dc 100644 --- a/api/Proxy_Animation_AnimationProxyManager.html +++ b/api/Proxy_Animation_AnimationProxyManager.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Animation_TimeStepBasedAnimationHandlerProxy.html b/api/Proxy_Animation_TimeStepBasedAnimationHandlerProxy.html index aba2530a9fe..57f88f473c5 100644 --- a/api/Proxy_Animation_TimeStepBasedAnimationHandlerProxy.html +++ b/api/Proxy_Animation_TimeStepBasedAnimationHandlerProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Core_AbstractRepresentationProxy.html b/api/Proxy_Core_AbstractRepresentationProxy.html index d85258b2501..f4e5d6df6dd 100644 --- a/api/Proxy_Core_AbstractRepresentationProxy.html +++ b/api/Proxy_Core_AbstractRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Core_LookupTableProxy.html b/api/Proxy_Core_LookupTableProxy.html index e7864c97315..9323e95307e 100644 --- a/api/Proxy_Core_LookupTableProxy.html +++ b/api/Proxy_Core_LookupTableProxy.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Proxy_Core_PiecewiseFunctionProxy.html b/api/Proxy_Core_PiecewiseFunctionProxy.html index 883c8fa3356..2df3eece952 100644 --- a/api/Proxy_Core_PiecewiseFunctionProxy.html +++ b/api/Proxy_Core_PiecewiseFunctionProxy.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Proxy_Core_ProxyManager.html b/api/Proxy_Core_ProxyManager.html index 9da6ce8c7c6..d9f99a512cf 100644 --- a/api/Proxy_Core_ProxyManager.html +++ b/api/Proxy_Core_ProxyManager.html @@ -48,8 +48,8 @@ - - + + @@ -169,7 +169,7 @@

    diff --git a/api/Proxy_Core_SourceProxy.html b/api/Proxy_Core_SourceProxy.html index 5391955dadb..0106bdfb190 100644 --- a/api/Proxy_Core_SourceProxy.html +++ b/api/Proxy_Core_SourceProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Core_View2DProxy.html b/api/Proxy_Core_View2DProxy.html index 134d53b253f..6004201c03e 100644 --- a/api/Proxy_Core_View2DProxy.html +++ b/api/Proxy_Core_View2DProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Core_ViewProxy.html b/api/Proxy_Core_ViewProxy.html index 04b3e6ed151..7e1e43cdfc9 100644 --- a/api/Proxy_Core_ViewProxy.html +++ b/api/Proxy_Core_ViewProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Representations_GeometryRepresentationProxy.html b/api/Proxy_Representations_GeometryRepresentationProxy.html index 93499d8d40c..632f0ddef9b 100644 --- a/api/Proxy_Representations_GeometryRepresentationProxy.html +++ b/api/Proxy_Representations_GeometryRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -136,7 +136,7 @@

    diff --git a/api/Proxy_Representations_GlyphRepresentationProxy.html b/api/Proxy_Representations_GlyphRepresentationProxy.html index 589cd2086f0..8d142fadc47 100644 --- a/api/Proxy_Representations_GlyphRepresentationProxy.html +++ b/api/Proxy_Representations_GlyphRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Representations_MoleculeRepresentationProxy.html b/api/Proxy_Representations_MoleculeRepresentationProxy.html index 721f7680c80..768f8f2cc4d 100644 --- a/api/Proxy_Representations_MoleculeRepresentationProxy.html +++ b/api/Proxy_Representations_MoleculeRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Representations_ResliceRepresentationProxy.html b/api/Proxy_Representations_ResliceRepresentationProxy.html index e66544f127c..43053bb1820 100644 --- a/api/Proxy_Representations_ResliceRepresentationProxy.html +++ b/api/Proxy_Representations_ResliceRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Proxy_Representations_SkyboxRepresentationProxy.html b/api/Proxy_Representations_SkyboxRepresentationProxy.html index 53405115c57..ebafefeaf86 100644 --- a/api/Proxy_Representations_SkyboxRepresentationProxy.html +++ b/api/Proxy_Representations_SkyboxRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Representations_SliceRepresentationProxy.html b/api/Proxy_Representations_SliceRepresentationProxy.html index 1d75abeccb9..b522c66c377 100644 --- a/api/Proxy_Representations_SliceRepresentationProxy.html +++ b/api/Proxy_Representations_SliceRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -134,7 +134,7 @@

    diff --git a/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html b/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html index d5c5527af4a..17a4ede71df 100644 --- a/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html +++ b/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Proxy_Representations_VolumeRepresentationProxy.html b/api/Proxy_Representations_VolumeRepresentationProxy.html index 8318cfce6f9..a5655dde37c 100644 --- a/api/Proxy_Representations_VolumeRepresentationProxy.html +++ b/api/Proxy_Representations_VolumeRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_Core_AbstractImageMapper.html b/api/Rendering_Core_AbstractImageMapper.html index 21791e88a85..a5bce958a47 100644 --- a/api/Rendering_Core_AbstractImageMapper.html +++ b/api/Rendering_Core_AbstractImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -353,7 +353,7 @@

    diff --git a/api/Rendering_Core_AbstractMapper.html b/api/Rendering_Core_AbstractMapper.html index 8f1d506bdee..6ad5c0bde05 100644 --- a/api/Rendering_Core_AbstractMapper.html +++ b/api/Rendering_Core_AbstractMapper.html @@ -48,8 +48,8 @@ - - + + @@ -231,7 +231,7 @@

    diff --git a/api/Rendering_Core_AbstractMapper3D.html b/api/Rendering_Core_AbstractMapper3D.html index 9e930bbe9c9..95e96bf215e 100644 --- a/api/Rendering_Core_AbstractMapper3D.html +++ b/api/Rendering_Core_AbstractMapper3D.html @@ -48,8 +48,8 @@ - - + + @@ -152,7 +152,7 @@

    diff --git a/api/Rendering_Core_AbstractPicker.html b/api/Rendering_Core_AbstractPicker.html index 4403f7e9fd7..c0f49628f3c 100644 --- a/api/Rendering_Core_AbstractPicker.html +++ b/api/Rendering_Core_AbstractPicker.html @@ -48,8 +48,8 @@ - - + + @@ -217,7 +217,7 @@

    diff --git a/api/Rendering_Core_Actor.html b/api/Rendering_Core_Actor.html index 7229f23863d..4ad60aee180 100644 --- a/api/Rendering_Core_Actor.html +++ b/api/Rendering_Core_Actor.html @@ -48,8 +48,8 @@ - - + + @@ -289,7 +289,7 @@

    diff --git a/api/Rendering_Core_Actor2D.html b/api/Rendering_Core_Actor2D.html index a769a15a48f..7bfa8b8f1f6 100644 --- a/api/Rendering_Core_Actor2D.html +++ b/api/Rendering_Core_Actor2D.html @@ -48,8 +48,8 @@ - - + + @@ -244,7 +244,7 @@

    diff --git a/api/Rendering_Core_AnnotatedCubeActor.html b/api/Rendering_Core_AnnotatedCubeActor.html index 59d75fa3723..d0ec533fff2 100644 --- a/api/Rendering_Core_AnnotatedCubeActor.html +++ b/api/Rendering_Core_AnnotatedCubeActor.html @@ -48,8 +48,8 @@ - - + + @@ -296,7 +296,7 @@

    diff --git a/api/Rendering_Core_AxesActor.html b/api/Rendering_Core_AxesActor.html index 9e674341623..50ab7699a6e 100644 --- a/api/Rendering_Core_AxesActor.html +++ b/api/Rendering_Core_AxesActor.html @@ -48,8 +48,8 @@ - - + + @@ -321,7 +321,7 @@

    diff --git a/api/Rendering_Core_Camera.html b/api/Rendering_Core_Camera.html index 6ee5242c44d..b8997686bef 100644 --- a/api/Rendering_Core_Camera.html +++ b/api/Rendering_Core_Camera.html @@ -48,8 +48,8 @@ - - + + @@ -1455,7 +1455,7 @@

    diff --git a/api/Rendering_Core_CellPicker.html b/api/Rendering_Core_CellPicker.html index 483d9afa5a6..6d363a58703 100644 --- a/api/Rendering_Core_CellPicker.html +++ b/api/Rendering_Core_CellPicker.html @@ -48,8 +48,8 @@ - - + + @@ -306,7 +306,7 @@

    diff --git a/api/Rendering_Core_ColorTransferFunction.html b/api/Rendering_Core_ColorTransferFunction.html index e25eea43450..2566693d514 100644 --- a/api/Rendering_Core_ColorTransferFunction.html +++ b/api/Rendering_Core_ColorTransferFunction.html @@ -48,8 +48,8 @@ - - + + @@ -986,7 +986,7 @@

    diff --git a/api/Rendering_Core_Coordinate.html b/api/Rendering_Core_Coordinate.html index 91ef039afb4..8ad53685304 100644 --- a/api/Rendering_Core_Coordinate.html +++ b/api/Rendering_Core_Coordinate.html @@ -48,8 +48,8 @@ - - + + @@ -407,7 +407,7 @@

    diff --git a/api/Rendering_Core_CubeAxesActor.html b/api/Rendering_Core_CubeAxesActor.html index 0c1333ca6dd..f75ed4ce4a7 100644 --- a/api/Rendering_Core_CubeAxesActor.html +++ b/api/Rendering_Core_CubeAxesActor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_Core_Follower.html b/api/Rendering_Core_Follower.html index d37b09007a3..e77d019c2a5 100644 --- a/api/Rendering_Core_Follower.html +++ b/api/Rendering_Core_Follower.html @@ -48,8 +48,8 @@ - - + + @@ -223,7 +223,7 @@

    diff --git a/api/Rendering_Core_Glyph3DMapper.html b/api/Rendering_Core_Glyph3DMapper.html index 49feed25631..dce96ed9aa8 100644 --- a/api/Rendering_Core_Glyph3DMapper.html +++ b/api/Rendering_Core_Glyph3DMapper.html @@ -48,8 +48,8 @@ - - + + @@ -267,7 +267,7 @@

    diff --git a/api/Rendering_Core_HardwareSelector.html b/api/Rendering_Core_HardwareSelector.html index e831b44fc95..1509f7e8871 100644 --- a/api/Rendering_Core_HardwareSelector.html +++ b/api/Rendering_Core_HardwareSelector.html @@ -48,8 +48,8 @@ - - + + @@ -236,7 +236,7 @@

    diff --git a/api/Rendering_Core_ImageArrayMapper.html b/api/Rendering_Core_ImageArrayMapper.html index 9d170770bf0..92b8f333796 100644 --- a/api/Rendering_Core_ImageArrayMapper.html +++ b/api/Rendering_Core_ImageArrayMapper.html @@ -48,8 +48,8 @@ - - + + @@ -525,7 +525,7 @@

    diff --git a/api/Rendering_Core_ImageCPRMapper.html b/api/Rendering_Core_ImageCPRMapper.html index 24aeb0f3c38..9812e90b637 100644 --- a/api/Rendering_Core_ImageCPRMapper.html +++ b/api/Rendering_Core_ImageCPRMapper.html @@ -48,8 +48,8 @@ - - + + @@ -751,7 +751,7 @@

    diff --git a/api/Rendering_Core_ImageMapper.html b/api/Rendering_Core_ImageMapper.html index 36facc67c75..c0ef1366a54 100644 --- a/api/Rendering_Core_ImageMapper.html +++ b/api/Rendering_Core_ImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -641,7 +641,7 @@

    diff --git a/api/Rendering_Core_ImageProperty.html b/api/Rendering_Core_ImageProperty.html index 71c1f70ca7e..1aaa958ebb8 100644 --- a/api/Rendering_Core_ImageProperty.html +++ b/api/Rendering_Core_ImageProperty.html @@ -48,8 +48,8 @@ - - + + @@ -488,7 +488,7 @@

    diff --git a/api/Rendering_Core_ImageResliceMapper.html b/api/Rendering_Core_ImageResliceMapper.html index 5e7c6361ae9..a0a7e1c5dfd 100644 --- a/api/Rendering_Core_ImageResliceMapper.html +++ b/api/Rendering_Core_ImageResliceMapper.html @@ -48,8 +48,8 @@ - - + + @@ -423,7 +423,7 @@

    diff --git a/api/Rendering_Core_ImageSlice.html b/api/Rendering_Core_ImageSlice.html index a07872597b0..331c66a12dc 100644 --- a/api/Rendering_Core_ImageSlice.html +++ b/api/Rendering_Core_ImageSlice.html @@ -48,8 +48,8 @@ - - + + @@ -253,7 +253,7 @@

    diff --git a/api/Rendering_Core_InteractorObserver.html b/api/Rendering_Core_InteractorObserver.html index c4afe0484c0..f097bd5ce87 100644 --- a/api/Rendering_Core_InteractorObserver.html +++ b/api/Rendering_Core_InteractorObserver.html @@ -48,8 +48,8 @@ - - + + @@ -380,7 +380,7 @@

    diff --git a/api/Rendering_Core_InteractorStyle.html b/api/Rendering_Core_InteractorStyle.html index 3dfca14c505..57f7dfbc8ea 100644 --- a/api/Rendering_Core_InteractorStyle.html +++ b/api/Rendering_Core_InteractorStyle.html @@ -48,8 +48,8 @@ - - + + @@ -163,7 +163,7 @@

    diff --git a/api/Rendering_Core_Light.html b/api/Rendering_Core_Light.html index 5ace2cdedb7..5fd77ea86c5 100644 --- a/api/Rendering_Core_Light.html +++ b/api/Rendering_Core_Light.html @@ -48,8 +48,8 @@ - - + + @@ -640,7 +640,7 @@

    diff --git a/api/Rendering_Core_Mapper.html b/api/Rendering_Core_Mapper.html index f38ee22ec42..435780c90f4 100644 --- a/api/Rendering_Core_Mapper.html +++ b/api/Rendering_Core_Mapper.html @@ -48,8 +48,8 @@ - - + + @@ -666,7 +666,7 @@

    - + PrevNext diff --git a/api/Rendering_Core_Mapper2D.html b/api/Rendering_Core_Mapper2D.html index c9fd5fbebee..5c4e7b3ebaa 100644 --- a/api/Rendering_Core_Mapper2D.html +++ b/api/Rendering_Core_Mapper2D.html @@ -48,8 +48,8 @@ - - + + @@ -462,7 +462,7 @@

    diff --git a/api/Rendering_Core_Picker.html b/api/Rendering_Core_Picker.html index 111c71e89cb..e2740e46085 100644 --- a/api/Rendering_Core_Picker.html +++ b/api/Rendering_Core_Picker.html @@ -48,8 +48,8 @@ - - + + @@ -293,7 +293,7 @@

    diff --git a/api/Rendering_Core_PixelSpaceCallbackMapper.html b/api/Rendering_Core_PixelSpaceCallbackMapper.html index bda0bad0c94..f52e07e921a 100644 --- a/api/Rendering_Core_PixelSpaceCallbackMapper.html +++ b/api/Rendering_Core_PixelSpaceCallbackMapper.html @@ -48,8 +48,8 @@ - - + + @@ -246,7 +246,7 @@

    diff --git a/api/Rendering_Core_PointPicker.html b/api/Rendering_Core_PointPicker.html index f2760e280cc..ef174d0fc23 100644 --- a/api/Rendering_Core_PointPicker.html +++ b/api/Rendering_Core_PointPicker.html @@ -48,8 +48,8 @@ - - + + @@ -253,7 +253,7 @@

    diff --git a/api/Rendering_Core_Prop.html b/api/Rendering_Core_Prop.html index 5853c871493..ad2f7450bf1 100644 --- a/api/Rendering_Core_Prop.html +++ b/api/Rendering_Core_Prop.html @@ -48,8 +48,8 @@ - - + + @@ -400,7 +400,7 @@

    diff --git a/api/Rendering_Core_Prop3D.html b/api/Rendering_Core_Prop3D.html index 44c02194857..c6fa8e14f92 100644 --- a/api/Rendering_Core_Prop3D.html +++ b/api/Rendering_Core_Prop3D.html @@ -48,8 +48,8 @@ - - + + @@ -488,7 +488,7 @@

    diff --git a/api/Rendering_Core_Property.html b/api/Rendering_Core_Property.html index bdb3f08c811..bf74c649ee4 100644 --- a/api/Rendering_Core_Property.html +++ b/api/Rendering_Core_Property.html @@ -48,8 +48,8 @@ - - + + @@ -878,7 +878,7 @@

    diff --git a/api/Rendering_Core_Property2D.html b/api/Rendering_Core_Property2D.html index a1809678533..ccbdb920bf5 100644 --- a/api/Rendering_Core_Property2D.html +++ b/api/Rendering_Core_Property2D.html @@ -48,8 +48,8 @@ - - + + @@ -333,7 +333,7 @@

    diff --git a/api/Rendering_Core_RenderWindow.html b/api/Rendering_Core_RenderWindow.html index 55d6fc5f417..c9a36048baa 100644 --- a/api/Rendering_Core_RenderWindow.html +++ b/api/Rendering_Core_RenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -376,7 +376,7 @@

    - + PrevNext diff --git a/api/Rendering_Core_RenderWindowInteractor.html b/api/Rendering_Core_RenderWindowInteractor.html index 1bbc1f13a98..7c312920eb6 100644 --- a/api/Rendering_Core_RenderWindowInteractor.html +++ b/api/Rendering_Core_RenderWindowInteractor.html @@ -48,8 +48,8 @@ - - + + @@ -2703,7 +2703,7 @@

    diff --git a/api/Rendering_Core_Renderer.html b/api/Rendering_Core_Renderer.html index 540dfc3e795..f43353ce08b 100644 --- a/api/Rendering_Core_Renderer.html +++ b/api/Rendering_Core_Renderer.html @@ -48,8 +48,8 @@ - - + + @@ -1043,7 +1043,7 @@

    diff --git a/api/Rendering_Core_ScalarBarActor.html b/api/Rendering_Core_ScalarBarActor.html index fb22b0e4b60..82dd0783f43 100644 --- a/api/Rendering_Core_ScalarBarActor.html +++ b/api/Rendering_Core_ScalarBarActor.html @@ -48,8 +48,8 @@ - - + + @@ -584,7 +584,7 @@

    diff --git a/api/Rendering_Core_Skybox.html b/api/Rendering_Core_Skybox.html index 25559f1c685..db7f58df2d5 100644 --- a/api/Rendering_Core_Skybox.html +++ b/api/Rendering_Core_Skybox.html @@ -48,8 +48,8 @@ - - + + @@ -164,7 +164,7 @@

    diff --git a/api/Rendering_Core_SphereMapper.html b/api/Rendering_Core_SphereMapper.html index fd403feaadc..303b2354b51 100644 --- a/api/Rendering_Core_SphereMapper.html +++ b/api/Rendering_Core_SphereMapper.html @@ -48,8 +48,8 @@ - - + + @@ -197,7 +197,7 @@

    diff --git a/api/Rendering_Core_StickMapper.html b/api/Rendering_Core_StickMapper.html index d27ae72c895..0cb379c3ea1 100644 --- a/api/Rendering_Core_StickMapper.html +++ b/api/Rendering_Core_StickMapper.html @@ -48,8 +48,8 @@ - - + + @@ -182,7 +182,7 @@

    diff --git a/api/Rendering_Core_SurfaceLICInterface.html b/api/Rendering_Core_SurfaceLICInterface.html index e346d453d19..d020aa16864 100644 --- a/api/Rendering_Core_SurfaceLICInterface.html +++ b/api/Rendering_Core_SurfaceLICInterface.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_Core_SurfaceLICMapper.html b/api/Rendering_Core_SurfaceLICMapper.html index 1c1b3814979..7124374179e 100644 --- a/api/Rendering_Core_SurfaceLICMapper.html +++ b/api/Rendering_Core_SurfaceLICMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_Core_Texture.html b/api/Rendering_Core_Texture.html index b46c2104960..8b1e0469cee 100644 --- a/api/Rendering_Core_Texture.html +++ b/api/Rendering_Core_Texture.html @@ -48,8 +48,8 @@ - - + + @@ -280,7 +280,7 @@

    diff --git a/api/Rendering_Core_Viewport.html b/api/Rendering_Core_Viewport.html index 47d687bc523..308e6e347df 100644 --- a/api/Rendering_Core_Viewport.html +++ b/api/Rendering_Core_Viewport.html @@ -48,8 +48,8 @@ - - + + @@ -565,7 +565,7 @@

    - + PrevNext diff --git a/api/Rendering_Core_Volume.html b/api/Rendering_Core_Volume.html index 6d7d5a55952..873556b7073 100644 --- a/api/Rendering_Core_Volume.html +++ b/api/Rendering_Core_Volume.html @@ -48,8 +48,8 @@ - - + + @@ -238,7 +238,7 @@

    diff --git a/api/Rendering_Core_VolumeMapper.html b/api/Rendering_Core_VolumeMapper.html index cb1c06fe441..86987c99f9b 100644 --- a/api/Rendering_Core_VolumeMapper.html +++ b/api/Rendering_Core_VolumeMapper.html @@ -48,8 +48,8 @@ - - + + @@ -497,7 +497,7 @@

    diff --git a/api/Rendering_Core_VolumeProperty.html b/api/Rendering_Core_VolumeProperty.html index ff12aaee753..45a46aee5b4 100644 --- a/api/Rendering_Core_VolumeProperty.html +++ b/api/Rendering_Core_VolumeProperty.html @@ -48,8 +48,8 @@ - - + + @@ -756,7 +756,7 @@

    diff --git a/api/Rendering_Misc_CanvasView.html b/api/Rendering_Misc_CanvasView.html index 458f28b9706..73cdd6ebd64 100644 --- a/api/Rendering_Misc_CanvasView.html +++ b/api/Rendering_Misc_CanvasView.html @@ -48,8 +48,8 @@ - - + + @@ -355,7 +355,7 @@

    diff --git a/api/Rendering_Misc_FullScreenRenderWindow.html b/api/Rendering_Misc_FullScreenRenderWindow.html index dfc86bfa097..60f3e040c27 100644 --- a/api/Rendering_Misc_FullScreenRenderWindow.html +++ b/api/Rendering_Misc_FullScreenRenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -276,7 +276,7 @@

    diff --git a/api/Rendering_Misc_GenericRenderWindow.html b/api/Rendering_Misc_GenericRenderWindow.html index a703059f7df..79748905b1e 100644 --- a/api/Rendering_Misc_GenericRenderWindow.html +++ b/api/Rendering_Misc_GenericRenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -245,7 +245,7 @@

    diff --git a/api/Rendering_Misc_RemoteView.html b/api/Rendering_Misc_RemoteView.html index 2f42798f1ed..14806abf3e9 100644 --- a/api/Rendering_Misc_RemoteView.html +++ b/api/Rendering_Misc_RemoteView.html @@ -48,8 +48,8 @@ - - + + @@ -344,7 +344,7 @@

    diff --git a/api/Rendering_Misc_RenderWindowWithControlBar.html b/api/Rendering_Misc_RenderWindowWithControlBar.html index 8c8c1f49819..97a70bb3f26 100644 --- a/api/Rendering_Misc_RenderWindowWithControlBar.html +++ b/api/Rendering_Misc_RenderWindowWithControlBar.html @@ -48,8 +48,8 @@ - - + + @@ -220,7 +220,7 @@

    diff --git a/api/Rendering_Misc_RenderingAPIs.html b/api/Rendering_Misc_RenderingAPIs.html index 596512dbbe9..5ee396e1896 100644 --- a/api/Rendering_Misc_RenderingAPIs.html +++ b/api/Rendering_Misc_RenderingAPIs.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_Misc_SynchronizableRenderWindow.html b/api/Rendering_Misc_SynchronizableRenderWindow.html index 3f8c956c321..da8d92e87f5 100644 --- a/api/Rendering_Misc_SynchronizableRenderWindow.html +++ b/api/Rendering_Misc_SynchronizableRenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -288,7 +288,7 @@

    diff --git a/api/Rendering_Misc_TextureLODsDownloader.html b/api/Rendering_Misc_TextureLODsDownloader.html index 06ff8695052..538156bfda6 100644 --- a/api/Rendering_Misc_TextureLODsDownloader.html +++ b/api/Rendering_Misc_TextureLODsDownloader.html @@ -48,8 +48,8 @@ - - + + @@ -308,7 +308,7 @@

    diff --git a/api/Rendering_OpenGL_Actor.html b/api/Rendering_OpenGL_Actor.html index 62834284fa5..e03604972ac 100644 --- a/api/Rendering_OpenGL_Actor.html +++ b/api/Rendering_OpenGL_Actor.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_Actor2D.html b/api/Rendering_OpenGL_Actor2D.html index c32553b2c94..dd670dce39a 100644 --- a/api/Rendering_OpenGL_Actor2D.html +++ b/api/Rendering_OpenGL_Actor2D.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_BufferObject.html b/api/Rendering_OpenGL_BufferObject.html index bb0faca716f..228410a9286 100644 --- a/api/Rendering_OpenGL_BufferObject.html +++ b/api/Rendering_OpenGL_BufferObject.html @@ -48,8 +48,8 @@ - - + + @@ -129,7 +129,7 @@

    diff --git a/api/Rendering_OpenGL_Camera.html b/api/Rendering_OpenGL_Camera.html index 4d5943f0b8a..ef8e253b74d 100644 --- a/api/Rendering_OpenGL_Camera.html +++ b/api/Rendering_OpenGL_Camera.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_CellArrayBufferObject.html b/api/Rendering_OpenGL_CellArrayBufferObject.html index dffb85170b6..2133cd55e8a 100644 --- a/api/Rendering_OpenGL_CellArrayBufferObject.html +++ b/api/Rendering_OpenGL_CellArrayBufferObject.html @@ -48,8 +48,8 @@ - - + + @@ -136,7 +136,7 @@

    diff --git a/api/Rendering_OpenGL_Convolution2DPass.html b/api/Rendering_OpenGL_Convolution2DPass.html index 27c38403991..4c71685fc1f 100644 --- a/api/Rendering_OpenGL_Convolution2DPass.html +++ b/api/Rendering_OpenGL_Convolution2DPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_CubeAxesActor.html b/api/Rendering_OpenGL_CubeAxesActor.html index aecf255691c..97a4a58b34c 100644 --- a/api/Rendering_OpenGL_CubeAxesActor.html +++ b/api/Rendering_OpenGL_CubeAxesActor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_ForwardPass.html b/api/Rendering_OpenGL_ForwardPass.html index 1aa4308b393..af2219d849f 100644 --- a/api/Rendering_OpenGL_ForwardPass.html +++ b/api/Rendering_OpenGL_ForwardPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_Framebuffer.html b/api/Rendering_OpenGL_Framebuffer.html index 592bedc10f3..51dd4f74996 100644 --- a/api/Rendering_OpenGL_Framebuffer.html +++ b/api/Rendering_OpenGL_Framebuffer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_Glyph3DMapper.html b/api/Rendering_OpenGL_Glyph3DMapper.html index f42e5cd90a2..ac3d1c3dd09 100644 --- a/api/Rendering_OpenGL_Glyph3DMapper.html +++ b/api/Rendering_OpenGL_Glyph3DMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_HardwareSelector.html b/api/Rendering_OpenGL_HardwareSelector.html index e9f7814652d..d57a72a557f 100644 --- a/api/Rendering_OpenGL_HardwareSelector.html +++ b/api/Rendering_OpenGL_HardwareSelector.html @@ -48,8 +48,8 @@ - - + + @@ -669,7 +669,7 @@

    diff --git a/api/Rendering_OpenGL_Helper.html b/api/Rendering_OpenGL_Helper.html index fc7e77906ab..631454f52ae 100644 --- a/api/Rendering_OpenGL_Helper.html +++ b/api/Rendering_OpenGL_Helper.html @@ -48,8 +48,8 @@ - - + + @@ -124,7 +124,7 @@

    diff --git a/api/Rendering_OpenGL_ImageCPRMapper.html b/api/Rendering_OpenGL_ImageCPRMapper.html index 30a0629ecf5..0a894da8ed2 100644 --- a/api/Rendering_OpenGL_ImageCPRMapper.html +++ b/api/Rendering_OpenGL_ImageCPRMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_ImageMapper.html b/api/Rendering_OpenGL_ImageMapper.html index 6eeda3f1abd..c8bfd203f1a 100644 --- a/api/Rendering_OpenGL_ImageMapper.html +++ b/api/Rendering_OpenGL_ImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_ImageResliceMapper.html b/api/Rendering_OpenGL_ImageResliceMapper.html index 6a9e786c40f..3b0d8335f7b 100644 --- a/api/Rendering_OpenGL_ImageResliceMapper.html +++ b/api/Rendering_OpenGL_ImageResliceMapper.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_ImageSlice.html b/api/Rendering_OpenGL_ImageSlice.html index 7965bab4853..f4bfa448caf 100644 --- a/api/Rendering_OpenGL_ImageSlice.html +++ b/api/Rendering_OpenGL_ImageSlice.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html b/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html index 4333039b3c4..7d687e079f1 100644 --- a/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html +++ b/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html b/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html index 39b6865c5f1..ecb85836591 100644 --- a/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html +++ b/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_PolyDataMapper.html b/api/Rendering_OpenGL_PolyDataMapper.html index fd7be470d9a..2509179f9a0 100644 --- a/api/Rendering_OpenGL_PolyDataMapper.html +++ b/api/Rendering_OpenGL_PolyDataMapper.html @@ -48,8 +48,8 @@ - - + + @@ -154,7 +154,7 @@

    diff --git a/api/Rendering_OpenGL_PolyDataMapper2D.html b/api/Rendering_OpenGL_PolyDataMapper2D.html index a6aa5185b90..8ae057483fc 100644 --- a/api/Rendering_OpenGL_PolyDataMapper2D.html +++ b/api/Rendering_OpenGL_PolyDataMapper2D.html @@ -48,8 +48,8 @@ - - + + @@ -154,7 +154,7 @@

    diff --git a/api/Rendering_OpenGL_Profiles.html b/api/Rendering_OpenGL_Profiles.html index b67228d5c44..89ffe688166 100644 --- a/api/Rendering_OpenGL_Profiles.html +++ b/api/Rendering_OpenGL_Profiles.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/api/Rendering_OpenGL_RadialDistortionPass.html b/api/Rendering_OpenGL_RadialDistortionPass.html index 4bd04a16c01..4923ea590bd 100644 --- a/api/Rendering_OpenGL_RadialDistortionPass.html +++ b/api/Rendering_OpenGL_RadialDistortionPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_RenderWindow.html b/api/Rendering_OpenGL_RenderWindow.html index 7804d82e6d8..3346914483a 100644 --- a/api/Rendering_OpenGL_RenderWindow.html +++ b/api/Rendering_OpenGL_RenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -949,7 +949,7 @@

    diff --git a/api/Rendering_OpenGL_Renderer.html b/api/Rendering_OpenGL_Renderer.html index efc479817e7..8eab67249f8 100644 --- a/api/Rendering_OpenGL_Renderer.html +++ b/api/Rendering_OpenGL_Renderer.html @@ -48,8 +48,8 @@ - - + + @@ -121,7 +121,7 @@

    diff --git a/api/Rendering_OpenGL_ReplacementShaderMapper.html b/api/Rendering_OpenGL_ReplacementShaderMapper.html index c1442b3c10b..f3b1561fbf8 100644 --- a/api/Rendering_OpenGL_ReplacementShaderMapper.html +++ b/api/Rendering_OpenGL_ReplacementShaderMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_ScalarBarActor.html b/api/Rendering_OpenGL_ScalarBarActor.html index a3026fce610..3251589c520 100644 --- a/api/Rendering_OpenGL_ScalarBarActor.html +++ b/api/Rendering_OpenGL_ScalarBarActor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_Shader.html b/api/Rendering_OpenGL_Shader.html index 0d223568040..c12eb7d72ae 100644 --- a/api/Rendering_OpenGL_Shader.html +++ b/api/Rendering_OpenGL_Shader.html @@ -48,8 +48,8 @@ - - + + @@ -124,7 +124,7 @@

    diff --git a/api/Rendering_OpenGL_ShaderCache.html b/api/Rendering_OpenGL_ShaderCache.html index f72dce722fa..7863a2bef2f 100644 --- a/api/Rendering_OpenGL_ShaderCache.html +++ b/api/Rendering_OpenGL_ShaderCache.html @@ -48,8 +48,8 @@ - - + + @@ -124,7 +124,7 @@

    diff --git a/api/Rendering_OpenGL_ShaderProgram.html b/api/Rendering_OpenGL_ShaderProgram.html index 14d6d4ff256..a98eb199e09 100644 --- a/api/Rendering_OpenGL_ShaderProgram.html +++ b/api/Rendering_OpenGL_ShaderProgram.html @@ -48,8 +48,8 @@ - - + + @@ -178,7 +178,7 @@

    diff --git a/api/Rendering_OpenGL_Skybox.html b/api/Rendering_OpenGL_Skybox.html index 342b8f282c4..83080f4b887 100644 --- a/api/Rendering_OpenGL_Skybox.html +++ b/api/Rendering_OpenGL_Skybox.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_SphereMapper.html b/api/Rendering_OpenGL_SphereMapper.html index af9cd6ff64c..df19c4278fe 100644 --- a/api/Rendering_OpenGL_SphereMapper.html +++ b/api/Rendering_OpenGL_SphereMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/api/Rendering_OpenGL_StickMapper.html b/api/Rendering_OpenGL_StickMapper.html index 4b1265b3314..d39e73b253a 100644 --- a/api/Rendering_OpenGL_StickMapper.html +++ b/api/Rendering_OpenGL_StickMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/api/Rendering_OpenGL_SurfaceLIC.html b/api/Rendering_OpenGL_SurfaceLIC.html index bf3fcba741a..b4a20e7860c 100644 --- a/api/Rendering_OpenGL_SurfaceLIC.html +++ b/api/Rendering_OpenGL_SurfaceLIC.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_Texture.html b/api/Rendering_OpenGL_Texture.html index 8a096ec4e69..0f03c4bf335 100644 --- a/api/Rendering_OpenGL_Texture.html +++ b/api/Rendering_OpenGL_Texture.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Rendering_OpenGL_TextureUnitManager.html b/api/Rendering_OpenGL_TextureUnitManager.html index 7004dbfb91b..595fc06a7ff 100644 --- a/api/Rendering_OpenGL_TextureUnitManager.html +++ b/api/Rendering_OpenGL_TextureUnitManager.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_OpenGL_VertexArrayObject.html b/api/Rendering_OpenGL_VertexArrayObject.html index 17f0ab978ce..cec714bf989 100644 --- a/api/Rendering_OpenGL_VertexArrayObject.html +++ b/api/Rendering_OpenGL_VertexArrayObject.html @@ -48,8 +48,8 @@ - - + + @@ -136,7 +136,7 @@

    diff --git a/api/Rendering_OpenGL_ViewNodeFactory.html b/api/Rendering_OpenGL_ViewNodeFactory.html index 3589026a280..7cad3ab532e 100644 --- a/api/Rendering_OpenGL_ViewNodeFactory.html +++ b/api/Rendering_OpenGL_ViewNodeFactory.html @@ -48,8 +48,8 @@ - - + + @@ -121,7 +121,7 @@

    diff --git a/api/Rendering_OpenGL_Volume.html b/api/Rendering_OpenGL_Volume.html index c93bad9e4ac..152191943d5 100644 --- a/api/Rendering_OpenGL_Volume.html +++ b/api/Rendering_OpenGL_Volume.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_VolumeMapper.html b/api/Rendering_OpenGL_VolumeMapper.html index 1b6e84f4589..d2e1c785369 100644 --- a/api/Rendering_OpenGL_VolumeMapper.html +++ b/api/Rendering_OpenGL_VolumeMapper.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_OpenGL_glsl.html b/api/Rendering_OpenGL_glsl.html index 919a939a7a7..bd2a94192ff 100644 --- a/api/Rendering_OpenGL_glsl.html +++ b/api/Rendering_OpenGL_glsl.html @@ -48,8 +48,8 @@ - - + + @@ -127,7 +127,7 @@

    diff --git a/api/Rendering_SceneGraph_RenderPass.html b/api/Rendering_SceneGraph_RenderPass.html index 8ae0558eb79..ae13ce68937 100644 --- a/api/Rendering_SceneGraph_RenderPass.html +++ b/api/Rendering_SceneGraph_RenderPass.html @@ -48,8 +48,8 @@ - - + + @@ -268,7 +268,7 @@

    diff --git a/api/Rendering_SceneGraph_RenderWindowViewNode.html b/api/Rendering_SceneGraph_RenderWindowViewNode.html index 49fd5310a62..2a4f015374c 100644 --- a/api/Rendering_SceneGraph_RenderWindowViewNode.html +++ b/api/Rendering_SceneGraph_RenderWindowViewNode.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_SceneGraph_ViewNode.html b/api/Rendering_SceneGraph_ViewNode.html index ffe15456290..e0ef59ca26d 100644 --- a/api/Rendering_SceneGraph_ViewNode.html +++ b/api/Rendering_SceneGraph_ViewNode.html @@ -48,8 +48,8 @@ - - + + @@ -386,7 +386,7 @@

    diff --git a/api/Rendering_SceneGraph_ViewNodeFactory.html b/api/Rendering_SceneGraph_ViewNodeFactory.html index d3065de9988..9ad50fdc2a1 100644 --- a/api/Rendering_SceneGraph_ViewNodeFactory.html +++ b/api/Rendering_SceneGraph_ViewNodeFactory.html @@ -48,8 +48,8 @@ - - + + @@ -206,7 +206,7 @@

    diff --git a/api/Rendering_WebGPU_Actor.html b/api/Rendering_WebGPU_Actor.html index 70c6fcb695e..8841bf0b949 100644 --- a/api/Rendering_WebGPU_Actor.html +++ b/api/Rendering_WebGPU_Actor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Actor2D.html b/api/Rendering_WebGPU_Actor2D.html index 3461ad04cf2..e6e94c97e05 100644 --- a/api/Rendering_WebGPU_Actor2D.html +++ b/api/Rendering_WebGPU_Actor2D.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_BindGroup.html b/api/Rendering_WebGPU_BindGroup.html index 7d22a154d27..3f50e05f32c 100644 --- a/api/Rendering_WebGPU_BindGroup.html +++ b/api/Rendering_WebGPU_BindGroup.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Buffer.html b/api/Rendering_WebGPU_Buffer.html index 34f4cdf60e2..973d93ac5b0 100644 --- a/api/Rendering_WebGPU_Buffer.html +++ b/api/Rendering_WebGPU_Buffer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_BufferManager.html b/api/Rendering_WebGPU_BufferManager.html index 3140898a7fc..d372c011ad3 100644 --- a/api/Rendering_WebGPU_BufferManager.html +++ b/api/Rendering_WebGPU_BufferManager.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_WebGPU_Camera.html b/api/Rendering_WebGPU_Camera.html index 69744795fe2..70724e8826d 100644 --- a/api/Rendering_WebGPU_Camera.html +++ b/api/Rendering_WebGPU_Camera.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_CellArrayMapper.html b/api/Rendering_WebGPU_CellArrayMapper.html index 004bfe5a142..78ee9d1b436 100644 --- a/api/Rendering_WebGPU_CellArrayMapper.html +++ b/api/Rendering_WebGPU_CellArrayMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_CubeAxesActor.html b/api/Rendering_WebGPU_CubeAxesActor.html index 5cc07b8cbf1..5cf66326d6f 100644 --- a/api/Rendering_WebGPU_CubeAxesActor.html +++ b/api/Rendering_WebGPU_CubeAxesActor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Device.html b/api/Rendering_WebGPU_Device.html index b7892ab12d5..277f8ecf49f 100644 --- a/api/Rendering_WebGPU_Device.html +++ b/api/Rendering_WebGPU_Device.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ForwardPass.html b/api/Rendering_WebGPU_ForwardPass.html index 1cd2e2aa772..2e643f5efc8 100644 --- a/api/Rendering_WebGPU_ForwardPass.html +++ b/api/Rendering_WebGPU_ForwardPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_FullScreenQuad.html b/api/Rendering_WebGPU_FullScreenQuad.html index e4a54545478..255ef4d4534 100644 --- a/api/Rendering_WebGPU_FullScreenQuad.html +++ b/api/Rendering_WebGPU_FullScreenQuad.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Glyph3DMapper.html b/api/Rendering_WebGPU_Glyph3DMapper.html index ec18295ab45..223a6777207 100644 --- a/api/Rendering_WebGPU_Glyph3DMapper.html +++ b/api/Rendering_WebGPU_Glyph3DMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_HardwareSelectionPass.html b/api/Rendering_WebGPU_HardwareSelectionPass.html index 57c6170922b..91264837780 100644 --- a/api/Rendering_WebGPU_HardwareSelectionPass.html +++ b/api/Rendering_WebGPU_HardwareSelectionPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_HardwareSelector.html b/api/Rendering_WebGPU_HardwareSelector.html index 0186e8185df..478b96dea82 100644 --- a/api/Rendering_WebGPU_HardwareSelector.html +++ b/api/Rendering_WebGPU_HardwareSelector.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ImageMapper.html b/api/Rendering_WebGPU_ImageMapper.html index e69ac7ec516..81b77ab549a 100644 --- a/api/Rendering_WebGPU_ImageMapper.html +++ b/api/Rendering_WebGPU_ImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ImageSlice.html b/api/Rendering_WebGPU_ImageSlice.html index c6f274654f2..297e5ad4d01 100644 --- a/api/Rendering_WebGPU_ImageSlice.html +++ b/api/Rendering_WebGPU_ImageSlice.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_IndexBuffer.html b/api/Rendering_WebGPU_IndexBuffer.html index 83b43ffacf7..a49dd3d0737 100644 --- a/api/Rendering_WebGPU_IndexBuffer.html +++ b/api/Rendering_WebGPU_IndexBuffer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_OpaquePass.html b/api/Rendering_WebGPU_OpaquePass.html index c41bb254e84..639b7e1d3a6 100644 --- a/api/Rendering_WebGPU_OpaquePass.html +++ b/api/Rendering_WebGPU_OpaquePass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html b/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html index 478df638c58..2e5f1a0fef0 100644 --- a/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html +++ b/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Pipeline.html b/api/Rendering_WebGPU_Pipeline.html index b33d423ff65..b2a6139120c 100644 --- a/api/Rendering_WebGPU_Pipeline.html +++ b/api/Rendering_WebGPU_Pipeline.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html b/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html index c9ceb50ebb7..6bceac5c35e 100644 --- a/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html +++ b/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_PolyDataMapper.html b/api/Rendering_WebGPU_PolyDataMapper.html index 2a5bef91e99..c3fe768e7a9 100644 --- a/api/Rendering_WebGPU_PolyDataMapper.html +++ b/api/Rendering_WebGPU_PolyDataMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_PolyDataMapper2D.html b/api/Rendering_WebGPU_PolyDataMapper2D.html index 388289afcac..025298fdc9a 100644 --- a/api/Rendering_WebGPU_PolyDataMapper2D.html +++ b/api/Rendering_WebGPU_PolyDataMapper2D.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Profiles.html b/api/Rendering_WebGPU_Profiles.html index 4257ba19d16..c6656d06570 100644 --- a/api/Rendering_WebGPU_Profiles.html +++ b/api/Rendering_WebGPU_Profiles.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/api/Rendering_WebGPU_RenderEncoder.html b/api/Rendering_WebGPU_RenderEncoder.html index bb490d8cff7..4c7a4e074bb 100644 --- a/api/Rendering_WebGPU_RenderEncoder.html +++ b/api/Rendering_WebGPU_RenderEncoder.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_RenderWindow.html b/api/Rendering_WebGPU_RenderWindow.html index b8764a57fcb..98c65a288d2 100644 --- a/api/Rendering_WebGPU_RenderWindow.html +++ b/api/Rendering_WebGPU_RenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Rendering_WebGPU_Renderer.html b/api/Rendering_WebGPU_Renderer.html index 13bd6fe70f6..0869613ef63 100644 --- a/api/Rendering_WebGPU_Renderer.html +++ b/api/Rendering_WebGPU_Renderer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Sampler.html b/api/Rendering_WebGPU_Sampler.html index 2914a590f4e..2fe993743e3 100644 --- a/api/Rendering_WebGPU_Sampler.html +++ b/api/Rendering_WebGPU_Sampler.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ScalarBarActor.html b/api/Rendering_WebGPU_ScalarBarActor.html index 10b3df47fa0..1b79a65c87a 100644 --- a/api/Rendering_WebGPU_ScalarBarActor.html +++ b/api/Rendering_WebGPU_ScalarBarActor.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ShaderCache.html b/api/Rendering_WebGPU_ShaderCache.html index e02cb87c4fe..b359edb1ae0 100644 --- a/api/Rendering_WebGPU_ShaderCache.html +++ b/api/Rendering_WebGPU_ShaderCache.html @@ -48,8 +48,8 @@ - - + + @@ -118,7 +118,7 @@

    diff --git a/api/Rendering_WebGPU_ShaderDescription.html b/api/Rendering_WebGPU_ShaderDescription.html index 6cd5719763e..ff2bc9bf7f4 100644 --- a/api/Rendering_WebGPU_ShaderDescription.html +++ b/api/Rendering_WebGPU_ShaderDescription.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ShaderModule.html b/api/Rendering_WebGPU_ShaderModule.html index d423b6a5298..825ac80a972 100644 --- a/api/Rendering_WebGPU_ShaderModule.html +++ b/api/Rendering_WebGPU_ShaderModule.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_SimpleMapper.html b/api/Rendering_WebGPU_SimpleMapper.html index 803518ed9b6..0173018a230 100644 --- a/api/Rendering_WebGPU_SimpleMapper.html +++ b/api/Rendering_WebGPU_SimpleMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_SphereMapper.html b/api/Rendering_WebGPU_SphereMapper.html index 2407f06ddf8..aa859dd7630 100644 --- a/api/Rendering_WebGPU_SphereMapper.html +++ b/api/Rendering_WebGPU_SphereMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_StickMapper.html b/api/Rendering_WebGPU_StickMapper.html index 798edc4875a..bda8195fa7c 100644 --- a/api/Rendering_WebGPU_StickMapper.html +++ b/api/Rendering_WebGPU_StickMapper.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_StorageBuffer.html b/api/Rendering_WebGPU_StorageBuffer.html index 2247cb3ecae..f9aadfbaffd 100644 --- a/api/Rendering_WebGPU_StorageBuffer.html +++ b/api/Rendering_WebGPU_StorageBuffer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Texture.html b/api/Rendering_WebGPU_Texture.html index f201cd80e8d..fdd74cc90ec 100644 --- a/api/Rendering_WebGPU_Texture.html +++ b/api/Rendering_WebGPU_Texture.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_TextureManager.html b/api/Rendering_WebGPU_TextureManager.html index 9bc4bdd0cf5..5ad3a8ec627 100644 --- a/api/Rendering_WebGPU_TextureManager.html +++ b/api/Rendering_WebGPU_TextureManager.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_TextureView.html b/api/Rendering_WebGPU_TextureView.html index f9630c5035c..9209ab1c6ba 100644 --- a/api/Rendering_WebGPU_TextureView.html +++ b/api/Rendering_WebGPU_TextureView.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Types.html b/api/Rendering_WebGPU_Types.html index 1eeebdb748c..8f62bf39619 100644 --- a/api/Rendering_WebGPU_Types.html +++ b/api/Rendering_WebGPU_Types.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_UniformBuffer.html b/api/Rendering_WebGPU_UniformBuffer.html index d6fc6313248..3a5172d0bd6 100644 --- a/api/Rendering_WebGPU_UniformBuffer.html +++ b/api/Rendering_WebGPU_UniformBuffer.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_VertexInput.html b/api/Rendering_WebGPU_VertexInput.html index bdde91054cb..f3a6d57c500 100644 --- a/api/Rendering_WebGPU_VertexInput.html +++ b/api/Rendering_WebGPU_VertexInput.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_ViewNodeFactory.html b/api/Rendering_WebGPU_ViewNodeFactory.html index a466c7c4c10..2ea9d393d4e 100644 --- a/api/Rendering_WebGPU_ViewNodeFactory.html +++ b/api/Rendering_WebGPU_ViewNodeFactory.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_Volume.html b/api/Rendering_WebGPU_Volume.html index cf337e9007a..ef06d8eb336 100644 --- a/api/Rendering_WebGPU_Volume.html +++ b/api/Rendering_WebGPU_Volume.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_VolumePass.html b/api/Rendering_WebGPU_VolumePass.html index 5a057ff5a53..c5c0b3bd504 100644 --- a/api/Rendering_WebGPU_VolumePass.html +++ b/api/Rendering_WebGPU_VolumePass.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebGPU_VolumePassFSQ.html b/api/Rendering_WebGPU_VolumePassFSQ.html index ef276036d53..cc4527f767e 100644 --- a/api/Rendering_WebGPU_VolumePassFSQ.html +++ b/api/Rendering_WebGPU_VolumePassFSQ.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Rendering_WebXR_RenderWindowHelper.html b/api/Rendering_WebXR_RenderWindowHelper.html index 4926fb82989..3b30fe79dd9 100644 --- a/api/Rendering_WebXR_RenderWindowHelper.html +++ b/api/Rendering_WebXR_RenderWindowHelper.html @@ -48,8 +48,8 @@ - - + + @@ -198,7 +198,7 @@

    diff --git a/api/Testing_Examples_ActorSerialization.html b/api/Testing_Examples_ActorSerialization.html index 57fb15ee6dd..030463a22e4 100644 --- a/api/Testing_Examples_ActorSerialization.html +++ b/api/Testing_Examples_ActorSerialization.html @@ -48,8 +48,8 @@ - - + + @@ -116,7 +116,7 @@

    ActorSerialization

    Source

    diff --git a/api/Testing_Examples_PipelineExecution.html b/api/Testing_Examples_PipelineExecution.html index b6cf78dd7ca..accfdeafb0f 100644 --- a/api/Testing_Examples_PipelineExecution.html +++ b/api/Testing_Examples_PipelineExecution.html @@ -48,8 +48,8 @@ - - + + @@ -116,7 +116,7 @@

    PipelineExecution

    Source

    diff --git a/api/Testing_Examples_PolyDataSerialization.html b/api/Testing_Examples_PolyDataSerialization.html index 2a01c30e7c2..fb8704cab37 100644 --- a/api/Testing_Examples_PolyDataSerialization.html +++ b/api/Testing_Examples_PolyDataSerialization.html @@ -48,8 +48,8 @@ - - + + @@ -116,7 +116,7 @@

    PolyDataSerialization

    Source

    diff --git a/api/Testing_Examples_StandaloneSceneLoader.html b/api/Testing_Examples_StandaloneSceneLoader.html index 1df25411e17..5854d2a3f14 100644 --- a/api/Testing_Examples_StandaloneSceneLoader.html +++ b/api/Testing_Examples_StandaloneSceneLoader.html @@ -48,8 +48,8 @@ - - + + @@ -116,7 +116,7 @@

    StandaloneSceneLoader

    Source

    diff --git a/api/Testing_Examples_WindTunnel.html b/api/Testing_Examples_WindTunnel.html index afef5412832..9a85bf891ba 100644 --- a/api/Testing_Examples_WindTunnel.html +++ b/api/Testing_Examples_WindTunnel.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Core_AbstractWidget.html b/api/Widgets_Core_AbstractWidget.html index b93054c4235..0fbbcd60d3a 100644 --- a/api/Widgets_Core_AbstractWidget.html +++ b/api/Widgets_Core_AbstractWidget.html @@ -48,8 +48,8 @@ - - + + @@ -372,7 +372,7 @@

    diff --git a/api/Widgets_Core_AbstractWidgetFactory.html b/api/Widgets_Core_AbstractWidgetFactory.html index cd57c2c9fa8..730697690a6 100644 --- a/api/Widgets_Core_AbstractWidgetFactory.html +++ b/api/Widgets_Core_AbstractWidgetFactory.html @@ -48,8 +48,8 @@ - - + + @@ -344,7 +344,7 @@

    diff --git a/api/Widgets_Core_StateBuilder.html b/api/Widgets_Core_StateBuilder.html index 47c359c588b..6b9b30bc214 100644 --- a/api/Widgets_Core_StateBuilder.html +++ b/api/Widgets_Core_StateBuilder.html @@ -48,8 +48,8 @@ - - + + @@ -132,7 +132,7 @@

    diff --git a/api/Widgets_Core_WidgetManager.html b/api/Widgets_Core_WidgetManager.html index 252b834f9a4..019a82056a5 100644 --- a/api/Widgets_Core_WidgetManager.html +++ b/api/Widgets_Core_WidgetManager.html @@ -48,8 +48,8 @@ - - + + @@ -335,7 +335,7 @@

    diff --git a/api/Widgets_Core_WidgetState.html b/api/Widgets_Core_WidgetState.html index 2afb2f395fa..1242d5030e7 100644 --- a/api/Widgets_Core_WidgetState.html +++ b/api/Widgets_Core_WidgetState.html @@ -48,8 +48,8 @@ - - + + @@ -259,7 +259,7 @@

    diff --git a/api/Widgets_Manipulators_AbstractManipulator.html b/api/Widgets_Manipulators_AbstractManipulator.html index 2009cc7b951..2675439a8e0 100644 --- a/api/Widgets_Manipulators_AbstractManipulator.html +++ b/api/Widgets_Manipulators_AbstractManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -587,7 +587,7 @@

    diff --git a/api/Widgets_Manipulators_CPRManipulator.html b/api/Widgets_Manipulators_CPRManipulator.html index 21311e0e296..1834ed919e0 100644 --- a/api/Widgets_Manipulators_CPRManipulator.html +++ b/api/Widgets_Manipulators_CPRManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Manipulators_LineManipulator.html b/api/Widgets_Manipulators_LineManipulator.html index 9da750844ba..0aae6e58726 100644 --- a/api/Widgets_Manipulators_LineManipulator.html +++ b/api/Widgets_Manipulators_LineManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -195,7 +195,7 @@

    diff --git a/api/Widgets_Manipulators_PickerManipulator.html b/api/Widgets_Manipulators_PickerManipulator.html index 50fab791e2d..aa53c73ef15 100644 --- a/api/Widgets_Manipulators_PickerManipulator.html +++ b/api/Widgets_Manipulators_PickerManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -149,7 +149,7 @@

    - + PrevNext diff --git a/api/Widgets_Manipulators_PlaneManipulator.html b/api/Widgets_Manipulators_PlaneManipulator.html index eb32fca7900..e1647dfde08 100644 --- a/api/Widgets_Manipulators_PlaneManipulator.html +++ b/api/Widgets_Manipulators_PlaneManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -195,7 +195,7 @@

    diff --git a/api/Widgets_Manipulators_TrackballManipulator.html b/api/Widgets_Manipulators_TrackballManipulator.html index 6ad3171f6a3..4fae73937fe 100644 --- a/api/Widgets_Manipulators_TrackballManipulator.html +++ b/api/Widgets_Manipulators_TrackballManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -207,7 +207,7 @@

    diff --git a/api/Widgets_Representations_ArrowHandleRepresentation.html b/api/Widgets_Representations_ArrowHandleRepresentation.html index d5196bb8ebb..b50b303df4e 100644 --- a/api/Widgets_Representations_ArrowHandleRepresentation.html +++ b/api/Widgets_Representations_ArrowHandleRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_CircleContextRepresentation.html b/api/Widgets_Representations_CircleContextRepresentation.html index 3801eef8fc8..4b66174a279 100644 --- a/api/Widgets_Representations_CircleContextRepresentation.html +++ b/api/Widgets_Representations_CircleContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_ContextRepresentation.html b/api/Widgets_Representations_ContextRepresentation.html index 39af071d4be..5d675780226 100644 --- a/api/Widgets_Representations_ContextRepresentation.html +++ b/api/Widgets_Representations_ContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_ConvexFaceContextRepresentation.html b/api/Widgets_Representations_ConvexFaceContextRepresentation.html index 58ce1d1993d..20e7b599e99 100644 --- a/api/Widgets_Representations_ConvexFaceContextRepresentation.html +++ b/api/Widgets_Representations_ConvexFaceContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_CroppingOutlineRepresentation.html b/api/Widgets_Representations_CroppingOutlineRepresentation.html index 6984975cc09..94a9ee0291d 100644 --- a/api/Widgets_Representations_CroppingOutlineRepresentation.html +++ b/api/Widgets_Representations_CroppingOutlineRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_CubeHandleRepresentation.html b/api/Widgets_Representations_CubeHandleRepresentation.html index 43fcd038ae3..c05177e1d7d 100644 --- a/api/Widgets_Representations_CubeHandleRepresentation.html +++ b/api/Widgets_Representations_CubeHandleRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_GlyphRepresentation.html b/api/Widgets_Representations_GlyphRepresentation.html index 24fd4b7d632..2f595e87903 100644 --- a/api/Widgets_Representations_GlyphRepresentation.html +++ b/api/Widgets_Representations_GlyphRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_HandleRepresentation.html b/api/Widgets_Representations_HandleRepresentation.html index 159fd4be8c7..dd952396fcb 100644 --- a/api/Widgets_Representations_HandleRepresentation.html +++ b/api/Widgets_Representations_HandleRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_ImplicitPlaneRepresentation.html b/api/Widgets_Representations_ImplicitPlaneRepresentation.html index 23e93e17afe..3d3aca1f66a 100644 --- a/api/Widgets_Representations_ImplicitPlaneRepresentation.html +++ b/api/Widgets_Representations_ImplicitPlaneRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_LineHandleRepresentation.html b/api/Widgets_Representations_LineHandleRepresentation.html index 64991c99058..597ca350670 100644 --- a/api/Widgets_Representations_LineHandleRepresentation.html +++ b/api/Widgets_Representations_LineHandleRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_OutlineContextRepresentation.html b/api/Widgets_Representations_OutlineContextRepresentation.html index 2298c146e8a..34a4c746c23 100644 --- a/api/Widgets_Representations_OutlineContextRepresentation.html +++ b/api/Widgets_Representations_OutlineContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_PolyLineRepresentation.html b/api/Widgets_Representations_PolyLineRepresentation.html index 4519c35f071..8c02b8aefe6 100644 --- a/api/Widgets_Representations_PolyLineRepresentation.html +++ b/api/Widgets_Representations_PolyLineRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_RectangleContextRepresentation.html b/api/Widgets_Representations_RectangleContextRepresentation.html index f20f9d7dd76..45fc39b7b12 100644 --- a/api/Widgets_Representations_RectangleContextRepresentation.html +++ b/api/Widgets_Representations_RectangleContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_SphereContextRepresentation.html b/api/Widgets_Representations_SphereContextRepresentation.html index 9bdc43208e6..e741d87bedf 100644 --- a/api/Widgets_Representations_SphereContextRepresentation.html +++ b/api/Widgets_Representations_SphereContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_SphereHandleRepresentation.html b/api/Widgets_Representations_SphereHandleRepresentation.html index a89deb306db..2359a7fffe7 100644 --- a/api/Widgets_Representations_SphereHandleRepresentation.html +++ b/api/Widgets_Representations_SphereHandleRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_SplineContextRepresentation.html b/api/Widgets_Representations_SplineContextRepresentation.html index 4f3dee87563..cedf48f5167 100644 --- a/api/Widgets_Representations_SplineContextRepresentation.html +++ b/api/Widgets_Representations_SplineContextRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -117,7 +117,7 @@

    diff --git a/api/Widgets_Representations_WidgetRepresentation.html b/api/Widgets_Representations_WidgetRepresentation.html index fa8e511bc00..c2614c2fb7e 100644 --- a/api/Widgets_Representations_WidgetRepresentation.html +++ b/api/Widgets_Representations_WidgetRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -251,7 +251,7 @@

    diff --git a/api/Widgets_Widgets3D_AngleWidget.html b/api/Widgets_Widgets3D_AngleWidget.html index d86502d5b44..1510b94e600 100644 --- a/api/Widgets_Widgets3D_AngleWidget.html +++ b/api/Widgets_Widgets3D_AngleWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_EllipseWidget.html b/api/Widgets_Widgets3D_EllipseWidget.html index 04640512de4..e4adda33b00 100644 --- a/api/Widgets_Widgets3D_EllipseWidget.html +++ b/api/Widgets_Widgets3D_EllipseWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_ImageCroppingWidget.html b/api/Widgets_Widgets3D_ImageCroppingWidget.html index dc88c4d4b14..d01e52b584d 100644 --- a/api/Widgets_Widgets3D_ImageCroppingWidget.html +++ b/api/Widgets_Widgets3D_ImageCroppingWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/api/Widgets_Widgets3D_ImplicitPlaneWidget.html b/api/Widgets_Widgets3D_ImplicitPlaneWidget.html index f84f1bb33b3..7d1ef75186b 100644 --- a/api/Widgets_Widgets3D_ImplicitPlaneWidget.html +++ b/api/Widgets_Widgets3D_ImplicitPlaneWidget.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/api/Widgets_Widgets3D_InteractiveOrientationWidget.html b/api/Widgets_Widgets3D_InteractiveOrientationWidget.html index 523ed663938..e1b03ded9c5 100644 --- a/api/Widgets_Widgets3D_InteractiveOrientationWidget.html +++ b/api/Widgets_Widgets3D_InteractiveOrientationWidget.html @@ -48,8 +48,8 @@ - - + + @@ -199,7 +199,7 @@

    diff --git a/api/Widgets_Widgets3D_LabelWidget.html b/api/Widgets_Widgets3D_LabelWidget.html index 947272de1ab..01aa7fd810e 100644 --- a/api/Widgets_Widgets3D_LabelWidget.html +++ b/api/Widgets_Widgets3D_LabelWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_LineWidget.html b/api/Widgets_Widgets3D_LineWidget.html index 360b9fe2e2e..6f1c5f364be 100644 --- a/api/Widgets_Widgets3D_LineWidget.html +++ b/api/Widgets_Widgets3D_LineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -133,7 +133,7 @@

    diff --git a/api/Widgets_Widgets3D_PaintWidget.html b/api/Widgets_Widgets3D_PaintWidget.html index cb0d81a5d9a..3515bb5996d 100644 --- a/api/Widgets_Widgets3D_PaintWidget.html +++ b/api/Widgets_Widgets3D_PaintWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_PolyLineWidget.html b/api/Widgets_Widgets3D_PolyLineWidget.html index cd3fcf7f865..8f03aa48ef0 100644 --- a/api/Widgets_Widgets3D_PolyLineWidget.html +++ b/api/Widgets_Widgets3D_PolyLineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_RectangleWidget.html b/api/Widgets_Widgets3D_RectangleWidget.html index b735060ae37..a162b761c82 100644 --- a/api/Widgets_Widgets3D_RectangleWidget.html +++ b/api/Widgets_Widgets3D_RectangleWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_ResliceCursorWidget.html b/api/Widgets_Widgets3D_ResliceCursorWidget.html index fe9d35df341..f786a4a73b1 100644 --- a/api/Widgets_Widgets3D_ResliceCursorWidget.html +++ b/api/Widgets_Widgets3D_ResliceCursorWidget.html @@ -48,8 +48,8 @@ - - + + @@ -175,7 +175,8 @@

    Source

    Constants.js
    import { ViewTypes } from 'vtk.js/Sources/Widgets/Core/WidgetManager/Constants';

    export const ScrollingMethods = {
    MIDDLE_MOUSE_BUTTON: 0,
    LEFT_MOUSE_BUTTON: 1,
    RIGHT_MOUSE_BUTTON: 2,
    };

    // Note: These strings are used in ResliceCursorWidget/behavior.js
    // as method's names
    export const InteractionMethodsName = {
    TranslateAxis: 'translateAxis',
    RotateLine: 'rotateLine',
    TranslateCenter: 'translateCenter',
    TranslateCenterAndUpdatePlanes: 'translateCenterAndUpdatePlanes',
    };

    export const defaultViewUpFromViewType = {
    [ViewTypes.YZ_PLANE]: [0, 0, 1], // Sagittal
    [ViewTypes.XZ_PLANE]: [0, 0, 1], // Coronal
    [ViewTypes.XY_PLANE]: [0, -1, 0], // Axial
    };

    export const xyzToViewType = [
    ViewTypes.YZ_PLANE,
    ViewTypes.XZ_PLANE,
    ViewTypes.XY_PLANE,
    ];

    export const viewTypeToXYZ = {
    [ViewTypes.YZ_PLANE]: 0,
    [ViewTypes.XZ_PLANE]: 1,
    [ViewTypes.XY_PLANE]: 2,
    };

    export const planeNames = ['X', 'Y', 'Z'];

    export const viewTypeToPlaneName = {
    [ViewTypes.YZ_PLANE]: 'X',
    [ViewTypes.XZ_PLANE]: 'Y',
    [ViewTypes.XY_PLANE]: 'Z',
    };

    export const planeNameToViewType = {
    X: ViewTypes.YZ_PLANE,
    Y: ViewTypes.XZ_PLANE,
    Z: ViewTypes.XY_PLANE,
    };
    export const lineNames = ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];

    export default {
    ScrollingMethods,
    InteractionMethodsName,
    xyzToViewType,
    viewTypeToXYZ,
    planeNames,
    viewTypeToPlaneName,
    planeNameToViewType,
    lineNames,
    };
    +

    Source

    Constants.d.ts
    import { ViewTypes } from '../../Core/WidgetManager/Constants';

    export declare enum ScrollingMethods {
    MIDDLE_MOUSE_BUTTON = 0,
    LEFT_MOUSE_BUTTON = 1,
    RIGHT_MOUSE_BUTTON = 2,
    }

    // Note: These strings are used in ResliceCursorWidget/behavior.js
    // as method's names
    export declare enum InteractionMethodsName {
    TranslateAxis = 'translateAxis',
    RotateLine = 'rotateLine',
    TranslateCenter = 'translateCenter',
    TranslateCenterAndUpdatePlanes = 'translateCenterAndUpdatePlanes',
    }

    export declare type defaultViewUpFromViewType = {
    [ViewTypes.YZ_PLANE]: [0, 0, 1], // Sagittal
    [ViewTypes.XZ_PLANE]: [0, 0, 1], // Coronal
    [ViewTypes.XY_PLANE]: [0, -1, 0], // Axial
    }

    export declare type xyzToViewType = [
    ViewTypes.YZ_PLANE,
    ViewTypes.XZ_PLANE,
    ViewTypes.XY_PLANE,
    ];

    export declare type viewTypeToXYZ = {
    [ViewTypes.YZ_PLANE]: 0,
    [ViewTypes.XZ_PLANE]: 1,
    [ViewTypes.XY_PLANE]: 2,
    }

    export declare type planeNames = ['X', 'Y', 'Z'];

    export declare type viewTypeToPlaneName = {
    [ViewTypes.YZ_PLANE]: 'X',
    [ViewTypes.XZ_PLANE]: 'Y',
    [ViewTypes.XY_PLANE]: 'Z',
    }

    export declare type planeNameToViewType = {
    X: ViewTypes.YZ_PLANE,
    Y: ViewTypes.XZ_PLANE,
    Z: ViewTypes.XY_PLANE,
    }
    export declare type lineNames = ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];

    declare const _default: {
    ScrollingMethods: typeof ScrollingMethods;
    InteractionMethodsName: typeof InteractionMethodsName;
    xyzToViewType: xyzToViewType;
    viewTypeToXYZ: viewTypeToXYZ;
    planeNames: planeNames;
    viewTypeToPlaneName: viewTypeToPlaneName;
    planeNameToViewType: planeNameToViewType;
    lineNames: lineNames;
    }

    export default _default;
    +
    Constants.js
    import { ViewTypes } from 'vtk.js/Sources/Widgets/Core/WidgetManager/Constants';

    export const ScrollingMethods = {
    MIDDLE_MOUSE_BUTTON: 0,
    LEFT_MOUSE_BUTTON: 1,
    RIGHT_MOUSE_BUTTON: 2,
    };

    // Note: These strings are used in ResliceCursorWidget/behavior.js
    // as method's names
    export const InteractionMethodsName = {
    TranslateAxis: 'translateAxis',
    RotateLine: 'rotateLine',
    TranslateCenter: 'translateCenter',
    TranslateCenterAndUpdatePlanes: 'translateCenterAndUpdatePlanes',
    };

    export const defaultViewUpFromViewType = {
    [ViewTypes.YZ_PLANE]: [0, 0, 1], // Sagittal
    [ViewTypes.XZ_PLANE]: [0, 0, 1], // Coronal
    [ViewTypes.XY_PLANE]: [0, -1, 0], // Axial
    };

    export const xyzToViewType = [
    ViewTypes.YZ_PLANE,
    ViewTypes.XZ_PLANE,
    ViewTypes.XY_PLANE,
    ];

    export const viewTypeToXYZ = {
    [ViewTypes.YZ_PLANE]: 0,
    [ViewTypes.XZ_PLANE]: 1,
    [ViewTypes.XY_PLANE]: 2,
    };

    export const planeNames = ['X', 'Y', 'Z'];

    export const viewTypeToPlaneName = {
    [ViewTypes.YZ_PLANE]: 'X',
    [ViewTypes.XZ_PLANE]: 'Y',
    [ViewTypes.XY_PLANE]: 'Z',
    };

    export const planeNameToViewType = {
    X: ViewTypes.YZ_PLANE,
    Y: ViewTypes.XZ_PLANE,
    Z: ViewTypes.XY_PLANE,
    };
    export const lineNames = ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];

    export default {
    ScrollingMethods,
    InteractionMethodsName,
    xyzToViewType,
    viewTypeToXYZ,
    planeNames,
    viewTypeToPlaneName,
    planeNameToViewType,
    lineNames,
    };
    behavior.js
    import macro from 'vtk.js/Sources/macros';
    import vtkBoundingBox from 'vtk.js/Sources/Common/DataModel/BoundingBox';
    import vtkLine from 'vtk.js/Sources/Common/DataModel/Line';
    import * as vtkMath from 'vtk.js/Sources/Common/Core/Math';

    import {
    boundPointOnPlane,
    rotateVector,
    updateState,
    getOtherLineName,
    getLinePlaneName,
    getLineInPlaneName,
    getLineNames,
    } from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/helpers';

    import {
    ScrollingMethods,
    InteractionMethodsName,
    planeNameToViewType,
    } from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/Constants';

    export default function widgetBehavior(publicAPI, model) {
    model._isDragging = false;
    let isScrolling = false;
    let previousPosition;

    macro.setGet(publicAPI, model, [
    'keepOrthogonality',
    { type: 'object', name: 'cursorStyles' },
    ]);

    // Set default value for cursorStyles
    publicAPI.setCursorStyles({
    [InteractionMethodsName.TranslateCenter]: 'move',
    [InteractionMethodsName.RotateLine]: 'alias',
    [InteractionMethodsName.TranslateAxis]: 'pointer',
    default: 'default',
    });

    publicAPI.setEnableTranslation = (enable) => {
    model.representations[0].setPickable(enable); // line handle
    model.representations[2].setPickable(enable); // center handle
    };

    publicAPI.setEnableRotation = (enable) => {
    model.representations[1].setPickable(enable); // rotation handle
    };

    // FIXME: label information should be accessible from activeState instead of parent state.
    publicAPI.getActiveInteraction = () => {
    if (
    model.widgetState
    .getStatesWithLabel('rotation')
    .includes(model.activeState)
    ) {
    return InteractionMethodsName.RotateLine;
    }
    if (
    model.widgetState.getStatesWithLabel('line').includes(model.activeState)
    ) {
    return InteractionMethodsName.TranslateAxis;
    }
    if (
    model.widgetState.getStatesWithLabel('center').includes(model.activeState)
    ) {
    return InteractionMethodsName.TranslateCenter;
    }
    return null;
    };

    /**
    * ActiveState can be RotationHandle or a LineHandle
    * @returns 'YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ' or 'YinZ'
    */
    publicAPI.getActiveLineName = () =>
    getLineNames(model.widgetState).find((lineName) =>
    model.widgetState.getStatesWithLabel(lineName).includes(model.activeState)
    );

    // FIXME: label information should be accessible from activeState instead of parent state.
    publicAPI.getActiveLineHandle = () =>
    model.widgetState[`getAxis${publicAPI.getActiveLineName()}`]?.();

    /**
    * Return the line handle of the other line in the same view.
    * @param {string} lineName name of the line (YinX, ZinX, XinY, ZinY, XinZ, YinZ)
    * @returns ZinX if lineName == YinX, YinX if lineName == ZinX, ZinY if lineName == XinY...
    */
    publicAPI.getOtherLineHandle = (lineName) =>
    model.widgetState[
    `getAxis${getOtherLineName(model.widgetState, lineName)}`
    ]?.();

    // FIXME: label information should be accessible from activeState instead of parent state.
    /**
    * There are 2 rotation handles per axis: 'point0' and 'point1'.
    * This function returns which rotation handle (point0 or point1) is currently active.
    * ActiveState must be a RotationHandle.
    * @returns 'point0', 'point1' or null if no point is active (e.g. line is being rotated)
    */
    publicAPI.getActiveRotationPointName = () => {
    if (
    model.widgetState.getStatesWithLabel('point0').includes(model.activeState)
    ) {
    return 'point0';
    }
    if (
    model.widgetState.getStatesWithLabel('point1').includes(model.activeState)
    ) {
    return 'point1';
    }
    return null;
    };

    publicAPI.startScrolling = (newPosition) => {
    if (newPosition) {
    previousPosition = newPosition;
    }
    isScrolling = true;
    publicAPI.startInteraction();
    };

    publicAPI.endScrolling = () => {
    isScrolling = false;
    publicAPI.endInteraction();
    };

    publicAPI.updateCursor = () => {
    const cursorStyles = publicAPI.getCursorStyles();
    if (cursorStyles) {
    switch (publicAPI.getActiveInteraction()) {
    case InteractionMethodsName.TranslateCenter:
    model._apiSpecificRenderWindow.setCursor(
    cursorStyles.translateCenter
    );
    break;
    case InteractionMethodsName.RotateLine:
    model._apiSpecificRenderWindow.setCursor(cursorStyles.rotateLine);
    break;
    case InteractionMethodsName.TranslateAxis:
    model._apiSpecificRenderWindow.setCursor(cursorStyles.translateAxis);
    break;
    default:
    model._apiSpecificRenderWindow.setCursor(cursorStyles.default);
    break;
    }
    }
    };

    publicAPI.handleLeftButtonPress = (callData) => {
    if (model.activeState && model.activeState.getActive()) {
    model._isDragging = true;
    const viewType = model.viewType;
    const currentPlaneNormal = model.widgetState.getPlanes()[viewType].normal;
    const manipulator =
    model.activeState?.getManipulator?.() ?? model.manipulator;
    manipulator.setWidgetOrigin(model.widgetState.getCenter());
    manipulator.setWidgetNormal(currentPlaneNormal);
    const { worldCoords } = manipulator.handleEvent(
    callData,
    model._apiSpecificRenderWindow
    );
    previousPosition = worldCoords;

    publicAPI.startInteraction();
    } else if (
    model.widgetState.getScrollingMethod() ===
    ScrollingMethods.LEFT_MOUSE_BUTTON
    ) {
    publicAPI.startScrolling(callData.position);
    } else {
    return macro.VOID;
    }

    return macro.EVENT_ABORT;
    };

    publicAPI.handleMouseMove = (callData) => {
    if (model._isDragging) {
    return publicAPI.handleEvent(callData);
    }
    if (isScrolling) {
    if (previousPosition.y !== callData.position.y) {
    const step = previousPosition.y - callData.position.y;
    publicAPI.translateCenterOnPlaneDirection(step);
    previousPosition = callData.position;

    publicAPI.invokeInternalInteractionEvent();
    }
    }
    return macro.VOID;
    };

    publicAPI.handleLeftButtonRelease = () => {
    if (model._isDragging || isScrolling) {
    publicAPI.endScrolling();
    }
    model._isDragging = false;
    model.widgetState.deactivate();
    };

    publicAPI.handleRightButtonPress = (calldata) => {
    if (
    model.widgetState.getScrollingMethod() ===
    ScrollingMethods.RIGHT_MOUSE_BUTTON
    ) {
    publicAPI.startScrolling(calldata.position);
    }
    };

    publicAPI.handleRightButtonRelease = () => {
    if (
    model.widgetState.getScrollingMethod() ===
    ScrollingMethods.RIGHT_MOUSE_BUTTON
    ) {
    publicAPI.endScrolling();
    }
    };

    publicAPI.handleStartMouseWheel = () => {
    publicAPI.startInteraction();
    };

    publicAPI.handleMouseWheel = (calldata) => {
    const step = calldata.spinY;
    isScrolling = true;
    publicAPI.translateCenterOnPlaneDirection(step);

    publicAPI.invokeInternalInteractionEvent();
    isScrolling = false;

    return macro.EVENT_ABORT;
    };

    publicAPI.handleEndMouseWheel = () => {
    publicAPI.endScrolling();
    };

    publicAPI.handleMiddleButtonPress = (calldata) => {
    if (
    model.widgetState.getScrollingMethod() ===
    ScrollingMethods.MIDDLE_MOUSE_BUTTON
    ) {
    publicAPI.startScrolling(calldata.position);
    }
    };

    publicAPI.handleMiddleButtonRelease = () => {
    if (
    model.widgetState.getScrollingMethod() ===
    ScrollingMethods.MIDDLE_MOUSE_BUTTON
    ) {
    publicAPI.endScrolling();
    }
    };

    publicAPI.handleEvent = (callData) => {
    if (model.activeState.getActive()) {
    publicAPI[publicAPI.getActiveInteraction()](callData);
    publicAPI.invokeInternalInteractionEvent();
    return macro.EVENT_ABORT;
    }
    return macro.VOID;
    };

    publicAPI.invokeInternalInteractionEvent = () => {
    const methodName = publicAPI.getActiveInteraction();
    const computeFocalPointOffset =
    methodName !== InteractionMethodsName.RotateLine;
    const canUpdateFocalPoint =
    methodName === InteractionMethodsName.RotateLine;
    publicAPI.invokeInteractionEvent({
    computeFocalPointOffset,
    canUpdateFocalPoint,
    });
    };

    publicAPI.startInteraction = () => {
    publicAPI.invokeStartInteractionEvent();
    // When interacting, plane actor and lines must be re-rendered on other views
    publicAPI.getViewWidgets().forEach((viewWidget) => {
    viewWidget.getInteractor().requestAnimation(publicAPI);
    });
    };

    publicAPI.endInteraction = () => {
    publicAPI.invokeEndInteractionEvent();
    publicAPI.getViewWidgets().forEach((viewWidget) => {
    viewWidget.getInteractor().cancelAnimation(publicAPI);
    });
    };

    publicAPI.translateCenterOnPlaneDirection = (nbSteps) => {
    const dirProj = model.widgetState.getPlanes()[model.viewType].normal;

    const oldCenter = model.widgetState.getCenter();
    const image = model.widgetState.getImage();
    const imageSpacing = image.getSpacing();

    // Use Chebyshev norm
    // https://math.stackexchange.com/questions/71423/what-is-the-term-for-the-projection-of-a-vector-onto-the-unit-cube
    const absDirProj = dirProj.map((value) => Math.abs(value));
    const index = absDirProj.indexOf(Math.max(...absDirProj));
    const movingFactor =
    (nbSteps * imageSpacing[index]) / Math.abs(dirProj[index]);

    // Define the potentially new center
    let newCenter = [
    oldCenter[0] + movingFactor * dirProj[0],
    oldCenter[1] + movingFactor * dirProj[1],
    oldCenter[2] + movingFactor * dirProj[2],
    ];
    newCenter = publicAPI.getBoundedCenter(newCenter);

    model.widgetState.setCenter(newCenter);
    updateState(
    model.widgetState,
    model._factory.getScaleInPixels(),
    model._factory.getRotationHandlePosition()
    );
    };

    publicAPI[InteractionMethodsName.TranslateAxis] = (calldata) => {
    const lineHandle = publicAPI.getActiveLineHandle();
    const lineName = publicAPI.getActiveLineName();
    const pointOnLine = vtkMath.add(
    lineHandle.getOrigin(),
    lineHandle.getDirection(),
    []
    );
    const currentLineVector = lineHandle.getDirection();
    vtkMath.normalize(currentLineVector);

    // Translate the current line along the other line
    const otherLineHandle = publicAPI.getOtherLineHandle(lineName);
    const center = model.widgetState.getCenter();
    const manipulator =
    model.activeState?.getManipulator?.() ?? model.manipulator;
    let worldCoords = null;
    let newOrigin = [];
    if (model.activeState?.getManipulator?.()) {
    worldCoords = manipulator.handleEvent(
    calldata,
    model._apiSpecificRenderWindow
    ).worldCoords;
    const translation = vtkMath.subtract(worldCoords, previousPosition, []);
    vtkMath.add(center, translation, newOrigin);
    } else if (otherLineHandle) {
    const otherLineVector = otherLineHandle.getDirection();
    vtkMath.normalize(otherLineVector);
    const axisTranslation = otherLineVector;

    const dot = vtkMath.dot(currentLineVector, otherLineVector);
    // lines are colinear, translate along perpendicular axis from current line
    if (dot === 1 || dot === -1) {
    vtkMath.cross(
    currentLineVector,
    manipulator.getWidgetNormal(),
    axisTranslation
    );
    }

    const closestPoint = [];
    worldCoords = manipulator.handleEvent(
    calldata,
    model._apiSpecificRenderWindow
    ).worldCoords;
    vtkLine.distanceToLine(
    worldCoords,
    lineHandle.getOrigin(),
    pointOnLine,
    closestPoint
    );

    const translationVector = vtkMath.subtract(worldCoords, closestPoint, []);
    const translationDistance = vtkMath.dot(
    translationVector,
    axisTranslation
    );

    newOrigin = vtkMath.multiplyAccumulate(
    center,
    axisTranslation,
    translationDistance,
    newOrigin
    );
    }
    newOrigin = publicAPI.getBoundedCenter(newOrigin);
    model.widgetState.setCenter(newOrigin);
    updateState(
    model.widgetState,
    model._factory.getScaleInPixels(),
    model._factory.getRotationHandlePosition()
    );
    previousPosition = worldCoords;
    };

    publicAPI.getBoundedCenter = (newCenter) => {
    const oldCenter = model.widgetState.getCenter();
    const imageBounds = model.widgetState.getImage().getBounds();

    if (vtkBoundingBox.containsPoint(imageBounds, ...newCenter)) {
    return newCenter;
    }

    return boundPointOnPlane(newCenter, oldCenter, imageBounds);
    };

    publicAPI[InteractionMethodsName.TranslateCenter] = (calldata) => {
    const manipulator =
    model.activeState?.getManipulator?.() ?? model.manipulator;
    const { worldCoords } = manipulator.handleEvent(
    calldata,
    model._apiSpecificRenderWindow
    );
    const translation = vtkMath.subtract(worldCoords, previousPosition, []);
    previousPosition = worldCoords;
    let newCenter = vtkMath.add(model.widgetState.getCenter(), translation, []);
    newCenter = publicAPI.getBoundedCenter(newCenter);
    model.widgetState.setCenter(newCenter);
    updateState(
    model.widgetState,
    model._factory.getScaleInPixels(),
    model._factory.getRotationHandlePosition()
    );
    };

    publicAPI[InteractionMethodsName.RotateLine] = (calldata) => {
    const activeLineHandle = publicAPI.getActiveLineHandle();
    const manipulator =
    model.activeState?.getManipulator?.() ?? model.manipulator;
    const planeNormal = manipulator.getWidgetNormal();
    const { worldCoords } = manipulator.handleEvent(
    calldata,
    model._apiSpecificRenderWindow
    );

    if (!worldCoords || !worldCoords.length) {
    return;
    }
    const center = model.widgetState.getCenter();
    const currentVectorToOrigin = [0, 0, 0];
    vtkMath.subtract(worldCoords, center, currentVectorToOrigin);
    vtkMath.normalize(currentVectorToOrigin);

    const previousLineDirection = activeLineHandle.getDirection();
    vtkMath.normalize(previousLineDirection);
    const activePointName = publicAPI.getActiveRotationPointName();
    if (
    activePointName === 'point1' ||
    (!activePointName &&
    vtkMath.dot(currentVectorToOrigin, previousLineDirection) < 0)
    ) {
    vtkMath.multiplyScalar(previousLineDirection, -1);
    }

    const radianAngle = vtkMath.signedAngleBetweenVectors(
    previousLineDirection,
    currentVectorToOrigin,
    planeNormal
    );

    publicAPI.rotateLineInView(publicAPI.getActiveLineName(), radianAngle);
    };

    /**
    * Rotate a line by a specified angle
    * @param {string} lineName The line name to rotate (e.g. YinX, ZinX, XinY, ZinY, XinZ, YinZ)
    * @param {Number} radianAngle Applied angle in radian
    */
    publicAPI.rotateLineInView = (lineName, radianAngle) => {
    const viewType = planeNameToViewType[getLinePlaneName(lineName)];
    const inViewType = planeNameToViewType[getLineInPlaneName(lineName)];
    const planeNormal = model.widgetState.getPlanes()[inViewType].normal;
    publicAPI.rotatePlane(viewType, radianAngle, planeNormal);

    if (publicAPI.getKeepOrthogonality()) {
    const otherLineName = getOtherLineName(model.widgetState, lineName);
    const otherPlaneName = getLinePlaneName(otherLineName);
    publicAPI.rotatePlane(
    planeNameToViewType[otherPlaneName],
    radianAngle,
    planeNormal
    );
    }
    updateState(
    model.widgetState,
    model._factory.getScaleInPixels(),
    model._factory.getRotationHandlePosition()
    );
    };

    /**
    * Rotate a specified plane around an other specified plane.
    * @param {ViewTypes} viewType Define which plane will be rotated
    * @param {Number} radianAngle Applied angle in radian
    * @param {vec3} planeNormal Define the axis to rotate around
    */
    publicAPI.rotatePlane = (viewType, radianAngle, planeNormal) => {
    const { normal, viewUp } = model.widgetState.getPlanes()[viewType];
    const newNormal = rotateVector(normal, planeNormal, radianAngle);
    const newViewUp = rotateVector(viewUp, planeNormal, radianAngle);

    model.widgetState.getPlanes()[viewType] = {
    normal: newNormal,
    viewUp: newViewUp,
    };
    };

    // --------------------------------------------------------------------------
    // initialization
    // --------------------------------------------------------------------------
    }
    cprBehavior.js
    import resliceCursorBehavior from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/behavior';
    import { InteractionMethodsName } from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/Constants';
    import { updateState } from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/helpers';
    import { ViewTypes } from 'vtk.js/Sources/Widgets/Core/WidgetManager/Constants';
    import { vec3 } from 'gl-matrix';
    // import macro from 'vtk.js/Sources/macros';

    export default function widgetBehavior(publicAPI, model) {
    // We inherit resliceCursorBehavior
    resliceCursorBehavior(publicAPI, model);

    const stretchPlaneName = 'Y';
    const crossPlaneName = 'Z';

    publicAPI.getActiveInteraction = () => {
    if (
    model.widgetState
    .getStatesWithLabel(`lineIn${stretchPlaneName}`)
    .includes(model.activeState)
    ) {
    return InteractionMethodsName.TranslateCenterAndUpdatePlanes;
    }
    if (
    model.widgetState
    .getStatesWithLabel(`lineIn${crossPlaneName}`)
    .includes(model.activeState) ||
    model.widgetState
    .getStatesWithLabel(`rotationIn${crossPlaneName}`)
    .includes(model.activeState)
    ) {
    return InteractionMethodsName.RotateLine;
    }
    return null;
    };

    publicAPI[InteractionMethodsName.TranslateCenterAndUpdatePlanes] = (
    calldata
    ) => {
    const manipulator =
    model.activeState?.getManipulator?.() ?? model.manipulator;

    const { worldCoords, worldDirection } = manipulator.handleEvent(
    calldata,
    model._apiSpecificRenderWindow
    );
    publicAPI.updateCenterAndPlanes(worldCoords, worldDirection);
    };

    publicAPI.updateCenterAndPlanes = (worldCoords, worldDirection) => {
    // Update center
    const newBoundedCenter = publicAPI.getBoundedCenter(worldCoords);
    model.widgetState.setCenter(newBoundedCenter);

    // Update planes if axes are given
    if (worldDirection) {
    const getAxis = (idx) =>
    vec3.normalize([], worldDirection.slice(3 * idx, 3 * idx + 3));
    const planes = model.widgetState.getPlanes();
    Object.keys(planes).forEach((viewType) => {
    switch (Number.parseInt(viewType, 10)) {
    case ViewTypes.YZ_PLANE:
    planes[viewType] = {
    normal: getAxis(0),
    viewUp: getAxis(2),
    };
    break;
    case ViewTypes.XZ_PLANE:
    planes[viewType] = {
    normal: getAxis(1),
    viewUp: getAxis(2),
    };
    break;
    case ViewTypes.XY_PLANE:
    planes[viewType] = {
    normal: getAxis(2),
    viewUp: getAxis(1),
    };
    break;
    default:
    break;
    }
    });
    }

    updateState(
    model.widgetState,
    model._factory.getScaleInPixels(),
    model._factory.getRotationHandlePosition()
    );
    };

    publicAPI.translateCenterOnPlaneDirection = (nbSteps) => {
    const handleScroll = model._factory.getManipulator()?.handleScroll;
    if (handleScroll) {
    const { worldCoords, worldDirection } = handleScroll(nbSteps);
    publicAPI.updateCenterAndPlanes(worldCoords, worldDirection);
    }
    };
    }
    helpers.js
    import vtkBoundingBox, {
    STATIC,
    } from 'vtk.js/Sources/Common/DataModel/BoundingBox';
    import vtkCubeSource from 'vtk.js/Sources/Filters/Sources/CubeSource';
    import vtkCutter from 'vtk.js/Sources/Filters/Core/Cutter';
    import vtkPlane from 'vtk.js/Sources/Common/DataModel/Plane';
    import * as vtkMath from 'vtk.js/Sources/Common/Core/Math';
    import vtkMatrixBuilder from 'vtk.js/Sources/Common/Core/MatrixBuilder';

    import {
    planeNames,
    planeNameToViewType,
    viewTypeToPlaneName,
    } from 'vtk.js/Sources/Widgets/Widgets3D/ResliceCursorWidget/Constants';

    const EPSILON = 10e-7;

    /**
    * Fit the plane defined by origin, p1, p2 onto the bounds.
    * Plane is untouched if does not intersect bounds.
    * @param {Array} bounds
    * @param {Array} origin
    * @param {Array} p1
    * @param {Array} p2
    * @return {Boolean} false if no bounds have been found, else true
    */
    export function boundPlane(bounds, origin, p1, p2) {
    const v1 = [];
    vtkMath.subtract(p1, origin, v1);
    vtkMath.normalize(v1);

    const v2 = [];
    vtkMath.subtract(p2, origin, v2);
    vtkMath.normalize(v2);

    const n = [0, 0, 1];
    vtkMath.cross(v1, v2, n);
    vtkMath.normalize(n);

    // Inflate bounds in order to avoid precision error when cutting cubesource
    const inflatedBounds = [...bounds];
    const eps = [...n];
    vtkMath.multiplyScalar(eps, EPSILON);
    vtkBoundingBox.addBounds(
    inflatedBounds,
    bounds[0] + eps[0],
    bounds[1] + eps[0],
    bounds[2] + eps[1],
    bounds[3] + eps[1],
    bounds[4] + eps[2],
    bounds[5] + eps[2]
    );
    vtkBoundingBox.addBounds(
    inflatedBounds,
    bounds[0] - eps[0],
    bounds[1] - eps[0],
    bounds[2] - eps[1],
    bounds[3] - eps[1],
    bounds[4] - eps[2],
    bounds[5] - eps[2]
    );

    const plane = vtkPlane.newInstance();
    plane.setOrigin(...origin);
    plane.setNormal(...n);

    const cubeSource = vtkCubeSource.newInstance();
    cubeSource.setBounds(inflatedBounds);

    const cutter = vtkCutter.newInstance();
    cutter.setCutFunction(plane);
    cutter.setInputConnection(cubeSource.getOutputPort());

    const cutBounds = cutter.getOutputData();
    if (cutBounds.getNumberOfPoints() === 0) {
    return false;
    }
    const localBounds = STATIC.computeLocalBounds(
    cutBounds.getPoints(),
    v1,
    v2,
    n
    );
    for (let i = 0; i < 3; i += 1) {
    origin[i] =
    localBounds[0] * v1[i] + localBounds[2] * v2[i] + localBounds[4] * n[i];
    p1[i] =
    localBounds[1] * v1[i] + localBounds[2] * v2[i] + localBounds[4] * n[i];
    p2[i] =
    localBounds[0] * v1[i] + localBounds[3] * v2[i] + localBounds[4] * n[i];
    }
    return true;
    }
    // Project point (inPoint) to the bounds of the image according to a plane
    // defined by two vectors (v1, v2)
    export function boundPoint(inPoint, v1, v2, bounds) {
    const absT1 = v1.map((val) => Math.abs(val));
    const absT2 = v2.map((val) => Math.abs(val));

    let o1 = 0.0;
    let o2 = 0.0;

    for (let i = 0; i < 3; i++) {
    let axisOffset = 0;

    const useT1 = absT1[i] > absT2[i];
    const t = useT1 ? v1 : v2;
    const absT = useT1 ? absT1 : absT2;

    if (inPoint[i] < bounds[i * 2]) {
    axisOffset = absT[i] > EPSILON ? (bounds[2 * i] - inPoint[i]) / t[i] : 0;
    } else if (inPoint[i] > bounds[2 * i + 1]) {
    axisOffset =
    absT[i] > EPSILON ? (bounds[2 * i + 1] - inPoint[i]) / t[i] : 0;
    }

    if (useT1) {
    if (Math.abs(axisOffset) > Math.abs(o1)) {
    o1 = axisOffset;
    }
    } else if (Math.abs(axisOffset) > Math.abs(o2)) {
    o2 = axisOffset;
    }
    }

    const outPoint = [inPoint[0], inPoint[1], inPoint[2]];

    if (o1 !== 0.0) {
    vtkMath.multiplyAccumulate(outPoint, v1, o1, outPoint);
    }
    if (o2 !== 0.0) {
    vtkMath.multiplyAccumulate(outPoint, v2, o2, outPoint);
    }

    return outPoint;
    }

    // Compute the intersection between p1 and p2 on bounds
    export function boundPointOnPlane(p1, p2, bounds) {
    const dir12 = [0, 0, 0];
    vtkMath.subtract(p2, p1, dir12);

    const out = [0, 0, 0];
    const tolerance = [0, 0, 0];
    vtkBoundingBox.intersectBox(bounds, p1, dir12, out, tolerance);

    return out;
    }

    /**
    * Rotates a vector around another.
    * @param {vec3} vectorToBeRotated Vector to rate
    * @param {vec3} axis Axis to rotate around
    * @param {Number} angle Angle in radian
    * @returns The rotated vector
    */
    export function rotateVector(vectorToBeRotated, axis, angle) {
    const rotatedVector = [...vectorToBeRotated];
    vtkMatrixBuilder.buildFromRadian().rotate(angle, axis).apply(rotatedVector);
    return rotatedVector;
    }

    /**
    * Return ['X', 'Y'] if there are only 2 planes defined in the widget state.
    * Return ['X', 'Y', 'Z'] if there are 3 planes defined in the widget state.
    * @param {object} widgetState the state of the widget
    * @returns An array of plane names
    */
    export function getPlaneNames(widgetState) {
    return Object.keys(widgetState.getPlanes()).map(
    (viewType) => viewTypeToPlaneName[viewType]
    );
    }

    /**
    * Return X if lineName == XinY|XinZ, Y if lineName == YinX|YinZ and Z otherwise
    * @param {string} lineName name of the line (YinX, ZinX, XinY, ZinY, XinZ, YinZ)
    */
    export function getLinePlaneName(lineName) {
    return lineName[0];
    }
    /**
    * Return X if lineName == YinX|ZinX, Y if lineName == XinY|ZinY and Z otherwise
    * @param {string} lineName name of the line (YinX, ZinX, XinY, ZinY, XinZ, YinZ)
    */
    export function getLineInPlaneName(lineName) {
    return lineName[3];
    }

    /**
    * Returns ['XinY', 'YinX'] if planes == ['X', 'Y']
    * ['XinY', 'XinZ', 'YinX', 'YinZ', 'ZinX', 'ZinY'] if planes == ['X', 'Y', 'Z']
    * @param {string} planes name of the planes (e.g. ['X', 'Y'])
    */
    export function getPlanesLineNames(planes = planeNames) {
    const lines = [];
    planes.forEach((plane) => {
    planes.forEach((inPlane) => {
    if (plane !== inPlane) {
    lines.push(`${plane}in${inPlane}`);
    }
    });
    });
    return lines;
    }

    export function getLineNames(widgetState) {
    const planes = Object.keys(widgetState.getPlanes()).map(
    (viewType) => viewTypeToPlaneName[viewType]
    );
    return getPlanesLineNames(planes);
    }

    /**
    * Return ZinX if lineName == YinX, YinX if lineName == ZinX, ZinY if lineName == XinY...
    * @param {string} lineName name of the line (YinX, ZinX, XinY, ZinY, XinZ, YinZ)
    */
    export function getOtherLineName(widgetState, lineName) {
    const linePlaneName = getLinePlaneName(lineName);
    const lineInPlaneName = getLineInPlaneName(lineName);
    const otherLineName = getPlaneNames(widgetState).find(
    (planeName) => planeName !== linePlaneName && planeName !== lineInPlaneName
    );
    return `${otherLineName}in${lineInPlaneName}`;
    }

    // Compute the offset of the rotation handle origin
    function computeRotationHandleOriginOffset(
    axis,
    rotationHandlePosition,
    volumeDiagonalLength,
    scaleInPixels
    ) {
    // FIXME: p1 and p2 could be placed on the exact boundaries of the volume.
    return vtkMath.multiplyScalar(
    [...axis],
    (rotationHandlePosition * (scaleInPixels ? 1 : volumeDiagonalLength)) / 2
    );
    }

    // Update the reslice cursor state according to the three planes normals and the origin
    export function updateState(
    widgetState,
    scaleInPixels,
    rotationHandlePosition
    ) {
    const planes = Object.keys(widgetState.getPlanes()).map(
    (viewType) => viewTypeToPlaneName[viewType]
    );
    // Generates an object as such:
    // axes = {'XY': cross(X, Y), 'YX': cross(X, Y), 'YZ': cross(Y, Z)...}
    const axes = planes.reduce((res, plane) => {
    planes
    .filter((otherPlane) => plane !== otherPlane)
    .forEach((otherPlane) => {
    const cross = vtkMath.cross(
    widgetState.getPlanes()[planeNameToViewType[plane]].normal,
    widgetState.getPlanes()[planeNameToViewType[otherPlane]].normal,
    []
    );
    res[`${plane}${otherPlane}`] = cross;
    res[`${otherPlane}${plane}`] = cross;
    });
    return res;
    }, {});

    const bounds = widgetState.getImage().getBounds();
    const center = widgetState.getCenter();

    // Length of the principal diagonal.
    const pdLength = vtkBoundingBox.getDiagonalLength(bounds);

    widgetState.getCenterHandle().setOrigin(center);

    getPlanesLineNames(planes).forEach((lineName) => {
    const planeName = getLinePlaneName(lineName);
    const inPlaneName = getLineInPlaneName(lineName);
    const direction = axes[`${planeName}${inPlaneName}`];
    widgetState[`getRotationHandle${lineName}0`]().setOrigin(center);
    widgetState[`getRotationHandle${lineName}0`]()
    .getManipulator()
    ?.setHandleOrigin(center);
    widgetState[`getRotationHandle${lineName}0`]()
    .getManipulator()
    ?.setHandleNormal(
    widgetState.getPlanes()[planeNameToViewType[planeName]].normal
    );
    widgetState[`getRotationHandle${lineName}0`]().setOffset(
    computeRotationHandleOriginOffset(
    direction,
    rotationHandlePosition,
    pdLength,
    scaleInPixels
    )
    );
    widgetState[`getRotationHandle${lineName}1`]().setOrigin(center);
    widgetState[`getRotationHandle${lineName}1`]()
    .getManipulator()
    ?.setHandleOrigin(center);
    widgetState[`getRotationHandle${lineName}1`]()
    .getManipulator()
    ?.setHandleNormal(
    widgetState.getPlanes()[planeNameToViewType[planeName]].normal
    );
    widgetState[`getRotationHandle${lineName}1`]().setOffset(
    computeRotationHandleOriginOffset(
    direction,
    -rotationHandlePosition,
    pdLength,
    scaleInPixels
    )
    );
    const lineHandle = widgetState[`getAxis${lineName}`]();
    lineHandle.setOrigin(center);
    lineHandle.getManipulator()?.setHandleOrigin(center);
    lineHandle
    .getManipulator()
    ?.setHandleNormal(
    widgetState.getPlanes()[planeNameToViewType[planeName]].normal
    );
    const scale = vtkMath.normalize(direction);
    const scale3 = lineHandle.getScale3();
    scale3[2] = 2 * scale;
    lineHandle.setScale3(scale3);
    const right =
    widgetState.getPlanes()[planeNameToViewType[inPlaneName]].normal;
    const up = vtkMath.cross(direction, right, []);
    lineHandle.setRight(right);
    lineHandle.setUp(up);
    lineHandle.setDirection(direction);
    });
    }

    /**
    * First rotate planeToTransform to match targetPlane normal.
    * Then rotate around targetNormal to enforce targetViewUp "up" vector (i.e. Origin->p2 ).
    * There is an infinite number of options to rotate a plane normal to another. Here we attempt to
    * preserve Origin, P1 and P2 when rotating around targetPlane.
    * @param {vtkPlaneSource} planeToTransform
    * @param {vec3} targetOrigin Center of the plane
    * @param {vec3} targetNormal Normal to state to the plane
    * @param {vec3} viewType Vector that enforces view up
    */
    export function transformPlane(
    planeToTransform,
    targetCenter,
    targetNormal,
    targetViewUp
    ) {
    planeToTransform.setNormal(targetNormal);
    const viewUp = vtkMath.subtract(
    planeToTransform.getPoint2(),
    planeToTransform.getOrigin(),
    []
    );
    const angle = vtkMath.signedAngleBetweenVectors(
    viewUp,
    targetViewUp,
    targetNormal
    );
    planeToTransform.rotate(angle, targetNormal);
    planeToTransform.setCenter(targetCenter);
    }
    @@ -185,7 +186,7 @@

    diff --git a/api/Widgets_Widgets3D_SeedWidget.html b/api/Widgets_Widgets3D_SeedWidget.html index b71ec856db0..d568555d20c 100644 --- a/api/Widgets_Widgets3D_SeedWidget.html +++ b/api/Widgets_Widgets3D_SeedWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/api/Widgets_Widgets3D_ShapeWidget.html b/api/Widgets_Widgets3D_ShapeWidget.html index e30dec4ddf1..b47b6d1a689 100644 --- a/api/Widgets_Widgets3D_ShapeWidget.html +++ b/api/Widgets_Widgets3D_ShapeWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/Widgets_Widgets3D_SphereWidget.html b/api/Widgets_Widgets3D_SphereWidget.html index b982746d563..4fcccd3b23b 100644 --- a/api/Widgets_Widgets3D_SphereWidget.html +++ b/api/Widgets_Widgets3D_SphereWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/api/Widgets_Widgets3D_SplineWidget.html b/api/Widgets_Widgets3D_SplineWidget.html index 018efdf6537..e0e61c333a5 100644 --- a/api/Widgets_Widgets3D_SplineWidget.html +++ b/api/Widgets_Widgets3D_SplineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -119,7 +119,7 @@

    diff --git a/api/index.html b/api/index.html index be63d7cf648..a7f5c07dfe6 100644 --- a/api/index.html +++ b/api/index.html @@ -49,8 +49,8 @@ - - + + @@ -146,7 +146,7 @@

    API

    diff --git a/atom.xml b/atom.xml index 899249246ed..b814ce6318d 100644 --- a/atom.xml +++ b/atom.xml @@ -6,7 +6,7 @@ - 2024-01-03T17:24:59.296Z + 2024-01-04T21:35:33.530Z https://kitware.github.io/vtk-js/ @@ -21,7 +21,7 @@ https://kitware.github.io/vtk-js/2016/04/29/kw-doc/ 2016-04-29T00:00:00.000Z - 2024-01-03T17:24:59.296Z + 2024-01-04T21:35:33.530Z Thanks for using kw-doc which is based on Hexo and its template from its own documentation.

    ]]>
    diff --git a/coverage/Sources/Common/Core/Base64/index.html b/coverage/Sources/Common/Core/Base64/index.html index 2c17db3d726..06a8441c689 100644 --- a/coverage/Sources/Common/Core/Base64/index.html +++ b/coverage/Sources/Common/Core/Base64/index.html @@ -101,7 +101,7 @@

    All files Sources/Common/Core/Base64 Code coverage generated by istanbul - at Wed Jan 03 2024 17:23:54 GMT+0000 (Coordinated Universal Time) + at Thu Jan 04 2024 21:34:23 GMT+0000 (Coordinated Universal Time) diff --git a/examples/ImageCPRMapper/ImageCPRMapper.js b/examples/ImageCPRMapper/ImageCPRMapper.js index b8f392b2ef0..0f3086d3884 100644 --- a/examples/ImageCPRMapper/ImageCPRMapper.js +++ b/examples/ImageCPRMapper/ImageCPRMapper.js @@ -1 +1 @@ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},702:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return Q},adjoint:function(){return v},clone:function(){return u},copy:function(){return d},create:function(){return c},determinant:function(){return y},equals:function(){return re},exactEquals:function(){return ne},frob:function(){return Z},fromQuat:function(){return _},fromQuat2:function(){return D},fromRotation:function(){return O},fromRotationTranslation:function(){return E},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return F},fromScaling:function(){return w},fromTranslation:function(){return I},fromValues:function(){return p},fromXRotation:function(){return M},fromYRotation:function(){return R},fromZRotation:function(){return V},frustum:function(){return G},getRotation:function(){return N},getScaling:function(){return B},getTranslation:function(){return L},identity:function(){return g},invert:function(){return h},lookAt:function(){return q},mul:function(){return oe},multiply:function(){return b},multiplyScalar:function(){return ee},multiplyScalarAndAdd:function(){return te},ortho:function(){return K},orthoNO:function(){return j},orthoZO:function(){return $},perspective:function(){return W},perspectiveFromFieldOfView:function(){return H},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return C},rotateX:function(){return S},rotateY:function(){return A},rotateZ:function(){return P},scale:function(){return T},set:function(){return f},str:function(){return Y},sub:function(){return ae},subtract:function(){return J},targetTo:function(){return X},translate:function(){return x},transpose:function(){return m}});var o={};n.r(o),n.d(o,{add:function(){return Re},adjoint:function(){return me},clone:function(){return le},copy:function(){return ce},create:function(){return ie},determinant:function(){return he},equals:function(){return Be},exactEquals:function(){return Le},frob:function(){return Me},fromMat2d:function(){return Ae},fromMat4:function(){return se},fromQuat:function(){return Pe},fromRotation:function(){return Ce},fromScaling:function(){return Se},fromTranslation:function(){return Te},fromValues:function(){return ue},identity:function(){return pe},invert:function(){return ge},mul:function(){return Ne},multiply:function(){return ve},multiplyScalar:function(){return Ee},multiplyScalarAndAdd:function(){return De},normalFromMat4:function(){return Ie},projection:function(){return we},rotate:function(){return be},scale:function(){return xe},set:function(){return de},str:function(){return Oe},sub:function(){return ke},subtract:function(){return Ve},translate:function(){return ye},transpose:function(){return fe}}),n(334);var a=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var s=Math.PI/180;function l(e){return e*s}function c(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function p(e,t,n,r,o,a,s,l,c,u,d,p,f,g,m,h){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=d,v[11]=p,v[12]=f,v[13]=g,v[14]=m,v[15]=h,v}function f(e,t,n,r,o,a,i,s,l,c,u,d,p,f,g,m,h){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=g,e[14]=m,e[15]=h,e}function g(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function m(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],a=t[6],i=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=o,e[13]=i,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function h(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,A=u*m-d*g,P=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*P+S*A;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(o*O-r*M-a*w)*R,e[2]=(m*S-h*C+v*T)*R,e[3]=(p*C-d*S-f*T)*R,e[4]=(l*I-i*M-c*P)*R,e[5]=(n*M-o*I+a*P)*R,e[6]=(h*x-g*S-v*b)*R,e[7]=(u*S-p*x+f*b)*R,e[8]=(i*O-s*I+c*A)*R,e[9]=(r*I-n*O-a*A)*R,e[10]=(g*C-m*x+v*y)*R,e[11]=(d*x-u*C-f*y)*R,e[12]=(s*P-i*w-l*A)*R,e[13]=(n*w-r*P+o*A)*R,e[14]=(m*b-g*T-h*y)*R,e[15]=(u*T-d*b+p*y)*R,e):null}function v(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15];return e[0]=s*(p*v-f*h)-d*(l*v-c*h)+m*(l*f-c*p),e[1]=-(r*(p*v-f*h)-d*(o*v-a*h)+m*(o*f-a*p)),e[2]=r*(l*v-c*h)-s*(o*v-a*h)+m*(o*c-a*l),e[3]=-(r*(l*f-c*p)-s*(o*f-a*p)+d*(o*c-a*l)),e[4]=-(i*(p*v-f*h)-u*(l*v-c*h)+g*(l*f-c*p)),e[5]=n*(p*v-f*h)-u*(o*v-a*h)+g*(o*f-a*p),e[6]=-(n*(l*v-c*h)-i*(o*v-a*h)+g*(o*c-a*l)),e[7]=n*(l*f-c*p)-i*(o*f-a*p)+u*(o*c-a*l),e[8]=i*(d*v-f*m)-u*(s*v-c*m)+g*(s*f-c*d),e[9]=-(n*(d*v-f*m)-u*(r*v-a*m)+g*(r*f-a*d)),e[10]=n*(s*v-c*m)-i*(r*v-a*m)+g*(r*c-a*s),e[11]=-(n*(s*f-c*d)-i*(r*f-a*d)+u*(r*c-a*s)),e[12]=-(i*(d*h-p*m)-u*(s*h-l*m)+g*(s*p-l*d)),e[13]=n*(d*h-p*m)-u*(r*h-o*m)+g*(r*p-o*d),e[14]=-(n*(s*h-l*m)-i*(r*h-o*m)+g*(r*l-o*s)),e[15]=n*(s*p-l*d)-i*(r*p-o*d)+u*(r*l-o*s),e}function y(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],h=e[15];return(t*i-n*a)*(d*h-p*m)-(t*s-r*a)*(u*h-p*g)+(t*l-o*a)*(u*m-d*g)+(n*s-r*i)*(c*h-p*f)-(n*l-o*i)*(c*m-d*f)+(r*l-o*s)*(c*g-u*f)}function b(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],m=t[12],h=t[13],v=t[14],y=t[15],b=n[0],x=n[1],T=n[2],C=n[3];return e[0]=b*r+x*s+T*d+C*m,e[1]=b*o+x*l+T*p+C*h,e[2]=b*a+x*c+T*f+C*v,e[3]=b*i+x*u+T*g+C*y,b=n[4],x=n[5],T=n[6],C=n[7],e[4]=b*r+x*s+T*d+C*m,e[5]=b*o+x*l+T*p+C*h,e[6]=b*a+x*c+T*f+C*v,e[7]=b*i+x*u+T*g+C*y,b=n[8],x=n[9],T=n[10],C=n[11],e[8]=b*r+x*s+T*d+C*m,e[9]=b*o+x*l+T*p+C*h,e[10]=b*a+x*c+T*f+C*v,e[11]=b*i+x*u+T*g+C*y,b=n[12],x=n[13],T=n[14],C=n[15],e[12]=b*r+x*s+T*d+C*m,e[13]=b*o+x*l+T*p+C*h,e[14]=b*a+x*c+T*f+C*v,e[15]=b*i+x*u+T*g+C*y,e}function x(e,t,n){var r,o,a,i,s,l,c,u,d,p,f,g,m=n[0],h=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*h+t[8]*v+t[12],e[13]=t[1]*m+t[5]*h+t[9]*v+t[13],e[14]=t[2]*m+t[6]*h+t[10]*v+t[14],e[15]=t[3]*m+t[7]*h+t[11]*v+t[15]):(r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=f,e[11]=g,e[12]=r*m+s*h+d*v+t[12],e[13]=o*m+l*h+p*v+t[13],e[14]=a*m+c*h+f*v+t[14],e[15]=i*m+u*h+g*v+t[15]),e}function T(e,t,n){var r=n[0],o=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function C(e,t,n,r){var o,i,s,l,c,u,d,p,f,g,m,h,v,y,b,x,T,C,S,A,P,I,w,O,M=r[0],R=r[1],V=r[2],E=Math.hypot(M,R,V);return E0?(n[0]=2*(l*s+d*r+c*a-u*o)/p,n[1]=2*(c*s+d*o+u*r-l*a)/p,n[2]=2*(u*s+d*a+l*o-c*r)/p):(n[0]=2*(l*s+d*r+c*a-u*o),n[1]=2*(c*s+d*o+u*r-l*a),n[2]=2*(u*s+d*a+l*o-c*r)),E(e,t,n),e}function L(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function B(e,t){var n=t[0],r=t[1],o=t[2],a=t[4],i=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(a,i,s),e[2]=Math.hypot(l,c,u),e}function N(e,t){var n=new i(3);B(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,c=t[2]*a,u=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,g=t[9]*o,m=t[10]*a,h=s+d+m,v=0;return h>0?(v=2*Math.sqrt(h+1),e[3]=.25*v,e[0]=(p-g)/v,e[1]=(f-c)/v,e[2]=(l-u)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-g)/v,e[0]=.25*v,e[1]=(l+u)/v,e[2]=(f+c)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-c)/v,e[0]=(l+u)/v,e[1]=.25*v,e[2]=(p+g)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-u)/v,e[0]=(f+c)/v,e[1]=(p+g)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],a=t[1],i=t[2],s=t[3],l=o+o,c=a+a,u=i+i,d=o*l,p=o*c,f=o*u,g=a*c,m=a*u,h=i*u,v=s*l,y=s*c,b=s*u,x=r[0],T=r[1],C=r[2];return e[0]=(1-(g+h))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*T,e[5]=(1-(d+h))*T,e[6]=(m+v)*T,e[7]=0,e[8]=(f+y)*C,e[9]=(m-v)*C,e[10]=(1-(d+g))*C,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function F(e,t,n,r,o){var a=t[0],i=t[1],s=t[2],l=t[3],c=a+a,u=i+i,d=s+s,p=a*c,f=a*u,g=a*d,m=i*u,h=i*d,v=s*d,y=l*c,b=l*u,x=l*d,T=r[0],C=r[1],S=r[2],A=o[0],P=o[1],I=o[2],w=(1-(m+v))*T,O=(f+x)*T,M=(g-b)*T,R=(f-x)*C,V=(1-(p+v))*C,E=(h+y)*C,D=(g+b)*S,L=(h-y)*S,B=(1-(p+m))*S;return e[0]=w,e[1]=O,e[2]=M,e[3]=0,e[4]=R,e[5]=V,e[6]=E,e[7]=0,e[8]=D,e[9]=L,e[10]=B,e[11]=0,e[12]=n[0]+A-(w*A+R*P+D*I),e[13]=n[1]+P-(O*A+V*P+L*I),e[14]=n[2]+I-(M*A+E*P+B*I),e[15]=1,e}function _(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[1]=u+v,e[2]=p-h,e[3]=0,e[4]=u-v,e[5]=1-c-g,e[6]=f+m,e[7]=0,e[8]=p+h,e[9]=f-m,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function G(e,t,n,r,o,a,i){var s=1/(n-t),l=1/(o-r),c=1/(a-i);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(i+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*a*2*c,e[15]=0,e}function U(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=(o+r)*a,e[14]=2*o*r*a):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var W=U;function z(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=o*a,e[14]=o*r*a):(e[10]=-1,e[14]=-r),e}function H(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(i+s),c=2/(o+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(i-s)*l*.5,e[9]=(o-a)*c*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function j(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(i+a)*c,e[15]=1,e}var K=j;function $(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=a*c,e[15]=1,e}function q(e,t,n,r){var o,i,s,l,c,u,d,p,f,m,h=t[0],v=t[1],y=t[2],b=r[0],x=r[1],T=r[2],C=n[0],S=n[1],A=n[2];return Math.abs(h-C)0&&(u*=f=1/Math.sqrt(f),d*=f,p*=f);var g=l*p-c*d,m=c*u-s*p,h=s*d-l*u;return(f=g*g+m*m+h*h)>0&&(g*=f=1/Math.sqrt(f),m*=f,h*=f),e[0]=g,e[1]=m,e[2]=h,e[3]=0,e[4]=d*h-p*m,e[5]=p*g-u*h,e[6]=u*m-d*g,e[7]=0,e[8]=u,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=a,e[14]=i,e[15]=1,e}function Y(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Z(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Q(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function J(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function te(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function re(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=e[9],f=e[10],g=e[11],m=e[12],h=e[13],v=e[14],y=e[15],b=t[0],x=t[1],T=t[2],C=t[3],S=t[4],A=t[5],P=t[6],I=t[7],w=t[8],O=t[9],M=t[10],R=t[11],V=t[12],E=t[13],D=t[14],L=t[15];return Math.abs(n-b)<=a*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=a*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-T)<=a*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-C)<=a*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(s-S)<=a*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-A)<=a*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(c-P)<=a*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(u-I)<=a*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-w)<=a*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-O)<=a*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(f-M)<=a*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(g-R)<=a*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(m-V)<=a*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(h-E)<=a*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(v-D)<=a*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-L)<=a*Math.max(1,Math.abs(y),Math.abs(L))}var oe=b,ae=J;function ie(){var e=new i(9);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function se(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function le(e){var t=new i(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ue(e,t,n,r,o,a,s,l,c){var u=new i(9);return u[0]=e,u[1]=t,u[2]=n,u[3]=r,u[4]=o,u[5]=a,u[6]=s,u[7]=l,u[8]=c,u}function de(e,t,n,r,o,a,i,s,l,c){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e}function pe(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function fe(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function ge(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*i-s*c,p=-u*a+s*l,f=c*a-i*l,g=n*d+r*p+o*f;return g?(g=1/g,e[0]=d*g,e[1]=(-u*r+o*c)*g,e[2]=(s*r-o*i)*g,e[3]=p*g,e[4]=(u*n-o*l)*g,e[5]=(-s*n+o*a)*g,e[6]=f*g,e[7]=(-c*n+r*l)*g,e[8]=(i*n-r*a)*g,e):null}function me(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=i*u-s*c,e[1]=o*c-r*u,e[2]=r*s-o*i,e[3]=s*l-a*u,e[4]=n*u-o*l,e[5]=o*a-n*s,e[6]=a*c-i*l,e[7]=r*l-n*c,e[8]=n*i-r*a,e}function he(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8];return t*(c*a-i*l)+n*(-c*o+i*s)+r*(l*o-a*s)}function ve(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1],g=n[2],m=n[3],h=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*i+g*c,e[1]=p*o+f*s+g*u,e[2]=p*a+f*l+g*d,e[3]=m*r+h*i+v*c,e[4]=m*o+h*s+v*u,e[5]=m*a+h*l+v*d,e[6]=y*r+b*i+x*c,e[7]=y*o+b*s+x*u,e[8]=y*a+b*l+x*d,e}function ye(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1];return e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=p*r+f*i+c,e[7]=p*o+f*s+u,e[8]=p*a+f*l+d,e}function be(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=Math.sin(n),f=Math.cos(n);return e[0]=f*r+p*i,e[1]=f*o+p*s,e[2]=f*a+p*l,e[3]=f*i-p*r,e[4]=f*s-p*o,e[5]=f*l-p*a,e[6]=c,e[7]=u,e[8]=d,e}function xe(e,t,n){var r=n[0],o=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Te(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Ce(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Se(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ae(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Pe(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[3]=u-v,e[6]=p+h,e[1]=u+v,e[4]=1-c-g,e[7]=f-m,e[2]=p-h,e[5]=f+m,e[8]=1-c-d,e}function Ie(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,A=u*m-d*g,P=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*P+S*A;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(l*I-i*M-c*P)*R,e[2]=(i*O-s*I+c*A)*R,e[3]=(o*O-r*M-a*w)*R,e[4]=(n*M-o*I+a*P)*R,e[5]=(r*I-n*O-a*A)*R,e[6]=(m*S-h*C+v*T)*R,e[7]=(h*x-g*S-v*b)*R,e[8]=(g*C-m*x+v*y)*R,e):null}function we(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Oe(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Me(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Re(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}function Ve(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}function Ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}function De(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e}function Le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Be(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=t[0],f=t[1],g=t[2],m=t[3],h=t[4],v=t[5],y=t[6],b=t[7],x=t[8];return Math.abs(n-p)<=a*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(r-f)<=a*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-g)<=a*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(i-m)<=a*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-h)<=a*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(l-v)<=a*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=a*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=a*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(d-x)<=a*Math.max(1,Math.abs(d),Math.abs(x))}var Ne=ve,ke=Ve,Fe=n(152),_e=n.n(Fe),Ge=n(177);const Ue=n.n(Ge)()(),We={vtkObject:()=>null};function ze(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return Ue.console&&Ue.console.error&&Ue.console.error("Invalid VTK object"),null;const t=We[e.vtkClass];if(!t)return Ue.console&&Ue.console.error&&Ue.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=ze(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}ze.register=function(e,t){We[e]=t};class He extends Array{push(){for(let e=0;e{$e[e]=qe})),Ue.console=console.hasOwnProperty("log")?console:$e;const Xe={debug:qe,error:Ue.console.error||qe,info:Ue.console.info||qe,log:Ue.console.log||qe,warn:Ue.console.warn||qe};function Ye(e,t){Xe[e]&&(Xe[e]=t||qe)}function Ze(){Xe.log(...arguments)}function Qe(){Xe.info(...arguments)}function Je(){Xe.debug(...arguments)}function et(){Xe.error(...arguments)}function tt(){Xe.warn(...arguments)}const nt={};function rt(e){nt[e]||(Xe.error(e),nt[e]=!0)}const ot=Object.create(null);ot.Float32Array=Float32Array,ot.Float64Array=Float64Array,ot.Uint8Array=Uint8Array,ot.Int8Array=Int8Array,ot.Uint16Array=Uint16Array,ot.Int16Array=Int16Array,ot.Uint32Array=Uint32Array,ot.Int32Array=Int32Array,ot.Uint8ClampedArray=Uint8ClampedArray;try{ot.BigInt64Array=BigInt64Array,ot.BigUint64Array=BigUint64Array}catch{}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),a="B";for(;o>n;)o/=n,a=r.pop();return`${o.toFixed(t)} ${a}`}function dt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function pt(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function ft(e){return Object.values(ot).some((t=>e instanceof t))}function gt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function yt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++je),"classHierarchy"in t){if(!(t.classHierarchy instanceof He)){const e=new He;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?et("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return et("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!1;return Object.keys(n).forEach((i=>{const s=o?null:e[`set${st(i)}`];s&&Array.isArray(n[i])&&s.length>1?a=s(...n[i])||a:s?a=s(n[i])||a:(-1!==["mtime"].indexOf(i)||r||tt(`Warning: Set value to model directly ${i}, ${n[i]}`),a=t[i]!==n[i]||a,t[i]=n[i])})),a},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(mt):ft(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),a=Object.keys(t).sort(),i=Object.keys(o).sort();i.forEach((e=>{const n=a.indexOf(e);-1===n?r&&Je(`add ${e} in shallowCopy`):a.splice(n,1),t[e]=o[e]})),a.length&&r&&Je(`Untouched keys: ${a.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const bt={object:(e,t,n)=>function(){return{...t[n.name]}}};function xt(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=bt[n.type];e[`get${lt(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${lt(n)}`]=()=>t[n]}))}const Tt={enum(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw et(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}throw et(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw et(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if(!_e()(t[n.name],o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}return!1}}};function Ct(e){if("object"==typeof e){const t=Tt[e.type];if(t)return(n,r)=>t(n,r,e);throw et(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${lt(e)}Changed`;return function(o){if(n.deleted)return et("instance deleted - cannot call any method"),!1;if(n[e]!==o){const a=n[e.name];return n[e]=o,n[r]?.(t,n,o,a),t.modified(),!0}return!1}}}function St(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${lt(n.name)}`]=Ct(n)(e,t):e[`set${lt(n)}`]=Ct(n)(e,t)}))}function At(e,t,n){xt(e,t,n),St(e,t,n)}function Pt(e,t,n){n.forEach((n=>{e[`get${lt(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${lt(n)}ByReference`]=()=>t[n]}))}function It(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const a=`_on${lt(n)}Changed`;e[`set${lt(n)}`]=function(){if(t.deleted)return et("instance deleted - cannot call any method"),!1;for(var i=arguments.length,s=new Array(i),l=0;l=0)&&(u=u[0],d=!0),null==u)c=t[n]!==u;else{if(r&&u.length!==r){if(!(u.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function wt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Pt(e,t,n),It(e,t,n,r,o)}function Ot(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?et("instance deleted - cannot call any method"):r>=t.numberOfInputs?et(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function a(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)et("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void et(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function i(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(et("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(ze):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(ze):t.inputConnection=[],t.output?t.output=t.output.map(ze):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(ze):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,a=r;for(;a--;){if(!t.output[a]||t.output[a].isDeleted())return!0;const e=t.output[a].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=a,e.addInputData=function(e){t.deleted?et("instance deleted - cannot call any method"):o(e,i())},e.addInputConnection=function(e){t.deleted?et("instance deleted - cannot call any method"):a(e,i())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===Rt)break}},e[`on${lt(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return et("instance deleted - cannot call any method"),null;const i=a++;return r.push([i,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(i)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return i(t)}))}}function Et(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&ze.register(t,n),n}function Dt(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function Lt(e){return e&&e.isA&&e.isA("vtkObject")}function Bt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(Lt(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const a=e.get();Object.keys(a).forEach((e=>{const o=a[e];Array.isArray(o)?o.forEach((e=>{Bt(e,t,n,r)})):Bt(o,t,n,r)}))}return n}function Nt(e,t,n){var r=this;let o;const a=function(){for(var a=arguments.length,i=new Array(a),s=0;s{o=null,n||e.apply(l,i)},u=n&&!o;clearTimeout(o),o=setTimeout(c,t),u&&e.apply(l,i)};return a.cancel=()=>clearTimeout(o),a}function kt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(a(...r),r=null)}function a(){for(var a=arguments.length,i=new Array(a),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let _t=1;const Gt="__root__";function Ut(e,t){Ft(e,t);const n=e.delete;t.proxyId=""+_t++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),xt(e,t,["proxyId","proxyGroup","proxyName"]),At(e,t,["proxyManager"]);const r={},o={};function a(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:Gt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gt;const r=[],o=t.proxyId,a=i(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),a(t.ui,Gt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${lt(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let a=0,i=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i)return null;const l=[];let c=null;for(a=o.length;a--;){const e=o[a];e.instance===n?c=e:l.push(e)}if(!c)return null;const u=c.instance[`get${lt(c.propertyName)}`]();if(!gt(u,r)||s){for(r=u,i=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}i=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=u),u}function l(e,t){const n=[];for(a=o.length;a--;){const r=o[a];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(a))}for(;n.length;)o.splice(n.pop(),1)}function c(n,r){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=n.onModified(s),c=o[0];return o.push({instance:n,propertyName:r,subscription:i}),a&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):c&&s(c.instance,!0)),{unsubscribe:()=>l(n,r)}}function u(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:c,unbind:l,unsubscribe:u,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,ht((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function zt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const a=Object.keys(r);let i=a.length;for(;i--;){const s=a[i];t[s]=r[s];const l=n[s];e[`set${lt(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}a.length&&xt(e,t,a)}function Ht(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var jt={algo:Mt,capitalize:st,chain:Dt,debounce:Nt,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:Vt,EVENT_ABORT:Rt,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,get:xt,getArray:Pt,getCurrentGlobalMTime:function(){return je},getStateArrayMapFunc:mt,isVtkObject:Lt,keystore:Ft,measurePromiseExecution:vt,moveToProtected:Ot,newInstance:Et,newTypedArray:at,newTypedArrayFrom:it,normalizeWheel:Ht,obj:yt,proxy:Ut,proxyPropertyMapping:Wt,proxyPropertyState:zt,safeArrays:pt,set:St,setArray:It,setGet:At,setGetArray:wt,setImmediate:ht,setLoggerFunction:Ye,throttle:kt,traverseInstanceTree:Bt,TYPED_ARRAYS:ot,uncapitalize:ct,VOID:Ke,vtkDebugMacro:Je,vtkErrorMacro:et,vtkInfoMacro:Qe,vtkLogMacro:Ze,vtkOnceErrorMacro:rt,vtkWarningMacro:tt},Kt=Object.freeze({__proto__:null,VOID:Ke,setLoggerFunction:Ye,vtkLogMacro:Ze,vtkInfoMacro:Qe,vtkDebugMacro:Je,vtkErrorMacro:et,vtkWarningMacro:tt,vtkOnceErrorMacro:rt,TYPED_ARRAYS:ot,newTypedArray:at,newTypedArrayFrom:it,capitalize:st,_capitalize:lt,uncapitalize:ct,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,setImmediateVTK:ht,measurePromiseExecution:vt,obj:yt,get:xt,set:St,setGet:At,getArray:Pt,setArray:It,setGetArray:wt,moveToProtected:Ot,algo:Mt,EVENT_ABORT:Rt,event:Vt,newInstance:Et,chain:Dt,isVtkObject:Lt,traverseInstanceTree:Bt,debounce:Nt,throttle:kt,keystore:Ft,proxy:Ut,proxyPropertyMapping:Wt,proxyPropertyState:zt,normalizeWheel:Ht,default:jt});const{vtkErrorMacro:$t}=jt;function qt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return $t("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xt,n),jt.obj(e,t),jt.event(e,t,"event"),t._renderableChildMap=new Map,jt.get(e,t,["visited"]),jt.setGet(e,t,["_parent","renderable","myFactory"]),jt.getArray(e,t,["children"]),jt.moveToProtected(e,t,["parent"]),qt(e,t)}var Zt={newInstance:jt.newInstance(Yt,"vtkViewNode"),extend:Yt,PASS_TYPES:["Build","Render"]};function Qt(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),a=!1;const i=Object.keys(t.overrides);for(;o&&!a;)-1!==i.indexOf(o)?a=!0:o=n.getClassName(r++);if(!a)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const Jt={};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jt,n),jt.obj(e,t),Qt(e,t)}var tn={newInstance:jt.newInstance(en,"vtkViewNodeFactory"),extend:en};const nn=Object.create(null);function rn(e,t){nn[e]=t}function on(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const an={};function sn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,an,n),t.overrides=nn,tn.extend(e,t,n),on(0,t)}var ln={newInstance:jt.newInstance(sn,"vtkOpenGLViewNodeFactory"),extend:sn};function cn(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){d(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),se(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();d(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),m(t.keyMatrices.vcpc,t.keyMatrices.vcpc),b(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const un={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const dn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,un,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},At(e,t,["context","keyMatrixTime"]),cn(e,t)}));rn("vtkCamera",dn);const{vtkDebugMacro:pn}=Kt;function fn(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(pn("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const gn={context:null,_openGLRenderWindow:null,selector:null};const mn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gn,n),Zt.extend(e,t,n),xt(e,t,["shaderCache"]),At(e,t,["selector"]),Ot(0,t,["openGLRenderWindow"]),fn(e,t)}),"vtkOpenGLRenderer");function hn(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=n=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(n,r)=>{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?pe(t.keyMatrices.normalMatrix):(se(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),fe(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkRenderer",mn);const vn={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};const yn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vn,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},At(e,t,["context"]),xt(e,t,["activeTextures"]),hn(e,t)}));function bn(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=n=>{if(n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOverlayActorCount()}},e.traverseOpaquePass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&!t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOverlayPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable)&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xn,n),Zt.extend(e,t,n),At(e,t,["context"]),xt(e,t,["activeTextures"]),bn(e,t)}));function Cn(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sn(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function An(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function Pn(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function In(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function wn(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function On(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Mn(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function Rn(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Vn(e,t){var n=t[0],r=t[1],o=t[2],a=n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function En(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dn(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[0],s=n[1],l=n[2];return e[0]=o*l-a*s,e[1]=a*i-r*l,e[2]=r*s-o*i,e}function Ln(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[3]*r+n[7]*o+n[11]*a+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*o+n[8]*a+n[12])/i,e[1]=(n[1]*r+n[5]*o+n[9]*a+n[13])/i,e[2]=(n[2]*r+n[6]*o+n[10]*a+n[14])/i,e}function Bn(e,t,n){var r=t[0],o=t[1],a=t[2];return e[0]=r*n[0]+o*n[3]+a*n[6],e[1]=r*n[1]+o*n[4]+a*n[7],e[2]=r*n[2]+o*n[5]+a*n[8],e}function Nn(e,t,n){var r=n[0],o=n[1],a=n[2],i=n[3],s=t[0],l=t[1],c=t[2],u=o*c-a*l,d=a*s-r*c,p=r*l-o*s,f=o*p-a*d,g=a*u-r*p,m=r*d-o*u,h=2*i;return u*=h,d*=h,p*=h,f*=2,g*=2,m*=2,e[0]=s+u+f,e[1]=l+d+g,e[2]=c+p+m,e}function kn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Fn(e,t){var n=e[0],r=e[1],o=e[2],i=t[0],s=t[1],l=t[2];return Math.abs(n-i)<=a*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-s)<=a*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-l)<=a*Math.max(1,Math.abs(o),Math.abs(l))}rn("vtkActor2D",Tn);var _n=wn,Gn=function(e,t){var n=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2];return Math.hypot(n,r,o)},Un=Sn,Wn=(Cn(),Math.sqrt(50)),zn=Math.sqrt(10),Hn=Math.sqrt(2);function jn(e,t,n){var r=(t-e)/Math.max(0,n),o=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,o);return o>=0?(a>=Wn?10:a>=zn?5:a>=Hn?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(a>=Wn?10:a>=zn?5:a>=Hn?2:1)}function Kn(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function $n(e){let t=e,n=e,r=e;function o(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<0?o=n+1:a=n}while(oe(t)-n,n=Kn,r=(t,n)=>Kn(e(t),n)),{left:o,center:function(e,n,r=0,a=e.length){const i=o(e,n,r,a-1);return i>r&&t(e[i-1],n)>-t(e[i],n)?i-1:i},right:function(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<=0?o=n+1:a=n}while(o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?vr(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?vr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ir.exec(e))?new xr(t[1],t[2],t[3],1):(t=sr.exec(e))?new xr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=lr.exec(e))?vr(t[1],t[2],t[3],t[4]):(t=cr.exec(e))?vr(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=ur.exec(e))?Ir(t[1],t[2]/100,t[3]/100,1):(t=dr.exec(e))?Ir(t[1],t[2]/100,t[3]/100,t[4]):pr.hasOwnProperty(e)?hr(pr[e]):"transparent"===e?new xr(NaN,NaN,NaN,0):null}function hr(e){return new xr(e>>16&255,e>>8&255,255&e,1)}function vr(e,t,n,r){return r<=0&&(e=t=n=NaN),new xr(e,t,n,r)}function yr(e){return e instanceof Jn||(e=mr(e)),e?new xr((e=e.rgb()).r,e.g,e.b,e.opacity):new xr}function br(e,t,n,r){return 1===arguments.length?yr(e):new xr(e,t,n,null==r?1:r)}function xr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Tr(){return`#${Pr(this.r)}${Pr(this.g)}${Pr(this.b)}`}function Cr(){const e=Sr(this.opacity);return`${1===e?"rgb(":"rgba("}${Ar(this.r)}, ${Ar(this.g)}, ${Ar(this.b)}${1===e?")":`, ${e})`}`}function Sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ar(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pr(e){return((e=Ar(e))<16?"0":"")+e.toString(16)}function Ir(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Or(e,t,n,r)}function wr(e){if(e instanceof Or)return new Or(e.h,e.s,e.l,e.opacity);if(e instanceof Jn||(e=mr(e)),!e)return new Or;if(e instanceof Or)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),i=NaN,s=a-o,l=(a+o)/2;return s?(i=t===a?(n-r)/s+6*(n0&&l<1?0:i,new Or(i,s,l,e.opacity)}function Or(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Mr(e){return(e=(e||0)%360)<0?e+360:e}function Rr(e){return Math.max(0,Math.min(1,e||0))}function Vr(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Er(e,t,n,r,o){var a=e*e,i=a*e;return((1-3*e+3*a-i)*t+(4-6*a+3*i)*n+(1+3*e+3*a-3*i)*r+i*o)/6}Zn(Jn,mr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:fr,formatHex:fr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return wr(this).formatHsl()},formatRgb:gr,toString:gr}),Zn(xr,br,Qn(Jn,{brighter(e){return e=null==e?tr:Math.pow(tr,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?er:Math.pow(er,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xr(Ar(this.r),Ar(this.g),Ar(this.b),Sr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tr,formatHex:Tr,formatHex8:function(){return`#${Pr(this.r)}${Pr(this.g)}${Pr(this.b)}${Pr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Cr,toString:Cr})),Zn(Or,(function(e,t,n,r){return 1===arguments.length?wr(e):new Or(e,t,n,null==r?1:r)}),Qn(Jn,{brighter(e){return e=null==e?tr:Math.pow(tr,e),new Or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?er:Math.pow(er,e),new Or(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new xr(Vr(e>=240?e-240:e+120,o,r),Vr(e,o,r),Vr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Or(Mr(this.h),Rr(this.s),Rr(this.l),Sr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Sr(this.opacity);return`${1===e?"hsl(":"hsla("}${Mr(this.h)}, ${100*Rr(this.s)}%, ${100*Rr(this.l)}%${1===e?")":`, ${e})`}`}}));var Dr=e=>()=>e;function Lr(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Dr(isNaN(e)?t:e)}var Br=function e(t){var n=function(e){return 1==(e=+e)?Lr:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Dr(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=br(e)).r,(t=br(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),i=Lr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=a(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function Nr(e){return function(t){var n,r,o=t.length,a=new Array(o),i=new Array(o),s=new Array(o);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),o=e[r],a=e[r+1],i=r>0?e[r-1]:2*o-a,s=ra&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:_r(n,r)})),a=Wr.lastIndex;return at&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Qr:Zr,o=a=null,d}function d(t){return null==t||isNaN(t=+t)?n:(o||(o=r(i.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,i.map(e),_r)))(n)))},d.domain=function(e){return arguments.length?(i=Array.from(e,$r),u()):i.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Kr,u()},d.clamp=function(e){return arguments.length?(c=!!e||Xr,u()):c!==Xr},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}()(Xr,Xr)}function to(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}var no,ro=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function oo(e){if(!(t=ro.exec(e)))throw new Error("invalid format: "+e);var t;return new ao({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ao(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function io(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function so(e){return(e=io(Math.abs(e)))?e[1]:NaN}function lo(e,t){var n=io(e,t);if(!n)return e+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}oo.prototype=ao.prototype,ao.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var co={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>lo(100*e,t),r:lo,s:function(e,t){var n=io(e,t);if(!n)return e+"";var r=n[0],o=n[1],a=o-(no=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+io(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uo(e){return e}var po,fo,go,mo=Array.prototype.map,ho=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vo(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){var r,o,a,i,s=-1;if(n=+n,(e=+e)==(t=+t)&&n>0)return[e];if((r=t0){let n=Math.round(e/i),r=Math.round(t/i);for(n*it&&--r,a=new Array(o=r-n+1);++st&&--r,a=new Array(o=r-n+1);++s=Wn?o*=10:a>=zn?o*=5:a>=Hn&&(o*=2),t0;){if((o=jn(l,c,n))===r)return a[i]=l,a[s]=c,t(a);if(o>0)l=Math.floor(l/o)*o,c=Math.ceil(c/o)*o;else{if(!(o<0))break;l=Math.ceil(l*o)/o,c=Math.floor(c*o)/o}r=o}return e},e}function yo(){var e=eo();return e.copy=function(){return Jr(e,yo())},to.apply(e,arguments),vo(e)}po=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?uo:(t=mo.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var o=e.length,a=[],i=0,s=t[0],l=0;o>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(o-=s,o+s)),!((l+=s+1)>r));)s=t[i=(i+1)%t.length];return a.reverse().join(n)}),o=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?uo:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(mo.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=oo(e)).fill,n=e.align,d=e.sign,p=e.symbol,f=e.zero,g=e.width,m=e.comma,h=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):co[y]||(void 0===h&&(h=12),v=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===p?o:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===p?a:/[%p]/.test(y)?l:"",T=co[y],C=/[defgprs%]/.test(y);function S(e){var o,a,l,p=b,S=x;if("c"===y)S=T(e)+S,e="";else{var A=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:T(Math.abs(e),h),v&&(e=function(e){e:for(var t,n=e.length,r=1,o=-1;r0&&(o=0)}return o>0?e.slice(0,o)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),p=(A?"("===d?d:c:"-"===d||"("===d?"":d)+p,S=("s"===y?ho[8+no/3]:"")+S+(A&&"("===d?")":""),C)for(o=-1,a=e.length;++o(l=e.charCodeAt(o))||l>57){S=(46===l?i+e.slice(o+1):e.slice(o))+S,e=e.slice(0,o);break}}m&&!f&&(e=r(e,1/0));var P=p.length+e.length+S.length,I=P>1)+p+e+S+I.slice(P);break;default:e=I+p+e+S}return s(e)}return h=void 0===h?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h)),S.toString=function(){return e+""},S}return{format:d,formatPrefix:function(e,t){var n=d(((e=oo(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(so(t)/3))),o=Math.pow(10,-r),a=ho[8+r/3];return function(e){return n(o*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),fo=po.format,go=po.formatPrefix;var bo=n(640),xo=n.n(bo);const To=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Co=[1,0,0,0,1,0,0,0,1],So=1e-6,Ao=1e-12,{vtkErrorMacro:Po,vtkWarningMacro:Io}=jt;let wo=0;function Oo(e){return()=>Po(`vtkMath::${e} - NOT IMPLEMENTED`)}function Mo(e,t,n,r){let o;for(let a=0;a0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r=0?o:-o}function na(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ra(e){const t=na(e);return 0!==t&&(e[0]/=t,e[1]/=t),t}function oa(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:So;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const ua=ca;function da(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function pa(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function ma(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=ga(e[0],n),t[1]=ga(e[1],n),t[2]=ga(e[2],n),t}function ha(e,t,n,r){let o,a,i,s,l,c,u,d,p,f,g,m,h,v,y,b;const x=Vo(t),T=Vo(t),C=(e,t,n)=>{v=e[t],h=e[n],e[t]=v-m*(h+v*f),e[n]=h+m*(v-h*f)};for(pa(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>u){for(h=n[s]-n[l],Math.abs(h)+v===Math.abs(h)?p=e[l*t+s]/h:(d=.5*h/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),h=p*e[l*t+s],T[l]-=h,T[s]+=h,n[l]-=h,n[s]+=h,e[l*t+s]=0,a=0;a<=l-1;a++)C(e,a*t+l,a*t+s);for(a=l+1;a<=s-1;a++)C(e,l*t+a,a*t+s);for(a=s+1;a=20)return Io("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a=b||Math.abs(n[o]-b)>1)+(1&t);for(c=0,o=0;o=0&&c++;if(cr?a:r,o=i>o?i:o,n[e]=1,0!==o&&(n[e]/=o)}const a=Math.abs(t[0])*n[0],i=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=a,i>=o&&(o=i,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(Ro(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],c=Math.abs(t[7])*n[2];r[1]=1,o=l,c>=o&&(r[1]=2,Ro(t,3,1,2)),r[2]=2;let u=0;if(la(t)<0){u=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=Vo(4);if(va(t,d),fa(d,t),u)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&Ro(t,3,r[1],1),0!==r[0]&&Ro(t,3,r[0],0)}function ba(e,t,n){let r,o,a,i,s,l;if(ha([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(sa(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),i=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,i=o);i!==r&&(s=t[i],t[i]=t[r],t[r]=s,Mo(n,3,r,i)),n[3*i+i]<0&&(n[3*i]=-n[3*i],n[3*i+1]=-n[3*i+1],n[3*i+2]=-n[3*i+2]),o=(i+1)%3,a=(i+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Yo([n[3*i],n[3*i+1],n[3*i+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Qo(e);const c=Yo(e,[n[3*i],n[3*i+1],n[3*i+2]],[]);for(let t=0;t<3;t++)n[3*a+t]=e[t],n[3*o+t]=c[t];return void sa(n,n)}for(l=Math.abs(n[0]),i=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,i=r);if(0!==i){const e=t[i];t[i]=t[0],t[0]=e,Mo(n,3,i,0)}if(Math.abs(n[4])i&&(i=c);if(0===i)return Io("Unable to factor linear system"),0;d[r]=1/i}for(o=0;o=i&&(i=l,u=r)}if(o!==u){for(a=0;a=0)for(a=i;a<=o-1;a++)l-=e[o*r+a]*n[a];else 0!==l&&(i=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],a=o+1;a3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=r||Vo(n),i=o||Vo(n);if(0===xa(e,a,n))return null;for(let r=0;ri&&n<=a?(u=1,c=(a-n)/i,d=0):n>a&&n<=.5?(u=1,d=(n-a)/i,c=0):n>.5&&n<=s?(d=1,u=(s-n)/i,c=0):n>s&&n<=l?(d=1,c=(n-s)/i,u=0):n>l&&n<=1?(c=1,d=(1-n)/i,u=0):(c=1,u=n/i,d=0),c=r*c+(1-r),u=r*u+(1-r),d=r*d+(1-r),c*=o,u*=o,d*=o,t[0]=c,t[1]=u,t[2]=d}function Ia(e,t){const[n,r,o]=e;let a=(n+16)/116,i=r/500+a,s=a-o/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,i**3>.008856?i**=3:i=(i-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*i,t[1]=1*a,t[2]=1.089*s}function wa(e,t){const[n,r,o]=e;let a=n/.9505,i=r/1,s=o/1.089;a>.008856?a**=1/3:a=7.787*a+16/116,i>.008856?i**=1/3:i=7.787*i+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*i-16,t[1]=500*(a-i),t[2]=200*(i-s)}function Oa(e,t){const[n,r,o]=e;let a=3.2406*n+-1.5372*r+-.4986*o,i=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=a;l1&&(a/=l,i/=l,s/=l),a<0&&(a=0),i<0&&(i=0),s<0&&(s=0),t[0]=a,t[1]=i,t[2]=s}function Ma(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function Ra(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function Va(e){return!(e[1]-e[0]<0)}function Ea(e,t,n){return en?n:e}function Da(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=Ea(e[0],t[0],n[0]),r[1]=Ea(e[1],t[1],n[1]),r[2]=Ea(e[2],t[2],n[2]),r}const La=Oo("GetScalarTypeFittingRange"),Ba=Oo("GetAdjustedScalarRange");const{isFinite:Na,isNaN:ka}=Number,Fa=ka;function _a(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ga(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let a=-1/0,i=0,s=0;for(let l=0;l<=o;++l){const c=n[l];for(let n=0;n<=o;++n){const o=r[n],u=Math.abs(e[c+t*o]);u>a&&(a=u,i=l,s=n)}}[n[o],n[i]]=[n[i],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let a=0;a15?t.toString(16):`0${t.toString(16)}`}function Wa(e){return Math.round(255*e)}var za={Pi:()=>Math.PI,radiansFromDegrees:Eo,degreesFromRadians:Do,round:Lo,floor:Bo,ceil:No,ceilLog2:_o,min:ko,max:Fo,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let a=t,i=e.length;a=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:zo,add:Ho,subtract:jo,multiplyScalar:Ko,multiplyScalar2D:$o,multiplyAccumulate:qo,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Xo,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Yo,norm:Zo,normalize:Qo,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],a=e[1]*e[1],i=e[2]*e[2],s=Math.sqrt(o+a+i);let l,c,u;o>a&&o>i?(l=0,c=1,u=2):a>i?(l=1,c=2,u=0):(l=2,c=0,u=1);const d=e[l]/s,p=e[c]/s,f=e[u]/s,g=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/g,t[c]=e*g,t[u]=(-d*o-p*f*e)/g),n&&(n[l]=(-f*e-d*p*o)/g,n[c]=o*g,n[u]=(d*e-p*f*o)/g)}else t&&(t[l]=f/g,t[c]=0,t[u]=-d/g),n&&(n[l]=-d*p/g,n[c]=g,n[u]=-p*f/g)},projectVector:function(e,t,n){const r=Xo(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Xo(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Ko(n,o),!0},projectVector2D:function(e,t,n){const r=Jo(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Jo(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return $o(n,o),!0},distance2BetweenPoints:ea,angleBetweenVectors:function(e,t){const n=[0,0,0];return Yo(e,t,n),Math.atan2(Zo(n),Xo(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Jo,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:na,normalize2D:ra,determinant2x2:oa,LUFactor3x3:function(e,t){let n,r,o;const a=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),a[t]=1/o;o=a[0]*Math.abs(e[0]),n=0,(r=a[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=a[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(Mo(e,3,n,0),a[n]=a[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=a[1]*Math.abs(e[4]),n=1,(r=a[2]*Math.abs(e[7]))>=o&&(n=2,Mo(e,3,1,2),a[2]=a[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],a=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=+oa(s,u,l,d),f=-oa(i,c,l,d),g=+oa(i,c,s,u),m=-oa(o,u,a,d),h=+oa(r,c,a,d),v=-oa(r,c,o,u),y=+oa(o,s,a,l),b=-oa(r,i,a,l),x=+oa(r,i,o,s),T=r*p+o*f+a*g,C=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+h*t[1]+b*t[2],A=g*t[0]+v*t[1]+x*t[2];n[0]=C/T,n[1]=S/T,n[2]=A/T},multiply3x3_vect3:aa,multiply3x3_mat3:ia,multiplyMatrix:function(e,t,n,r,o,a,i){r!==o&&Po("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:So;return ua(e,To,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:So;return ua(e,Co,t)},determinant3x3:la,quaternionToMatrix3x3:fa,areEquals:ca,areMatricesEqual:ua,roundNumber:ga,roundVector:ma,matrix3x3ToQuaternion:va,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],a=e[0]*t[2],i=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],c=e[1]*t[2],u=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],g=e[2]*t[3],m=e[3]*t[0],h=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+g-v,n[2]=a-u+d+h,n[3]=i+c-p+m},orthogonalize3x3:ya,diagonalize3x3:ba,singularValueDecomposition3x3:function(e,t,n,r){let o;const a=[...e],i=la(a);if(i<0)for(o=0;o<9;o++)a[o]=-a[o];ya(a,t),sa(a,a),ia(a,t,r),ba(r,n,r),ia(t,r,t),sa(r,r),i<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:Ca,invertMatrix:Sa,luFactorLinearSystem:xa,luSolveLinearSystem:Ta,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(eAo&&(p=0,s[u]=0);if(p&&1===o)return Io("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),Aa(e,t,n,a);if(p)g=1;else for(u=0;u1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:function(e,t){let n,r;const[o,a,i]=e,s=1/6;let l=o,c=o;a>l?l=a:al?l=i:i0?(l-c)/l:0,r>0?(n=o===l?s*(a-i)/(l-c):a===l?.3333333333333333+s*(i-o)/(l-c):.6666666666666666+s*(o-a)/(l-c),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=u},hsv2rgb:Pa,lab2xyz:Ia,xyz2lab:wa,xyz2rgb:Oa,rgb2xyz:Ma,rgb2lab:function(e,t){const n=[0,0,0];Ma(e,n),wa(n,t)},lab2rgb:function(e,t){const n=[0,0,0];Ia(e,n),Oa(n,t)},uninitializeBounds:Ra,areBoundsInitialized:Va,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:Ea,clampVector:Da,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:La,getAdjustedScalarRange:Ba,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=Vo(3),a=Vo(3),i=Vo(3),s=Vo(3),l=Vo(3),c=Vo(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],a[r]=t[r]-n[r],i[r]=n[r]-e[r],s[r]=-o[r],l[r]=-a[r],c[r]=-i[r];const u=Zo(s),d=Zo(l),p=Zo(i),f=Vo(3);Yo(o,a,f);const g=Zo(f),m=u*d*p/(2*g),h=2*g*g,v=d*d*Xo(o,c)/h,y=p*p*Xo(s,a)/h,b=u*u*Xo(i,l)/h;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:e=>!Number.isFinite(e),isNan:ka,isNaN:ka,isFinite:Na,createUninitializedBounds:_a,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:Ga,floatToHex2:Ua,floatRGB2HexCode:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ua).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Wa).join(", ")})`:`rgba(${Wa(e[0]||0)}, ${Wa(e[1]||0)}, ${Wa(e[2]||0)}, ${e[3]||0})`}};const Ha=1e-6,ja="coincide",Ka="disjoint";function $a(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function qa(e,t,n,r){const o=[];jo(e,t,o);const a=Xo(n,o);r[0]=e[0]-a*n[0],r[1]=e[1]-a*n[1],r[2]=e[2]-a*n[2]}function Xa(e,t,n){const r=Xo(e,t);let o=Xo(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ya(e,t,n,r){const o=[];jo(e,t,o);const a=Xo(n,o),i=Xo(n,n);0!==i?(r[0]=e[0]-a*n[0]/i,r[1]=e[1]-a*n[1]/i,r[2]=e[2]-a*n[2]/i):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Za(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},a=[],i=[];jo(t,e,a),jo(n,e,i);const s=Xo(r,i),l=Xo(r,a);let c,u;return c=l<0?-l:l,u=s<0?-s*Ha:s*Ha,c<=u||(o.t=s/l,o.x[0]=e[0]+o.t*a[0],o.x[1]=e[1]+o.t*a[1],o.x[2]=e[2]+o.t*a[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function Qa(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},a=[];Yo(t,r,a);const i=a.map((e=>Math.abs(e)));if(i[0]+i[1]+i[2]i[1]&&i[0]>i[2]?"x":i[1]>i[2]?"y":"z";const l=[],c=-Xo(t,e),u=-Xo(r,n);switch(s){case"x":l[0]=0,l[1]=(u*t[2]-c*r[2])/a[0],l[2]=(c*r[1]-u*t[1])/a[0];break;case"y":l[0]=(c*r[2]-u*t[2])/a[1],l[1]=0,l[2]=(u*t[0]-c*r[0])/a[1];break;case"z":l[0]=(u*t[1]-c*r[1])/a[2],l[1]=(c*r[0]-u*t[0])/a[2],l[2]=0}return o.l0=l,Ho(l,a,o.l1),o.intersection=!0,o}const Ja={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:$a,projectPoint:qa,projectVector:Xa,generalizedProjectPoint:Ya,intersectWithLine:Za,intersectWithPlane:Qa,DISJOINT:Ka,COINCIDE:ja};function ei(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>$a(e,t.origin,t.normal),e.projectPoint=(e,n)=>{qa(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>Xa(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ya(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Za(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>Qa(e,n,t.origin,t.normal)}const ti={normal:[0,0,1],origin:[0,0,0]};function ni(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ti,n),jt.obj(e,t),jt.setGetArray(e,t,["normal","origin"],3),ei(e,t)}var ri={newInstance:jt.newInstance(ni,"vtkPlane"),extend:ni,...Ja};const oi=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function ai(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function ii(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function si(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function li(e){return si(e,oi)}function ci(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=ot?a:t,e[2]=in?s:n,e[4]=lr?c:r,e}function ui(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;na?t:a,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>c?r:c,o!==t||i!==n||l!==r}function fi(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function hi(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function vi(e,t){return e[2*t+1]-e[2*t]}function yi(e){return[vi(e,0),vi(e,1),vi(e,2)]}function bi(e){return e.slice(0,2)}function xi(e){return e.slice(2,4)}function Ti(e){return e.slice(4,6)}function Ci(e){const t=yi(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function Si(e){if(ii(e)){const t=yi(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function Ai(e){return[e[0],e[2],e[4]]}function Pi(e){return[e[1],e[3],e[5]]}function Ii(e,t){return e<=0&&t>=0||e>=0&&t<=0}function wi(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let a=4;a<6;a++)t[n++]=[e[r],e[o],e[a]];return t}function Oi(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function Mi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=wi(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function Vi(e,t,n,r){const o=[].concat(oi),a=e.getData();for(let e=0;ee[2*n+1]?(i[n]=0,c[n]=e[2*n+1],a=!1):i[n]=2;if(a)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==i[e]&&0!==n[e]?l[e]=(c[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=c[o];return 1}function Di(e,t,n){const r=[];let o=0,a=1,i=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=ri.evaluate(n,t,r),i&&(a=o>=0?1:-1,i=0),0===o||a>0&&o<0||a<0&&o>0)return 1}}return 0}function Li(e,t){if(!ii(e)||!ii(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function Bi(e,t){if(!ii(e)||!ii(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function Ni(e,t,n,r){return!(te[1]||ne[3]||re[5])}function ki(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let a=0;for(let r=0;r<2;r++)for(let i=2;i<4;i++)for(let s=4;s<6;s++){const l=[e[r],e[i],e[s]];o[a++]=ri.evaluate(n,t,l)}let i=2;for(;i--&&!(Ii(o[r[i][0]],o[r[i][4]])&&Ii(o[r[i][1]],o[r[i][5]])&&Ii(o[r[i][2]],o[r[i][6]])&&Ii(o[r[i][3]],o[r[i][7]])););if(i<0)return!1;const s=Math.sign(n[i]),l=Math.abs((e[2*i+1]-e[2*i])*n[i]);let c=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[i][e]])/l;s>0&&tc&&(c=t)}const u=(1-c)*e[2*i]+c*e[2*i+1];return s>0?e[2*i]=u:e[2*i+1]=u,!0}class Fi{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(oi))}getBounds(){return this.bounds}equals(e){return ai(this.bounds,e)}isValid(){return ii(this.bounds)}setBounds(e){return si(this.bounds,e)}reset(){return li(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return Mi(this.bounds,e,t)}computeScale3(e){return Ri(this.bounds,e)}cutWithPlane(e,t){return ki(this.bounds,e,t)}intersectBox(e,t,n,r){return Ei(this.bounds,e,t,n,r)}intersectPlane(e,t){return Di(this.bounds,e,t)}intersect(e){return Li(this.bounds,e)}intersects(e){return Bi(this.bounds,e)}containsPoint(e,t,n){return Ni(this.bounds,e,t,n)}contains(e){return Bi(this.bounds,e)}}const _i={equals:ai,isValid:ii,setBounds:si,reset:li,addPoint:ci,addPoints:ui,addBounds:di,setMinPoint:pi,setMaxPoint:fi,inflate:gi,scale:mi,scaleAboutCenter:function(e,t,n,r){if(!ii(e))return!1;const o=hi(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],mi(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:hi,getLength:vi,getLengths:yi,getMaxLength:Ci,getDiagonalLength:Si,getMinPoint:Ai,getMaxPoint:Pi,getXRange:bi,getYRange:xi,getZRange:Ti,getCorners:wi,computeCornerPoints:Oi,computeLocalBounds:Vi,transformBounds:Mi,computeScale3:Ri,cutWithPlane:ki,intersectBox:Ei,intersectPlane:Di,intersect:Li,intersects:Bi,containsPoint:Ni,contains:function(e,t){return!!Bi(e,t)&&!!Ni(e,...Ai(t))&&!!Ni(e,...Pi(t))},INIT_BOUNDS:oi};var Gi,Ui={newInstance:function(e){const t=e&&e.bounds;return new Fi(t)},..._i};function Wi(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function zi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*a+n[12]*i,e[1]=n[1]*r+n[5]*o+n[9]*a+n[13]*i,e[2]=n[2]*r+n[6]*o+n[10]*a+n[14]*i,e[3]=n[3]*r+n[7]*o+n[11]*a+n[15]*i,e}function Hi(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ji(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Ki(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=r*u+i*s+o*c-a*l,e[1]=o*u+i*l+a*s-r*c,e[2]=a*u+i*c+r*l-o*s,e[3]=i*u-r*s-o*l-a*c,e}Gi=new i(4),i!=Float32Array&&(Gi[0]=0,Gi[1]=0,Gi[2]=0,Gi[3]=0);var $i,qi,Xi,Yi=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o},Zi=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},Qi=function(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n*n+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=o*i,e[3]=a*i,e},Ji=($i=Cn(),qi=An(1,0,0),Xi=An(0,1,0),function(e,t,n){var r=En(t,n);return r<-.999999?(Dn($i,qi,t),Un($i)<1e-6&&Dn($i,Xi,t),Vn($i,$i),ji(e,$i,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Dn($i,t,n),e[0]=$i[0],e[1]=$i[1],e[2]=$i[2],e[3]=1+r,Qi(e,e))});Hi(),Hi(),ie();var es={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:ts}=es;function ns(e){return()=>jt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function rs(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=ns("pick"),e.hasKey=ns("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(ts.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(ts.DISPLAY)}const os={allocatedRenderTime:10,coordinateSystem:ts.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function as(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,os,n),jt.obj(e,t),jt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),jt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),jt.moveToProtected(e,t,["parentProp"]),rs(e,t)}var is={newInstance:jt.newInstance(as,"vtkProp"),extend:as,...es};function ss(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Hi();N(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>a?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[Do(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(S(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateY=n=>{0!==n&&(A(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateZ=n=>{0!==n&&(P(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateWXYZ=(n,r,o,a)=>{if(0===n||0===r&&0===o&&0===a)return;const i=Eo(n),s=Hi();ji(s,[r,o,a],i);const l=new Float64Array(16);_(l,s),b(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],g(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!ua(t.userMatrix,n)&&(d(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){g(t.matrix),t.userMatrix&&b(t.matrix,t.matrix,t.userMatrix),x(t.matrix,t.matrix,t.origin),x(t.matrix,t.matrix,t.position),b(t.matrix,t.matrix,t.rotation),T(t.matrix,t.matrix,t.scale),x(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),m(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>Ui.getCenter(t.bounds),e.getLength=()=>Ui.getLength(t.bounds),e.getXRange=()=>Ui.getXRange(t.bounds),e.getYRange=()=>Ui.getYRange(t.bounds),e.getZRange=()=>Ui.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const ls={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function cs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ls,n),is.extend(e,t,n),t.matrixMTime={},jt.obj(t.matrixMTime),jt.get(e,t,["bounds","isIdentity"]),jt.getArray(e,t,["orientation"]),jt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=g(new Float64Array(16)),t.rotation=g(new Float64Array(16)),t.userMatrix=g(new Float64Array(16)),t.transform=null,ss(e,t)}var us={newInstance:jt.newInstance(cs,"vtkProp3D"),extend:cs};const ds={FLAT:0,GOURAUD:1,PHONG:2},ps={POINTS:0,WIREFRAME:1,SURFACE:2};var fs={Shading:ds,Representation:ps,Interpolation:ds};const{Representation:gs,Interpolation:ms}=fs;function hs(e){return()=>jt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function vs(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=hs("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=hs("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(ms.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(ms.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(ms.PHONG),e.getInterpolationAsString=()=>jt.enumToString(ms,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(gs.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(gs.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(gs.POINTS),e.getRepresentationAsString=()=>jt.enumToString(gs,t.representation)}const ys={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:ms.GOURAUD,representation:gs.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function bs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ys,n),jt.obj(e,t),jt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),jt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),vs(e,t)}var xs={newInstance:jt.newInstance(bs,"vtkProperty"),extend:bs,...fs};const{vtkDebugMacro:Ts}=jt;function Cs(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=xs.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ts("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];Ui.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);m(o,t.matrix),r.forEach((e=>Ln(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Ss={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function As(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ss,n),us.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Cs(e,t)}var Ps={newInstance:jt.newInstance(As,"vtkActor"),extend:As};const Is={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ws={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var Os={DefaultDataType:ws.FLOAT,DataTypeByteSize:Is,VtkDataTypes:ws};const{vtkErrorMacro:Ms}=Kt,{DefaultDataType:Rs}=Os,Vs=1e-6;function Es(e,t,n){const r=e.length;let o,a,i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(a=t;as&&(s=o);return{min:i,max:s}}function Ds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,a=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Bs(e){return Object.prototype.toString.call(e).slice(8,-1)}const Ns={computeRange:Ds,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Es,getDataType:Bs,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=a)}return n}};function ks(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=at(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,a=n%t.numberOfComponents;e.setComponent(o,a,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Ls(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=Ds(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Ls(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const a=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vs;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,a=(r??e.getNumberOfTuples())*t.numberOfComponents,i=e.getData().subarray(o,a);return i.length>0?i:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Gs({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Bs(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,a,i,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===a.getNumberOfComponents()||Ms("numberOfComponents must match");const c=r.getTuple(o),u=a.getTuple(i),d=[];switch(d.length=l,l){case 4:d[3]=c[3]+(u[3]-c[3])*s;case 3:d[2]=c[2]+(u[2]-c[2])*s;case 2:d[1]=c[1]+(u[1]-c[1])*s;case 1:d[0]=c[0]+(u[0]-c[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Fs,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=it(t.dataType,t.values)):t.values=at(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Bs(t.values)),yt(e,t),St(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");ks(e,t)}const Gs=Et(_s,"vtkDataArray");var Us={newInstance:Gs,extend:_s,...Ns,...Os};function Ws(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,a=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),jt.obj(e,t),jt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Ws(e,t)};function js(e,t){e.getBounds=()=>(jt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),_a()),e.getCenter=()=>{const n=e.getBounds();return t.center=Ui.isValid(n)?Ui.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return Ui.getDiagonalLength(t)}}const Ks=e=>({bounds:[...Ui.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var $s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ks(n)),Hs(e,t,n),jt.setGet(e,t,["viewSpecificProperties"]),js(e,t)};const{vtkErrorMacro:qs,vtkWarningMacro:Xs}=jt;function Ys(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:ze(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:a}=e.getArrayWithIndex(r);return null!=o?(t.arrays[a]={data:n},a):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((a=>{const i=e.getFlag(a.getName());if(!1!==i&&(!t.doCopyAllOff||!0===i)&&a){let t=e.getArrayByName(a.getName());if(t)if(a.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,a.getTuple(r))}else t.insertTuples(0,a.getTuples());else qs("Unhandled case in passData");else if(r<0||r>a.getNumberOfTuples())e.addArray(a),n.getAttributes(a).forEach((t=>{e.setAttribute(a,t)}));else{const i=a.getNumberOfComponents();let s=a.getNumberOfValues();const l=o>-1?o:r;s<=l*i&&(s=(l+1)*i),t=Us.newInstance({name:a.getName(),dataType:a.getDataType(),numberOfComponents:i,values:jt.newTypedArray(a.getDataType(),s),size:0}),t.insertTuple(l,a.getTuple(r)),e.addArray(t),n.getAttributes(a).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?a:r;t.interpolateTuple(e,s,r,s,o,i),Xs("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else qs("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let c=s.getNumberOfValues();const u=a>-1?a:r;c<=u*l&&(c=(u+1)*l),t=Us.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:jt.newTypedArray(s.getDataType(),c),size:0}),t.interpolateTuple(u,s,r,s,o,i),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Zs={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zs,n),jt.obj(e,t),Ys(e,t)}var Js={newInstance:jt.newInstance(Qs,"vtkFieldData"),extend:Qs},el={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:tl,AttributeCopyOperations:nl}=el,{vtkWarningMacro:rl}=jt;function ol(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>tl[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const a=r(o);if(n&&"PEDIGREEIDS"===a.toUpperCase()&&!n.isA("vtkDataArray"))return rl(`Cannot set attribute ${a}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,a))return rl(`Cannot set attribute ${a}. Incorrect number of components.`),-1;let i=t[`active${a}`];if(i>=0&&in.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const a=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[nl.PASSDATA][tl[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[nl.PASSDATA][tl[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(nl).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[nl[e]]=Object.keys(tl).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[tl[t]]=!0,e)),[])})),t.copyAttributeFlags[nl.COPYTUPLE][tl.GLOBALIDS]=!1,t.copyAttributeFlags[nl.INTERPOLATE][tl.GLOBALIDS]=!1,t.copyAttributeFlags[nl.COPYTUPLE][tl.PEDIGREEIDS]=!1},e.initialize=jt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Us.newInstance(t.dataArrays[n]))}));const a=e.shallowCopy;e.shallowCopy=(e,n)=>{a(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const al={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function il(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,al,n),Js.extend(e,t,n),jt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ol(e,t)}var sl={newInstance:jt.newInstance(il,"vtkDataSetAttributes"),extend:il,...el};const ll={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};var cl={FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:ll};const ul=["pointData","cellData","fieldData"];function dl(e,t){t.classHierarchy.push("vtkDataSet"),ul.forEach((e=>{t[e]?t[e]=ze(t[e]):t[e]=sl.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),ul.forEach((n=>{t[n]=sl.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const pl={};function fl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pl,n),jt.obj(e,t),jt.setGet(e,t,ul),dl(e,t)}var gl={newInstance:jt.newInstance(fl,"vtkDataSet"),extend:fl,...cl};const ml={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var hl={StructuredType:ml};const{StructuredType:vl}=hl;var yl={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?vl.EMPTY:3===t?vl.XYZ_GRID:2===t?e[0]===e[1]?vl.YZ_PLANE:e[2]===e[3]?vl.XZ_PLANE:vl.XY_PLANE:1===t?e[0]e!==a[t]));return i&&(t.extent=a.slice(),t.dataDescription=yl.getDataDescriptionFromExtent(t.extent),e.modified()),i},e.setDimensions=function(){let n,r,o;if(t.deleted)bl("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void bl("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return bl("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case ml.EMPTY:return null;case ml.SINGLE_POINT:break;case ml.X_LINE:o[0]=n;break;case ml.Y_LINE:o[1]=n;break;case ml.Z_LINE:o[2]=n;break;case ml.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case ml.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case ml.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case ml.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:bl("Invalid dataDescription")}const a=[0,0,0];return e.indexToWorld(o,a),a},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>Ui.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>Ui.inflate([...t.extent],.5),e.computeTransforms=()=>{I(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],T(t.indexToWorld,t.indexToWorld,t.spacing),h(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ln(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ln(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ui.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ui.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>Ui.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],a=[0,0,0];Ui.computeCornerPoints(r,o,a),ma(o,o),ma(a,a);const i=e.getDimensions();Da(o,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],o),Da(a,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],a);const s=i[0],l=i[0]*i[1],c=e.getPointData().getScalars().getData();let u=-1/0,d=1/0,p=0,f=0,g=0;for(let e=o[2];e<=a[2];e++)for(let t=o[1];t<=a[1];t++){let i=o[0]+t*s+e*l;for(let s=o[0];s<=a[0];s++){if(!n||n([s,t,e],r)){const e=c[i];e>u&&(u=e),e0?f/g:0,h=g?Math.abs(p/g-m*m):0,v=Math.sqrt(h);return{minimum:d,maximum:u,average:m,variance:h,sigma:v,count:g}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const a=e.getExtent(),i=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(a,i);return Math.floor((Math.round(n)-a[0])*s[0]+(Math.round(r)-a[2])*s[1]+(Math.round(o)-a[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return bl(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return bl(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Tl={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:ml.EMPTY};function Cl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),gl.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=pe(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),jt.get(e,t,["indexToWorld","worldToIndex"]),jt.setGetArray(e,t,["origin","spacing"],3),jt.setGetArray(e,t,["direction"],9),jt.getArray(e,t,["extent"],6),xl(e,t)}var Sl={newInstance:jt.newInstance(Cl,"vtkImageData"),extend:Cl};const Al={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Pl={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:Al};const Il={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5};var wl={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:Il};const{ScalarMappingTarget:Ol,VectorMode:Ml}=Pl,{VtkDataTypes:Rl}=Us,{ColorMode:Vl}=wl,{vtkErrorMacro:El}=jt;function Dl(e){return e}function Ll(e){return Math.floor(255*e+.5)}function Bl(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Ml.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Ml.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Ml.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)El("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),a=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,a=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,a=!0),a&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let a=null;if(n===Vl.DEFAULT&&t.getDataType()===Rl.UNSIGNED_CHAR||n===Vl.DIRECT_SCALARS&&t)a=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:Rl.UNSIGNED_CHAR},i=jt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=i,n.size=i.length,a=Us.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,a,Ol.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,a,Ol.RGBA,s))}return a},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),a=t.getData(),i=e.getData();for(let e=0;e{let i=e.getVectorMode(),s=a,l=o;const c=t.getNumberOfComponents();i===Ml.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=c&&(l=c-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=c):(l<0&&(l=0),l>=c&&(l=c-1),l+s>c&&(s=c-l)),i!==Ml.MAGNITUDE||1!==c&&1!==s||(i=Ml.COMPONENT));let u=0;switch(l>0&&(u=l),i){case Ml.COMPONENT:e.mapScalarsThroughTable(t,n,r,u);break;case Ml.RGBCOLORS:break;case Ml.MAGNITUDE:default:{const o=Us.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{const o=Ll(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{let{alpha:a}=t;if(4===r&&a>=1&&n.getDataType()===Rl.UNSIGNED_CHAR)return n;const i=Us.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:Rl.UNSIGNED_CHAR});if(o<=0)return i;a=a>0?a:0,a=a<1?a:1;let s=Dl;switch(n.getDataType()!==Rl.FLOAT&&n.getDataType()!==Rl.DOUBLE||(s=Ll),r){case 1:e.luminanceToRGBA(i,n,a,s);break;case 2:e.luminanceAlphaToRGBA(i,n,s);break;case 3:e.rGBToRGBA(i,n,a,s);break;case 4:e.rGBAToRGBA(i,n,a,s);break;default:return El("Cannot convert colors"),null}return i},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const a=n.getNumberOfComponents();return(r!==Vl.DEFAULT||n.getDataType()!==Rl.UNSIGNED_CHAR)&&r!==Vl.DIRECT_SCALARS||(3===a||1===a?t.alpha>=1:255===n.getRange(a-1)[0])}}const Nl={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Ml.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function kl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nl,n),jt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],jt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),jt.setArray(e,t,["mappingRange"],2),jt.getArray(e,t,["mappingRange"]),Bl(e,t)}var Fl={newInstance:jt.newInstance(kl,"vtkScalarsToColors"),extend:kl,...Pl};const{vtkErrorMacro:_l}=jt;function Gl(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Fa(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const a=4*o;return n.slice(a,a+4)},e.indexedLookupFunction=(n,r,o)=>{let a=e.getAnnotatedValueIndexInternal(n);-1===a&&(a=t.numberOfColors+2);const i=4*a;return[r[i],r[i+1],r[i+2],r[i+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,a)=>{let i=e.linearLookup;t.indexedLookup&&(i=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const c=e.getAlpha(),u=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(c>=1){if(o===Al.RGBA)for(let e=0;e{let n=0,r=0,o=0,a=0;const i=t.numberOfColors-1;i&&(n=(t.hueRange[1]-t.hueRange[0])/i,r=(t.saturationRange[1]-t.saturationRange[0])/i,o=(t.valueRange[1]-t.valueRange[0])/i,a=(t.alphaRange[1]-t.alphaRange[0])/i),t.table.length=4*i+16;const s=[],l=[];for(let e=0;e<=i;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,Pa(s,l),l[3]=t.alphaRange[0]+e*a,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let a=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Ul={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Wl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ul,n),Fl.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},jt.obj(t.buildTime),t.opaqueFlagBuildTime={},jt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},jt.obj(t.insertTime,{mtime:0}),jt.get(e,t,["buildTime"]),jt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),jt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),jt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),jt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Gl(e,t)}var zl={newInstance:jt.newInstance(Wl,"vtkLookupTable"),extend:Wl};let Hl=1,jl=0;const Kl=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function $l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;jl=e}var ql={getResolveCoincidentTopologyAsString:function(){return Kl[jl]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return Hl},getResolveCoincidentTopology:function(){return jl},setResolveCoincidentTopology:$l,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){Hl=e},setResolveCoincidentTopologyToDefault:function(){$l(0)},setResolveCoincidentTopologyToOff:function(){$l(0)},setResolveCoincidentTopologyToPolygonOffset:function(){$l(1)}};function Xl(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const Yl=["Polygon","Line","Point"],Zl={};Xl(Zl,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},Yl.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var Ql={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),jt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(ql).forEach((t=>{e[t]=ql[t]})),Object.keys(Zl).forEach((t=>{e[t]=Zl[t]})),Xl(e,t.topologyOffset,Yl.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=Zl.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=Zl.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=Zl.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:Zl,otherStaticMethods:ql,CATEGORIES:Yl};const Jl={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var ec={PassTypes:Jl};const{FieldAssociations:tc}=gl,{staticOffsetAPI:nc,otherStaticMethods:rc}=Ql,{ColorMode:oc,ScalarMode:ac,GetArray:ic}=wl,{VectorMode:sc}=Pl,{VtkDataTypes:lc}=Us;function cc(e){return()=>jt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function uc(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=_a(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=zl.newInstance()},e.getColorModeAsString=()=>jt.enumToString(oc,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(ac,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===ac.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===ac.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===ac.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===ac.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ac.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ac.USE_FIELD_DATA){const t=e.getFieldData();i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==a){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Fa(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,a,i,s,l,c)=>{const u=(i[1]-i[0])/l,d=[];d[0]=i[0]-u,d[1]=i[1]+u;const p=1/(d[1]-d[0]),f=n.getData(),g=t.getData();let m=0,h=0;if(a<0||a>=o)for(let t=0;t{const o=t.lookupTable.getRange(),a=t.lookupTable.usingLogScale();a&&zl.getLogRange(o,o);const i=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),i=n.getNumberOfTuples();t.colorCoordinates=Us.newInstance({numberOfComponents:2,values:new Float32Array(2*i)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===sc.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,i,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,a)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===oc.DEFAULT&&o.getDataType()===lc.UNSIGNED_CHAR||t.colorMode===oc.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=cc("AcquireInvertibleLookupTable"),e.valueToColor=cc("ValueToColor"),e.colorToValue=cc("ColorToValue"),e.useInvertibleColorFor=cc("UseInvertibleColorFor"),e.clearInvertibleColor=cc("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(Jl.ID_LOW24),o=e.getRawPixelBuffer(Jl.ID_HIGH24),a=e.getCurrentPass(),i=e.getFieldAssociation();let s=null;i===tc.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:i===tc.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(a===Jl.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const a=s[n],i=e.getPixelBuffer(Jl.ID_LOW24);i[t]=255&a,i[t+1]=(65280&a)>>8,i[t+2]=(16711680&a)>>16}else if(a===Jl.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const a=s[n];e.getPixelBuffer(Jl.ID_HIGH24)[t]=(4278190080&a)>>24}}))}}const dc={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dc,n),$s(e,t,n),jt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),jt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),Ql.implementCoincidentTopologyMethods(e,t),uc(e,t)}var fc={newInstance:jt.newInstance(pc,"vtkMapper"),extend:pc,...nc,...rc,...wl};function gc(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function mc(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=mc(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=gc(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const a=e.getNumberOfTuples();a{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function yc(e){return{empty:!0,numberOfComponents:1,dataType:ws.UNSIGNED_INT,...e}}function bc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Us.extend(e,t,yc(n)),vc(e,t)}var xc={newInstance:jt.newInstance(bc,"vtkCellArray"),extend:bc,...hc};const{vtkErrorMacro:Tc}=jt,Cc=[1,-1,1,-1,1,-1];function Sc(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=jt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Tc(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Cc;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const Ac={empty:!0,numberOfComponents:3,dataType:ws.FLOAT,bounds:[1,-1,1,-1,1,-1]};function Pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),Us.extend(e,t,n),Sc(e,t)}var Ic={newInstance:jt.newInstance(Pc,"vtkPoints"),extend:Pc};function wc(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=jt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,a=3*t;r[a]=o[n],r[++a]=o[++n],r[++a]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else Ra(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,a,i)=>{},e.evaluatePosition=(e,t,n,r,o,a)=>{jt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const Oc={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function Mc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Oc,n),jt.obj(e,t),t.points||(t.points=Ic.newInstance()),jt.get(e,t,["points","pointsIds"]),wc(e,t)}var Rc={newInstance:jt.newInstance(Mc,"vtkCell"),extend:Mc};function Vc(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const Ec={array:null,maxId:0,extend:0};function Dc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ec,n),jt.obj(e,t),Vc(e,t)}var Lc={newInstance:jt.newInstance(Dc,"vtkCellLinks"),extend:Dc};const Bc=0,Nc=1,kc=2,Fc=3,_c=4,Gc=5,Uc=6,Wc=7,zc=9,Hc=21,jc=41,Kc=42,$c=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],qc={getClassNameFromTypeId:function(e){return e<$c.length?$c[e]:"UnknownClass"},getTypeIdFromClassName:function(e){return $c.findIndex(e)},isLinear:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=Bc},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Yc={size:0,maxId:-1,extend:1e3};function Zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yc,n),jt.obj(e,t),jt.get(e,t,["size","maxId","extend"]),jt.getArray(e,t,["typeArray","locationArray"]),Xc(e,t)}var Qc={newInstance:jt.newInstance(Zc,"vtkCellTypes"),extend:Zc,...qc},Jc={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};const{IntersectionState:eu}=Jc;function tu(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},a=[];let i;a[0]=n[0]-t[0],a[1]=n[1]-t[1],a[2]=n[2]-t[2];const s=a[0]*(e[0]-t[0])+a[1]*(e[1]-t[1])+a[2]*(e[2]-t[2]),l=Xo(a,a);let c=1e-5*s;return 0!==l&&(o.t=s/l),c<0&&(c=-c),-c1?i=n:(i=a,a[0]=t[0]+o.t*a[0],a[1]=t[1]+o.t*a[1],a[2]=t[2]+o.t*a[2]),r&&(r[0]=i[0],r[1]=i[1],r[2]=i[2]),o.distance=ea(i,e),o}function nu(e,t,n,r,o,a){const i=[],s=[],l=[];o[0]=0,a[0]=0,jo(t,e,i),jo(r,n,s),jo(n,e,l);const c=[Xo(i,i),-Xo(i,s),-Xo(i,s),Xo(s,s)],u=[];if(u[0]=Xo(i,l),u[1]=-Xo(s,l),0===Ca(c,u,2)){let i=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],c=[r,r,t,t];let u;a[0],a[0],o[0],o[0],o[0],o[0],a[0],a[0];for(let e=0;e<4;e++)u=tu(s[e],l[e],c[e]),u.distance=0&&o[0]<=1&&a[0]>=0&&a[0]<=1?eu.YES_INTERSECTION:eu.NO_INTERSECTION}const ru={distanceToLine:tu,intersection:nu};function ou(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,a)=>{const i={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};a[1]=0,a[2]=0;const s=[],l=[],c=[];t.points.getPoint(0,l),t.points.getPoint(1,c);const u=[],d=[],p=nu(e,n,l,c,u,d);var f;if(i.t=u[0],i.betweenPoints=(f=i.t)>=0&&f<=1,a[0]=d[0],p===eu.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+a[0]*(c[t]-l[t]),s[t]=e[t]+i.t*(n[t]-e[t]);if(ea(o,s)<=r*r)return i.intersect=1,i}else{let t;if(i.t<0)return t=tu(e,l,c,o),t.distance<=r*r?(i.t=0,i.intersect=1,i.betweenPoints=!0,i):i;if(i.t>1)return t=tu(n,l,c,o),t.distance<=r*r?(i.t=1,i.intersect=1,i.betweenPoints=!0,i):i;if(a[0]<0)return a[0]=0,t=tu(l,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i;if(a[0]>1)return a[0]=1,t=tu(c,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i}return i},e.evaluateLocation=(e,n,r)=>{const o=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,a);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(a[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var o,i,s,l,c,u=t[0],d=t[1],p=t[2],f=t[3],g=n[0],m=n[1],h=n[2],v=n[3];(i=u*g+d*m+p*h+f*v)<0&&(i=-i,g=-g,m=-m,h=-h,v=-v),1-i>a?(o=Math.acos(i),s=Math.sin(o),l=Math.sin((1-r)*o)/s,c=Math.sin(r*o)/s):(l=1-r,c=r),e[0]=l*u+c*g,e[1]=l*d+c*m,e[2]=l*p+c*h,e[3]=l*f+c*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const au={orientations:null};function iu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,au,n),Rc.extend(e,t,n),jt.setGet(e,t,["orientations"]),ou(e,t)}var su={newInstance:jt.newInstance(iu,"vtkLine"),extend:iu,...ru,...Jc};function lu(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=ze(t.points):t.points=Ic.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=Ic.newInstance(),t.points.shallowCopy(e.getPoints())}}const cu={};function uu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cu,n),gl.extend(e,t,n),jt.setGet(e,t,["points"]),lu(e,t)}var du={newInstance:jt.newInstance(uu,"vtkPointSet"),extend:uu};function pu(e,t,n,r){const o=n[0]-t[0],a=n[1]-t[1],i=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],c=e[2]-t[2];r[0]=a*c-i*l,r[1]=i*s-o*c,r[2]=o*l-a*s}function fu(e,t,n,r){pu(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const gu={computeNormalDirection:pu,computeNormal:fu,intersectWithTriangle:function(e,t,n,r,o,a){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],c=[],u=[],d=[],p=[];fu(e,t,n,d),fu(r,o,a,p);const f=-Xo(d,e),g=-Xo(p,r),m=[Xo(p,e)+g,Xo(p,t)+g,Xo(p,n)+g];if(m[0]*m[1]>i&&m[0]*m[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const h=[Xo(d,r)+f,Xo(d,o)+f,Xo(d,a)+f];if(h[0]*h[1]>i&&h[0]*h[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-g)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const v=[e,t,n],y=[r,o,a],b=Xo(d,p),x=(f-g*b)/(b*b-1),T=(g-f*b)/(b*b-1),C=[x*d[0]+T*p[0],x*d[1]+T*p[1],x*d[2]+T*p[2]],S=Yo(d,p,[]);Qo(S);let A=0,P=0;const I=[],w=[];let O,M,R=50,V=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,a=ri.intersectWithLine(v[n],v[o],r,p);a.intersection&&a.t>0-i&&a.t<1+i&&(a.t<1+i&&a.t>1-i&&(R=A),I[A++]=Xo(a.x,S)-Xo(C,S));const s=ri.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-i&&s.t<1+i&&(s.t<1+i&&s.t>1-i&&(V=P),w[P++]=Xo(s.x,S)-Xo(C,S))}if(A>2){A--;const e=I[2];I[2]=I[R],I[R]=e}if(P>2){P--;const e=w[2];w[2]=w[V],w[V]=e}if(2!==A||2!==P)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Number.isNaN(I[0])||Number.isNaN(I[1])||Number.isNaN(w[0])||Number.isNaN(w[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(I[0]>I[1]){const e=I[1];I[1]=I[0],I[0]=e}if(w[0]>w[1]){const e=w[1];w[1]=w[0],w[0]=e}return I[1]2,e.intersectWithLine=(n,r,o,a,i)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};i[2]=0;const l=[],c=o*o,u=[],d=[],p=[];t.points.getPoint(0,u),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],g=[];if(fu(u,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=ri.intersectWithLine(n,r,u,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,a[0]=t.x[0],a[1]=t.x[1],a[2]=t.x[2],!t.intersection)return i[0]=0,i[1]=0,s.intersect=0,s;const o=e.evaluatePosition(a,l,i,g);if(o.evaluation>=0)return o.dist2<=c?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=ea(u,d),h=ea(d,p),v=ea(p,u);t.line||(t.line=su.newInstance()),m>h&&m>v?(t.line.getPoints().setPoint(0,u),t.line.getPoints().setPoint(1,d)):h>v&&h>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,u));const y=t.line.intersectWithLine(n,r,o,a,i);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=u[r]-p[r],t[r]=d[r]-p[r],n[r]=a[r]-p[r];return i[0]=Xo(n,e)/v,i[1]=Xo(n,t)/h,s.intersect=1,s}return i[0]=0,i[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const a={subId:0,dist2:0,evaluation:-1};let i,s;const l=[],c=[],u=[],d=[];let p;const f=[],g=[],m=[];let h=0,v=0;const y=[];let b,x,T,C=[];const S=[],A=[],P=[];a.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,c),t.points.getPoint(0,u),pu(l,c,u,d),ri.generalizedProjectPoint(e,l,d,P);let I=0;for(i=0;i<3;i++)p=d[i]<0?-d[i]:d[i],p>I&&(I=p,v=i);for(s=0,i=0;i<3;i++)i!==v&&(y[s++]=i);for(i=0;i<2;i++)f[i]=P[y[i]]-u[y[i]],g[i]=l[y[i]]-u[y[i]],m[i]=c[y[i]]-u[y[i]];if(h=oa(g,m),0===h)return r[0]=0,r[1]=0,a.evaluation=-1,a;if(r[0]=oa(f,m)/h,r[1]=oa(g,f)/h,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(a.dist2=ea(P,e),n[0]=P[0],n[1]=P[1],n[2]=P[2]),a.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=ea(e,u),x=su.distanceToLine(e,l,u,t,S),T=su.distanceToLine(e,u,c,t,A),b{const o=[],a=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,a),t.points.getPoint(2,i);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+a[t]*e[0]+i[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const hu={};function vu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hu,n),Rc.extend(e,t,n),mu(e,t)}var yu={newInstance:jt.newInstance(vu,"vtkTriangle"),extend:vu,...gu};const bu=["verts","lines","polys","strips"],{vtkWarningMacro:xu}=jt,Tu={[Fc]:su,[_c]:su,[Gc]:yu};function Cu(e,t){t.classHierarchy.push("vtkPolyData"),bu.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=ze(t[n]):t[n]=xc.newInstance()})),e.getNumberOfCells=()=>bu.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),bu.forEach((n=>{t[n]=xc.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),a=e.getNumberOfStrips(),i=n+r+o+a,s=new Uint8Array(i);let l=s;const c=new Uint32Array(i);let u=c;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>1?kc:Nc,e+=t+1})),u=u.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>2?_c:Fc,1===t&&xu("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),u=u.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(u[n]=e,t){case 3:l[n]=Gc;break;case 4:l[n]=zc;break;default:l[n]=Wc}t<3&&xu("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),u+=u.subarray(o),l+=l.subarray(o)}if(a){let e=0;l.fill(Uc,0,a),t.strips.getCellSizes().forEach(((t,n)=>{u[n]=e,e+=t+1}))}t.cells=Qc.newInstance(),t.cells.setCellTypes(i,s,c)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=Lc.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case Nc:case kc:o=t.verts;break;case Fc:case _c:o=t.lines;break;case Gc:case zc:case Wc:o=t.polys;break;case Uc:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const a=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(a)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),a=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==a.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Tu[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Su={};function Au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Su,n),du.extend(e,t,n),jt.get(e,t,["cells","links"]),jt.setGet(e,t,["verts","lines","polys","strips"]),Cu(e,t)}var Pu={newInstance:jt.newInstance(Au,"vtkPolyData"),extend:Au};function Iu(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const wu={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Ou(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wu,n),jt.obj(e,t),jt.algo(e,t,6,0),jt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),jt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Iu(e,t)}const Mu={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],a=e.length/(t*n);let i=t,s=n,l=e;const c=[l];for(let e=0;ea&&(u+=t),d<-a&&(u-=t),r[u]?c+=r[u]*o[l]:s-=o[l],i+=1}l[e+n]=c/s}r=[...l];for(let e=0;e{t.renderable!==n&&(t.renderable=n,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),e.modified())},e.createPolyDataForOneLabel=(e,n,r,o,a,i,s)=>{const l=t.renderable.get_tmAtlas().get(e);if(!l)return;const c=t.renderable.getTextPolyData().getPoints().getData(),u=t.lastSize;Nu[0]=c[3*n],Nu[1]=c[3*n+1],Nu[2]=c[3*n+2],Ln(Fu,Nu,r),Fu[0]+=.1,Ln(ku,Fu,o),wn(Gu,ku,Nu),Fu[0]-=.1,Fu[1]+=.1,Ln(ku,Fu,o),wn(Uu,ku,Nu);for(let e=0;e<3;e++)Gu[e]/=.05*u[0],Uu[e]/=.05*u[1];let d=s.ptIdx,p=s.cellIdx;Nu[0]=c[3*n],Nu[1]=c[3*n+1],Nu[2]=c[3*n+2],a[0]<-.5?On(Fu,Gu,a[0]*i-l.width):a[0]>.5?On(Fu,Gu,a[0]*i):On(Fu,Gu,a[0]*i-l.width/2),In(Nu,Nu,Fu),On(Fu,Uu,a[1]*i-l.height/2),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,On(Fu,Gu,l.width),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,On(Fu,Uu,l.height),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,On(Fu,Gu,l.width),wn(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{const n=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);m(n,n);const r=t.renderable.getTextValues().length,o=4*r,a=2*r,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o);h(Wu,n);const c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l};let u=0,d=0,p=0;const f=t.renderable.getTextPolyData().getPoints().getData(),g=t.renderable.getTextValues();for(;u{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0),t.camera=r,e.updateTexturePolyData()}}const ju=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),t.tmPolyData=Pu.newInstance(),t.tmMapper=fc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=Ps.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),jt.setGet(e,t,["renderable"]),jt.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},jt.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],Hu(e,t)}),"vtkCubeAxesActorHelper");function Ku(e,t){t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=n=>{t.camera!==n&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=n,n&&(t.cameraModifiedSub=n.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{const e=t.camera.getViewMatrix();m(e,e);let n=!1;const r=Ui.getDiagonalLength(t.dataBounds),o=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let a=0;a<6;a++){let i=!1;const s=Math.floor(a/2),l=(s+1)%3,c=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*c]!==t.dataBounds[2*c+1]&&(Nu[s]=t.dataBounds[a]-.1*r*Vu[a][s],Nu[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),Nu[c]=.5*(t.dataBounds[2*c]+t.dataBounds[2*c+1]),Ln(Fu,Nu,e),Nu[s]=t.dataBounds[a],Ln(_u,Nu,e),wn(Fu,_u,Fu),Vn(Fu,Fu),i=Fu[2]>o,t.camera.getParallelProjection()||(Vn(_u,_u),i=En(_u,Fu)>o)),i!==t.lastFacesToDraw[a]&&(t.lastFacesToDraw[a]=i,n=!0)}return n},e.updatePolyData=(e,n,r)=>{let o=0,a=0;o+=8;let i=0;for(let e=0;e<12;e++)n[e]>0&&i++;if(a+=i,t.gridLines)for(let t=0;t<6;t++)e[t]&&(o+=2*r[Bu[t][0]].length+2*r[Bu[t][1]].length,a+=r[Bu[t][0]].length+r[Bu[t][1]].length);const s=new Float64Array(3*o),l=new Uint32Array(3*a);let c=0,u=0;for(let e=0;e<2;e++)for(let n=0;n<2;n++)for(let r=0;r<2;r++)s[3*c]=t.dataBounds[r],s[3*c+1]=t.dataBounds[2+n],s[3*c+2]=t.dataBounds[4+e],c++;for(let e=0;e<12;e++)n[e]>0&&(l[3*u]=2,l[3*u+1]=Du[e][0],l[3*u+2]=Du[e][1],u++);if(t.gridLines)for(let n=0;n<6;n++)if(e[n]){const e=Math.floor(n/2);let o=r[Bu[n][0]];for(let r=0;r{let a=0;for(let e=0;e<12;e++)1===n[e]&&(a+=2,a+=r[Lu[e]].length);const i=t.polyData.getPoints().getData(),s=new Float64Array(3*a);let l=0,c=0,u=0;for(let a=0;a<6;a++)if(e[a])for(let e=0;e<4;e++){const d=Eu[a][e];if(1===n[d]){const e=Lu[d],n=3*Du[d][0],p=3*Du[d][1];s[3*l]=.5*(i[n]+i[p]),s[3*l+1]=.5*(i[n+1]+i[p+1]),s[3*l+2]=.5*(i[n+2]+i[p+2]),l++,s[3*l+Math.floor(a/2)]=t.dataBounds[a],s[3*l+Bu[a][0]]=.5*(t.dataBounds[2*Bu[a][0]]+t.dataBounds[2*Bu[a][0]+1]),s[3*l+Bu[a][1]]=.5*(t.dataBounds[2*Bu[a][1]]+t.dataBounds[2*Bu[a][1]+1]),l++,t.textValues[c]=t.axisLabels[e],c++;const f=(e+1)%3,g=(e+2)%3,m=r[e],h=o[e];t.tickCounts[u]=m.length;for(let r=0;r{if(!t.camera)return;const n=e.computeFacesToDraw(),r=t.lastFacesToDraw;let o=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(o=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(n||o||t.forceUpdate){const n=new Array(12).fill(0);for(let e=0;e<6;e++)if(r[e])for(let t=0;t<4;t++)n[Eu[e][t]]++;const a=[],i=[];for(let e=0;e<3;e++){const n=yo().domain([t.dataBounds[2*e],t.dataBounds[2*e+1]]);a[e]=n.ticks(5);const r=n.tickFormat(5);i[e]=a[e].map(r)}e.updatePolyData(r,n,a),e.updateTextData(r,n,a,i),(o||t.forceUpdate)&&e.updateTextureAtlas(i)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let n=0,r=1;for(let o=0;o<3;o++){if(!t._tmAtlas.has(t.axisLabels[o])){zu(t.tmContext,t.axisTextStyle);const e=t.tmContext.measureText(t.axisLabels[o]),a={height:e.actualBoundingBoxAscent+2,startingHeight:r,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[o],a),r+=a.height,n{e.tcoords=[0,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight)/r,0,(r-e.startingHeight)/r]})),t.tmCanvas.width=n,t.tmCanvas.height=r,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,n,r),t._tmAtlas.forEach(((e,n)=>{zu(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified((()=>{t.forceUpdate=!0,e.update()})),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.getBounds=()=>(e.update(),Ui.setBounds(t.bounds,t.gridActor.getBounds()),Ui.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor),t.bounds);const n=jt.chain(e.setProperty,t.gridActor.setProperty);e.setProperty=e=>n(e)[0]}function $u(e){return{boundsScaleFactor:1.3,camera:null,dataBounds:[...Ui.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:12,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},...e}}function qu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$u(n)),Ps.extend(e,t,n),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=Ru.newInstance(),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=fc.newInstance(),t.polyData=Pu.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=Ps.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=Pu.newInstance(),jt.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset"]),jt.setGetArray(e,t,["dataBounds"],6),jt.setGetArray(e,t,["axisLabels"],3),jt.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),Ku(e,t)}var Xu={newInstance:jt.newInstance(qu,"vtkCubeAxesActor"),extend:qu,newCubeAxesActorHelper:ju};function Yu(e,t){t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Zu={};const Qu=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zu,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Xu.newCubeAxesActorHelper(),Yu(e,t)}),"vtkOpenGLCubeAxesActor");rn("vtkCubeAxesActor",Qu);const Ju={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var ed={ObjectType:Ju};const{ObjectType:td}=ed;function nd(e,t){function n(e){switch(e){case td.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case td.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case td.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,a=!0,i="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===a,e.generateBuffer=e=>{const a=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===a},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,a=!1,!0):(i="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>i}const rd={objectType:td.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function od(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rd,n),jt.obj(e,t),jt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),nd(e,t)}var ad={newInstance:jt.newInstance(od),extend:od,...ed};const{vtkErrorMacro:id}=jt;function sd(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(Ju.ARRAY_BUFFER),e.createVBO=function(n,r,o,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=a.points.getData();let l=null,c=null,u=null;const d=a.colors?a.colors.getNumberOfComponents():0,p=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),a.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,c=a.tcoords.getData()),a.colors?(t.colorComponents=a.colors.getNumberOfComponents(),t.colorOffset=0,u=a.colors.getData(),t.colorBO||(t.colorBO=ad.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,g=0,m=0,h=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let C=null,S=null;o===ps.POINTS||"verts"===r?(C=x.anythingToPoints,S=T.anythingToPoints):o===ps.WIREFRAME||"lines"===r?(C=x[`${r}ToWireframe`],S=T[`${r}ToWireframe`]):(C=x[`${r}ToSurface`],S=T[`${r}ToSurface`]);const A=n.getData(),P=A.length;let I=0;for(let e=0;e0&&(Math.abs(E)/V>1e6||Math.abs(Math.log10(V))>3||0===V&&E>1e6);if(D){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=a.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(i)if(i.points||i.cells){const e=new Int32Array(I+i.points.length);e.set(i.points),i.points=e;const t=new Int32Array(I+i.cells.length);t.set(i.cells),i.cells=t}else i.points=new Int32Array(I),i.cells=new Int32Array(I);let L=a.vertexOffset;f=function(e){if(i&&(i.points[L]=e,i.cells[L]=b+a.cellOffset),++L,g=3*e,t.coordShiftAndScaleEnabled?(O[M++]=(s[g++]-t.coordShift[0])*t.coordScale[0],O[M++]=(s[g++]-t.coordShift[1])*t.coordScale[1],O[M++]=(s[g++]-t.coordShift[2])*t.coordScale[2]):(O[M++]=s[g++],O[M++]=s[g++],O[M++]=s[g++]),null!==l&&(m=a.haveCellNormals?3*(b+a.cellOffset):3*e,O[M++]=l[m++],O[M++]=l[m++],O[M++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&Fn(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&Fn(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(kn(e,[0,0,0])&&kn(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Rn(n,t);const r=new Float64Array(16);return k(r,Hi(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):id("Wrong type for coordScale, expected vec3 or null"):id("Wrong type for coordShift, expected vec3 or null")}}const ld={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function cd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ld,n),ad.extend(e,t,n),jt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),jt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),sd(e,t)}var ud={newInstance:jt.newInstance(cd),extend:cd};const{vtkErrorMacro:dd}=jt;function pd(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return dd(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const fd={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function gd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fd,n),jt.obj(e,t),jt.setGet(e,t,["shaderType","source","error","handle","context"]),pd(e,t)}var md={newInstance:jt.newInstance(gd,"vtkShader"),extend:gd};const{vtkErrorMacro:hd}=jt;function vd(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(hd(`Links failed: ${t.error}`),0):(hd(t.error),0):(hd(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),hd(t.fragmentShader.getError()),0):(hd(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),hd(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return hd(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,a),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,a),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(a,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(a,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,a)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(i,r,o,a),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(hd("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return hd("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const yd={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function bd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yd,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=md.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=md.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=md.newInstance(),t.geometryShader.setShaderType("Geometry"),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),vd(e,t)}var xd={newInstance:jt.newInstance(bd,"vtkShaderProgram"),extend:bd,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),a=!1===r?t:new RegExp(t,"g"),i=e.replace(a,o);return{replace:i!==o,result:i}}};function Td(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,a,i,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,a,i,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,a,i,s,l,c,u,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==Ju.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=a,f.stride=i,f.type=s,f.size=l,f.normalize=c,f.isMatrix=d,f.divisor=u,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),u>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,a,i,s,l,c,u,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Cd={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Sd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cd,n),t.buffers=[],jt.obj(e,t),jt.get(e,t,["supported"]),jt.setGet(e,t,["forceEmulation"]),Td(e,t)}var Ad={newInstance:jt.newInstance(Sd,"vtkOpenGLVertexArrayObject"),extend:Sd};const Pd={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Id(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,a)=>{if(t.CABO.getElementCount()){const i=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,c=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),i===l.LINES&&s?(e.updateShaders(n,r,a),l.drawArraysInstanced(i,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,a),l.drawArrays(i,0,t.CABO.getElementCount()),l.lineWidth(1));const u=(i===l.POINTS?1:0)||(i===l.LINES?2:3);return t.pointPicking&&l.depthMask(c),t.CABO.getElementCount()/u}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ps.POINTS||n===Pd.Points?t.context.POINTS:e===ps.WIREFRAME||n===Pd.Lines||n===Pd.TrisEdges||n===Pd.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(a,n,r);const i=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==e.getProgram()&&(e.setProgram(i),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Pd.Points||r.getProperty().getRepresentation()===ps.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let a=n.Vertex;a=xd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(a=xd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=a},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Pd.Points?2:t.primitiveType===Pd.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const wd={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Od(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wd,n),jt.obj(e,t),t.shaderSourceTime={},jt.obj(t.shaderSourceTime),t.attributeUpdateTime={},jt.obj(t.attributeUpdateTime),jt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=xd.newInstance(),t.VAO=Ad.newInstance(),t.CABO=ud.newInstance(),Id(e,t)}var Md={newInstance:jt.newInstance(Od),extend:Od,primTypes:Pd};const Rd={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Vd={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Ed={Wrap:Rd,Filter:Vd};const Dd=new Float32Array(1),Ld=new Int32Array(Dd.buffer);var Bd={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){Dd[0]=e;const t=Ld[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:Nd,Filter:kd}=Ed,{VtkDataTypes:Fd}=Us,{vtkDebugMacro:_d,vtkErrorMacro:Gd,vtkWarningMacro:Ud}=Kt,{toHalf:Wd}=Bd;function zd(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let a=t.width*t.height*t.components;if(r&&(a*=t.depth),e!==Fd.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==Fd.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Uint8Array(t))}else o.push(null);let i=!1;if(t._openGLRenderWindow.getWebgl2())i=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");i=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(i)for(let e=0;e=o&&(c=o-1);const m=i-l,h=1-m;l=l*r*a,c=c*r*a;for(let t=0;t=r&&(p=r-1);const v=i-s;s*=a,p*=a;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||a);t.useHalfFloat=s}(a,c.offset,c.scale,r),t.useHalfFloat||e.getOpenGLDataType(a,!0),{numComps:o,dataType:a,data:i,scaleOffsets:c}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(kd.LINEAR),e.setMagnificationFilter(kd.LINEAR)):(e.setMinificationFilter(kd.NEAREST),e.setMagnificationFilter(kd.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(Nd.REPEAT),e.setWrapS(Nd.REPEAT),e.setWrapT(Nd.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,Fd.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,Fd.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),a=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:Ud("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||_d(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(_d("Unsupported internal texture type!"),_d(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case Fd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&Fd.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&Fd.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&Fd.SHORT:case t.useHalfFloat&&Fd.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case Fd.FLOAT:case Fd.VOID:default:return t.context.FLOAT}switch(e){case Fd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Fd.FLOAT:case Fd.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case kd.NEAREST:return t.context.NEAREST;case kd.LINEAR:return t.context.LINEAR;case kd.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case kd.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case kd.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case kd.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case Nd.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case Nd.REPEAT:return t.context.REPEAT;case Nd.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(a,i,s,l,c){let u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[c],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),u&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(a,i,s,l,c)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=c.length/6-1,e.createTexture(),e.bind();const u=r(n(l,c)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&a>=1;){let i=null;n<=t.maxLevel&&(i=d[6*n+e]),o(l)?null!=i&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,a,t.format,t.openGLDataType,i):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,a,0,t.format,t.openGLDataType,i),n++,r/=2,a/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,a,i)=>(e.getOpenGLDataType(a),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?a===Fd.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=i&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(a,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(Gd("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(Fd.UNSIGNED_CHAR),e.getInternalFormat(Fd.UNSIGNED_CHAR,4),e.getFormat(Fd.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||Wo(n.width)&&Wo(n.height)),a=document.createElement("canvas");a.width=r?Uo(n.width):n.width,a.height=r?Uo(n.height):n.height,t.width=a.width,t.height=a.height;const i=a.getContext("2d");i.translate(0,a.height),i.scale(1,-1),i.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);const s=a;return o(Fd.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(Fd.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,a){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Us.newInstance({numberOfComponents:r,dataType:o,values:a}),i)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:i,dataType:s,data:l}=a(r,o);e.create2DFromRaw(t,n,i,s,l)},e.create3DFromRaw=(a,i,s,l,c,u)=>{if(e.getOpenGLDataType(c),e.getInternalFormat(c,l),e.getFormat(c,l),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=a,t.height=i,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(c,[u],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(c)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(c,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,a,i){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Us.newInstance({numberOfComponents:o,dataType:a,values:i}),s)},e.create3DFilterableFromDataArray=function(n,r,i,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:c,dataType:u,data:d,scaleOffsets:p}=a(s,l),f=n*r*i,g=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=Fd.UNSIGNED_CHAR;if(u===Fd.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=Fd.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,c),e.getFormat(y,c),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===Fd.FLOAT||c>=3)&&(b=4096);let x=1,T=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),T=x);let C=Math.sqrt(f)/x;C=Uo(C);const S=Math.floor(C*x/n),A=Math.ceil(i/S),P=Uo(r*A/T);let I;t.width=C,t.height=P,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=A,t.volumeInfo.xstride=x,t.volumeInfo.ystride=T,t.volumeInfo.offset=h.offset,t.volumeInfo.scale=h.scale;const w=C*P*c;I=y===Fd.FLOAT?new Float32Array(w):new Uint8Array(w);let O=0;const M=Math.floor(n/x),R=Math.floor(r/T);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const Hd={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:Nd.CLAMP_TO_EDGE,wrapT:Nd.CLAMP_TO_EDGE,wrapR:Nd.CLAMP_TO_EDGE,minificationFilter:kd.NEAREST,magnificationFilter:kd.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function jd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hd,n),Zt.extend(e,t,n),t.sendParametersTime={},yt(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},yt(t.textureBuildTime,{mtime:0}),St(e,t,["format","openGLDataType"]),At(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),xt(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ot(0,t,["openGLRenderWindow"]),zd(e,t)}const Kd=Et(jd,"vtkOpenGLTexture");var $d={newInstance:Kd,extend:jd,...Ed};rn("vtkTexture",Kd);var qd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Xd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",Yd=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const a=e.getCoincidentParameters(r,o);if(a&&(0!==a.factor||0!==a.offset)){let e=n.Fragment;e=xd.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==a.factor?(e=xd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==a.factor?(e=xd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},Zd=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const a=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,a,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,a)},e.getReplacedShaderTemplate=(n,r,o)=>{const a=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let i=n.Vertex;if(a){const e=a.VertexShaderCode;void 0!==e&&""!==e&&(i=e)}n.Vertex=i;let s=n.Fragment;if(a){const e=a.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(a){const e=a.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};const{FieldAssociations:Qd}=gl,{primTypes:Jd}=Md,{Representation:ep,Shading:tp}=xs,{ScalarMode:np}=fc,{Filter:rp,Wrap:op}=$d,{vtkErrorMacro:ap}=Kt,ip={type:"StartEvent"},sp={type:"EndEvent"},{CoordinateSystem:lp}=is;function cp(e,t){function n(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Jd.Start;e{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;const s=t.lastBoundBO.getReferenceByName("lastLightComplexity");let l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let c=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(c=c.concat([" vec3 specularColor;"," float specularPower;"])),c=c.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(c=c.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),o=xd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=xd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=xd.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=xd.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?t.renderable.getInterpolateScalarsBeforeMapping()&&t.renderable.getColorCoordinates()&&!t.drawingEdges?i=xd.substitute(i,"//VTK::Color::Impl",c.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(r.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),i=xd.substitute(i,"//VTK::Color::Impl",c).result):i=xd.substitute(i,"//VTK::Color::Impl",c.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,i=xd.substitute(i,"//VTK::Color::Dec",l).result,e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderLight=(e,n,r)=>{let o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),i=t.lastBoundBO.getReferenceByName("lastLightCount");let s=[];switch(a){case 0:o=xd.substitute(o,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:o=xd.substitute(o,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5,\n dot(reflect(lightDirectionVC${e},\n normalVCVSOutput),\n normalize(-vertexVC.xyz))),\n specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),o=xd.substitute(o,"//VTK::Light::Impl",s,!1).result;break;default:ap("bad light complexity")}e.Fragment=o},e.replaceShaderNormal=(e,n,r)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex,o=e.Geometry,a=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(n=xd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=xd.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=xd.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,a=xd.substitute(a,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(a=xd.substitute(a,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(r.getProperty().getRepresentation())===t.context.LINES?(a=xd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(a=xd.substitute(a,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,a=xd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=n,e.Geometry=o,e.Fragment=a}},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r);let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=xd.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=xd.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,o=xd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=xd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=xd.substitute(o,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;n=xd.substitute(n,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const a=t.openGLActor.getActiveTextures();let i=2,s=2;if(a&&a.length>0&&(i=a[0].getComponents(),a[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(i=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(n=xd.substitute(n,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=xd.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,a&&a.length>=1)switch(i){case 1:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(n=xd.substitute(n,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=xd.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,i){case 1:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes();o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,o=xd.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,a=xd.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getCoincidentParameters=(e,n)=>{let r={factor:0,offset:0};const o=n.getProperty();if(t.renderable.getResolveCoincidentTopology()||o.getEdgeVisibility()&&o.getRepresentation()===ep.SURFACE){const e=t.lastBoundBO.getPrimitiveType();e===Jd.Points||o.getRepresentation()===ep.POINTS?r=t.renderable.getCoincidentTopologyPointOffsetParameter():e===Jd.Lines||o.getRepresentation()===ep.WIREFRAME?r=t.renderable.getCoincidentTopologyLineOffsetParameters():e!==Jd.Tris&&e!==Jd.TriStrips||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),e!==Jd.TrisEdges&&e!==Jd.TriStripsEdges||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),r.factor/=2,r.offset/=2)}const a=t._openGLRenderer.getSelector();return a&&a.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(r.offset-=2),r},e.replaceShaderPicking=(e,n,r)=>{let o=e.Fragment,a=e.Vertex;if(o=xd.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch(t.lastSelectionState!==Jl.ID_LOW24&&t.lastSelectionState!==Jl.ID_HIGH24||(a=xd.substitute(a,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,a=xd.substitute(a,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,o=xd.substitute(o,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,o=xd.substitute(o,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case Jl.ID_LOW24:o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case Jl.ID_HIGH24:o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=xd.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=o,e.Vertex=a}},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderColor(n,r,o),e.replaceShaderNormal(n,r,o),e.replaceShaderLight(n,r,o),e.replaceShaderTCoord(n,r,o),e.replaceShaderPicking(n,r,o),e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=xd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=xd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}},e.getNeedToRebuildShaders=(e,n,r)=>{let o=0,a=0;const i=e.getPrimitiveType(),s=t.currentInput;let l=!1;const c=s.getPointData().getNormals(),u=s.getCellData().getNormals(),d=r.getProperty().getInterpolation()===tp.FLAT,p=r.getProperty().getRepresentation(),f=e.getOpenGLMode(p,i);if(f===t.context.TRIANGLES||u&&!c||!d&&c?l=!0:d||f!==t.context.LINES||(l=!0),r.getProperty().getLighting()&&l){o=0;const e=n.getLightsByReference();for(let t=0;t0&&(a++,0===o&&(o=1)),1===o&&(a>1||1!==n.getIntensity()||!n.lightTypeIsHeadLight())&&(o=2),o<3&&n.getPositional()&&(o=3)}}let g=!1;const m=t.lastBoundBO.getReferenceByName("lastLightComplexity"),h=t.lastBoundBO.getReferenceByName("lastLightCount");return m===o&&h===a||(t.lastBoundBO.set({lastLightComplexity:o},!0),t.lastBoundBO.set({lastLightCount:a},!0),g=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(g=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(n,r,o)=>{if(n.getProgram().isUniformUsed("PrimitiveIDOffset")&&n.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),n.getProgram().isUniformUsed("VertexIDOffset")&&n.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){const e=t.lastBoundBO.getReferenceByName("lastLightComplexity");n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ap("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("normalMC")&&n.getCABO().getNormalOffset()&&e>0?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"normalMC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ap("Error setting normalMC in shader VAO."):n.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach(((e,r)=>{n.getProgram().isAttributeUsed(`${e}MC`)&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),`${e}MC`,n.getCABO().getCustomData()[r].offset,n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getCustomData()[r].components,!1)||ap(`Error setting ${e}MC in shader VAO.`))})),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),!1)||ap("Error setting tcoordMC in shader VAO."):n.getVAO().removeAttributeArray("tcoordMC"),n.getProgram().isAttributeUsed("scalarColor")&&n.getCABO().getColorComponents()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO().getColorBO(),"scalarColor",n.getCABO().getColorOffset(),n.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||ap("Error setting scalarColor in shader VAO."):n.getVAO().removeAttributeArray("scalarColor"),n.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes(),r=[],a=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=a?d(t.tmpMat4,o.getMatrix()):o.getMatrix();a&&(m(i,i),b(i,i,a),m(i,i));for(let n=0;n{const o=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const a=e.getProgram();let i=0;const s=n.getLightsByReference();for(let e=0;e0){const e=r.getColorByReference(),o=r.getIntensity();t.lightColor[0]=e[0]*o,t.lightColor[1]=e[1]*o,t.lightColor[2]=e[2]*o;const s=r.getDirection(),l=n.getActiveCamera().getViewMatrix(),c=[...s];r.lightTypeIsSceneLight()&&(c[0]=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],c[1]=l[4]*s[0]+l[5]*s[1]+l[6]*s[2],c[2]=l[8]*s[0]+l[9]*s[1]+l[10]*s[2],Qo(c)),t.lightDirection[0]=c[0],t.lightDirection[1]=c[1],t.lightDirection[2]=c[2],Qo(t.lightDirection),a.setUniform3fArray(`lightColor${i}`,t.lightColor),a.setUniform3fArray(`lightDirectionVC${i}`,t.lightDirection),i++}}if(o<3)return;const l=n.getActiveCamera().getViewMatrix();m(l,l),i=0;for(let e=0;e0){const e=t.getTransformedPosition(),n=new Float64Array(3);Ln(n,e,l),a.setUniform3fArray(`lightAttenuation${i}`,t.getAttenuationValuesByReference()),a.setUniformi(`lightPositional${i}`,t.getPositional()),a.setUniformf(`lightExponent${i}`,t.getExponent()),a.setUniformf(`lightConeAngle${i}`,t.getConeAngle()),a.setUniform3fArray(`lightPositionVC${i}`,[n[0],n[1],n[2]]),i++}}},e.setCameraShaderParameters=(e,a,i)=>{const s=e.getProgram(),l=t.openGLCamera.getKeyMatrices(a),c=a.getActiveCamera(),u=t.openGLCamera.getKeyMatrixTime().getMTime(),d=s.getLastCameraMTime(),p=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,f=i.getIsIdentity(),m=f?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(i.getCoordinateSystem()===lp.DISPLAY){const e=t._openGLRenderer.getTiledSizeAndOrigin();g(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b(t.tmpMat4,t.tmpMat4,p),s.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else s.setUniformMatrix("MCPCMatrix",n([l.wcpc,m.mcwc,p],r,t.tmpMat4));s.isUniformUsed("MCVCMatrix")&&s.setUniformMatrix("MCVCMatrix",n([l.wcvc,m.mcwc,p],r,t.tmpMat4)),s.isUniformUsed("normalMatrix")&&s.setUniformMatrix3x3("normalMatrix",n([l.normalMatrix,m.normalMatrix],o,t.tmpMat3)),d!==u&&(s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",c.getParallelProjection()),s.setLastCameraMTime(u)),f||s.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram();let a=r.getProperty(),i=a.getOpacity(),s=t.drawingEdges?a.getEdgeColorByReference():a.getAmbientColorByReference(),l=t.drawingEdges?a.getEdgeColorByReference():a.getDiffuseColorByReference(),c=t.drawingEdges?1:a.getAmbient(),u=t.drawingEdges?0:a.getDiffuse(),d=t.drawingEdges?0:a.getSpecular();const p=a.getSpecularPower();o.setUniformf("opacityUniform",i),o.setUniform3fArray("ambientColorUniform",s),o.setUniform3fArray("diffuseColorUniform",l),o.setUniformf("ambient",c),o.setUniformf("diffuse",u);const f=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(f<1)return;let g=a.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",g),o.setUniformf("specularPowerUniform",p),o.setUniformf("specular",d),o.isUniformUsed("ambientIntensityBF")){if(a=r.getBackfaceProperty(),i=a.getOpacity(),s=a.getAmbientColor(),c=a.getAmbient(),l=a.getDiffuseColor(),u=a.getDiffuse(),g=a.getSpecularColor(),d=a.getSpecular(),o.setUniformf("ambientIntensityBF",c),o.setUniformf("diffuseIntensityBF",u),o.setUniformf("opacityUniformBF",i),o.setUniform3fArray("ambientColorUniformBF",s),o.setUniform3fArray("diffuseColorUniformBF",l),f<1)return;o.setUniformf("specularIntensityBF",d),o.setUniform3fArray("specularColorUniformBF",g),o.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,n)=>{const r=t._openGLRenderer.getSelector();if(r){if(t.selectionWebGLIdsToVTKIds?.points?.length){const e=t.selectionWebGLIdsToVTKIds.points.length;r.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){const e=t.selectionWebGLIdsToVTKIds.cells.length;r.setMaximumCellId(e-1)}r.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;const o=function(e){const t=e.getSelector();return t?t.getCurrentPass():Jl.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==o&&(t.selectionStateChanged.modified(),t.lastSelectionState=o),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(r),e.updateBufferObjects(n,r),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=r.getProperty().getEdgeVisibility()&&o===ep.SURFACE,i=t._openGLRenderer.getSelector(),s=i&&i.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===Jl.ID_LOW24||t.lastSelectionState===Jl.ID_HIGH24);for(let i=Jd.Start;i=0)||(t.lastBoundBO=t.primitives[i],t.primitiveIDOffset+=t.primitives[i].drawArrays(n,r,o,e),t.vertexIDOffset+=t.primitives[i].getCABO().getElementCount()))},e.renderPieceFinish=(e,n)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(n,r)=>{if(e.invokeEvent(ip),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(sp),!t.currentInput)return void ap("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context,a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const o=t.currentInput;if(null===o)return;t.renderable.mapScalars(o,1);const a=t.renderable.getColorMapColors();t.haveCellScalars=!1;const i=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(i!==np.USE_CELL_DATA&&i!==np.USE_CELL_FIELD_DATA&&i!==np.USE_FIELD_DATA&&o.getPointData().getScalars()||i===np.USE_POINT_FIELD_DATA||!a||(t.haveCellScalars=!0));let s=r.getProperty().getInterpolation()!==tp.FLAT?o.getPointData().getNormals():null;null===s&&o.getCellData().getNormals()&&(t.haveCellNormals=!0,s=o.getCellData().getNormals());const l=r.getProperty().getRepresentation();let c=o.getPointData().getTCoords();if(t.openGLActor.getActiveTextures()||(c=null),t.renderable.getColorCoordinates()){c=t.renderable.getColorCoordinates(),t.internalColorTexture||(t.internalColorTexture=$d.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(rp.NEAREST),e.setMagnificationFilter(rp.NEAREST),e.setWrapS(op.CLAMP_TO_EDGE),e.setWrapT(op.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t.renderable.getColorTextureMap(),r=n.getExtent(),o=n.getPointData().getScalars();e.create2DFromRaw(r[1]-r[0]+1,r[3]-r[2]+1,o.getNumberOfComponents(),o.getDataType(),o.getData()),e.activate(),e.sendParameters(),e.deactivate()}const u=`${o.getMTime()}A${l}B${o.getMTime()}C${s?s.getMTime():1}D${a?a.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${c?c.getMTime():1}`;if(t.VBOBuildString!==u){const n={points:o.getPoints(),normals:s,tcoords:c,colors:a,cellOffset:0,vertexOffset:0,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:t.renderable.getCustomShaderAttributes().map((e=>o.getPointData().getArrayByName(e)))};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});const i=[{inRep:"verts",cells:o.getVerts()},{inRep:"lines",cells:o.getLines()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()}],d=r.getProperty().getEdgeVisibility()&&l===ep.SURFACE;for(let e=Jd.Start;e{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const up={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:Jl.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function dp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,up,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.primitives=[],t.primTypes=Jd,t.tmpMat3=pe(new Float64Array(9)),t.tmpMat4=g(new Float64Array(16));for(let e=Jd.Start;e{t.lookupTable=zl.newInstance()},e.getColorModeAsString=()=>jt.enumToString(gp,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(mp,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===mp.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===mp.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===mp.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===mp.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===mp.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===mp.USE_FIELD_DATA){const t=e.getFieldData();i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString===a)return;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]);const i=e.getLookupTable();i&&(i.build(),t.colorMapColors=i.mapScalars(o,t.colorMode,t.fieldDataTupleId)),t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}}}const yp={static:!1,lookupTable:null,scalarVisibility:!1,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,transformCoordinate:null,viewSpecificProperties:null,customShaderAttributes:[]};function bp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yp,n),Hs(e,t,n),jt.get(e,t,["colorMapColors"]),jt.setGet(e,t,["arrayAccessMode","colorByArrayName","colorMode","lookupTable","renderTime","scalarMode","scalarVisibility","static","transformCoordinate","useLookupTableScalarRange","viewSpecificProperties","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),t.viewSpecificProperties||(t.viewSpecificProperties={}),vp(e,t)}var xp={newInstance:jt.newInstance(bp,"vtkMapper2D"),extend:bp};const Tp={BACKGROUND:0,FOREGROUND:1};var Cp={DisplayLocation:Tp};const{primTypes:Sp}=Md,{ScalarMode:Ap}=xp,{vtkErrorMacro:Pp}=Kt,Ip={type:"StartEvent"},wp={type:"EndEvent"};function Op(e,t){t.classHierarchy.push("vtkOpenGLPolyDataMapper2D"),e.buildPass=n=>{n&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Sp.Start;e{e.invokeEvent(Ip),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(wp),t.currentInput?t.currentInput.getPoints&&t.currentInput.getPoints().getNumberOfValues()&&(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Pp("No input!")},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(r)),e.updateBufferObjects(n,r),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,n,r)=>e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return!!(o{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,n.getProperty().getOpacity());const o=t.renderable.getColorMapColors();t.haveCellScalars=!1;const a=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(a!==Ap.USE_CELL_DATA&&a!==Ap.USE_CELL_FIELD_DATA&&a!==Ap.USE_FIELD_DATA&&r.getPointData().getScalars()||a===Ap.USE_POINT_FIELD_DATA||!o||(t.haveCellScalars=!0));const i=n.getProperty().getRepresentation();let s=r.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(s=null);const l=t.renderable.getTransformCoordinate(),c=e.getRenderWindow().getViews()[0].getViewportSize(e),u=`${r.getMTime()}A${i}B${r.getMTime()}C${o?o.getMTime():1}D${s?s.getMTime():1}E${l?e.getMTime():1}F${c}`;if(t.VBOBuildString!==u){let n=r.getPoints();if(l){const t=Ic.newInstance(),r=n.getNumberOfPoints();t.setNumberOfPoints(r);const o=[];for(let a=0;ar.getPointData().getArrayByName(e)))};a.cellOffset+=t.primitives[Sp.Points].getCABO().createVBO(r.getVerts(),"verts",i,a),a.cellOffset+=t.primitives[Sp.Lines].getCABO().createVBO(r.getLines(),"lines",i,a),a.cellOffset+=t.primitives[Sp.Tris].getCABO().createVBO(r.getPolys(),"polys",i,a),a.cellOffset+=t.primitives[Sp.TriStrips].getCABO().createVBO(r.getStrips(),"strips",i,a),t.VBOBuildTime.modified(),t.VBOBuildString=u}},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation();t.context.depthMask(!0);for(let a=Sp.Start;a{t.lastBoundBO&&t.lastBoundBO.getVAO().release()},e.replaceShaderValues=(t,n,r)=>{e.replaceShaderColor(t,n,r),e.replaceShaderTCoord(t,n,r),e.replaceShaderPicking(t,n,r),e.replaceShaderPositionVC(t,n,r)},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.haveCellScalars&&(i=xd.substitute(i,"//VTK::Color::Dec",["uniform samplerBuffer texture1;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = texelFetchBuffer(texture1, gl_PrimitiveID + PrimitiveIDOffset);"]).result),0!==t.lastBoundBO.getCABO().getColorComponents()?(o=xd.substitute(o,"//VTK::Color::Dec",["in vec4 diffuseColor;","out vec4 fcolorVSOutput;"]).result,o=xd.substitute(o,"//VTK::Color::Impl",["fcolorVSOutput = diffuseColor;"]).result,a=xd.substitute(a,"//VTK::Color::Dec",["in vec4 fcolorVSOutput[];\n","out vec4 fcolorGSOutput;"]).result,a=xd.substitute(a,"//VTK::Color::Impl",["fcolorGSOutput = fcolorVSOutput[i];"]).result,i=xd.substitute(i,"//VTK::Color::Dec",["in vec4 fcolorVSOutput;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = fcolorVSOutput;"]).result):(i=xd.substitute(i,"//VTK::Color::Dec",["uniform vec4 diffuseColor;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = diffuseColor;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getCABO().getTCoordComponents();1===a?(n=xd.substitute(n,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,r=xd.substitute(r,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=xd.substitute(o,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===a&&(n=xd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=xd.substitute(o,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.haveCellScalars&&(r=xd.substitute(r,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderPicking=(e,t,n)=>{let r=e.Fragment;r=xd.substitute(r,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,r=xd.substitute(r,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=r},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r)},e.invokeShaderCallbacks=(e,n,r)=>{const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(e,n,r)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)||Pp("Error setting vertexWC in shader VAO.")),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach(((n,r)=>{e.getProgram().isAttributeUsed(`${n}MC`)&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${n}MC`,e.getCABO().getCustomData()[r].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[r].components,!1)||Pp(`Error setting ${n}MC in shader VAO.`))})),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||Pp("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());const o=t.openGLActor2D.getActiveTextures();if(o)for(let t=0;t{const o=t.renderable.getColorMapColors();if(!o||0===o.getNumberOfComponents()){const t=e.getProgram(),n=r.getProperty(),o=n.getOpacity(),a=n.getColor(),i=[a[0],a[1],a[2],o];t.setUniform4f("diffuseColor",i)}},e.setLightingShaderParameters=(e,t,n)=>{},e.setCameraShaderParameters=(e,n,o)=>{const a=e.getProgram(),i=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=n.getRenderWindow().getViews()[0].getViewportSize(n),l=n.getViewport(),c=o.getActualPositionCoordinate().getComputedDoubleViewportValue(n),u=[0,0,1,1],d=[0,0,1,1];if(d[0]=l[0]>=u[0]?l[0]:u[0],d[1]=l[1]>=u[1]?l[1]:u[1],d[2]=l[2]<=u[2]?l[2]:u[2],d[3]=l[3]<=u[3]?l[3]:u[3],d[0]>=d[2])return;if(d[1]>=d[3])return;s[0]=Lo(s[0]*(d[2]-d[0])/(l[2]-l[0])),s[1]=Lo(s[1]*(d[3]-d[1])/(l[3]-l[1]));const p=t._openGLRenderer.getParent().getSize(),f=Lo(c[0]-(d[0]-l[0])*p[0]),h=Lo(c[1]-(d[1]-l[1])*p[1]),v=-f;let y=-f+s[0];const b=-h;let x=-h+s[1];v===y&&(y=v+1),b===x&&(x=b+1);const T=g(new Float64Array(16));var C,S,A;T[0]=2/(y-v),T[5]=2/(x-b),T[3]=-1*(y+v)/(y-v),T[7]=-1*(x+b)/(x-b),T[10]=0,T[11]=o.getProperty().getDisplayLocation()===Tp.FOREGROUND?-1:1,T[15]=1,m(T,T),a.setUniformMatrix("WCVCMatrix",(C=[T,i],S=r,A=t.tmpMat4,S.identity(A),C.reduce(((e,t,n)=>0===n?t?S.copy(e,t):S.identity(e):t?S.multiply(e,e,t):e),A)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const Mp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null};const Rp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mp,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.primitives=[],t.primTypes=Sp,t.tmpMat4=g(new Float64Array(16));for(let e=Sp.Start;e{const n=e.getLastSize(),r=(n[0]/700)**.8,o=(n[1]/700)**.8,a=Math.min(r,o),i=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(i,t.axisTextStyle),Object.assign(s,t.tickTextStyle),i.fontSize=Math.max(24*a,12),e.getLastAspectRatio()>1?s.fontSize=Math.max(20*a,10):s.fontSize=Math.max(16*a,10);const l=e.updateTextureAtlas();e.setTopTitle(!1);const c=e.getBoxSizeByReference();if(e.getLastAspectRatio()>1)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.98-c[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.99-c[0],-.92])),c[1]=Math.max(1.2,Math.min(1.84/o,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);const t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/n[1],r=2*l.tickWidth/n[0];c[0]=Math.min(1.9,Math.max(1.4,1.4*r*(e.getTicks().length+3))),c[1]=t,e.setBoxPosition([-.5*c[0],-.97])}e.recomputeBarSegments(l)}}function Lp(e,t){return e=>{const t=e.getLastTickBounds(),n=yo().domain([t[0],t[1]]),r=n.ticks(5),o=n.tickFormat(5);e.setTicks(r),e.setTickStrings(r.map(o))}}function Bp(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=n=>{t.renderable!==n&&(t.renderable=n,t.barActor.setProperty(n.getProperty()),t.barActor.setParentProp(n),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=n.generateTicks,t.axisTextStyle={...n.getAxisTextStyle()},t.tickTextStyle={...n.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(n,r,o)=>{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0);const a=t.renderable.getScalarsToColors();if(a&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(a),t.camera=r,t.renderWindow=o,t.forceUpdate||Math.max(a.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){const n=a.getMappingRange();if(t.lastTickBounds=[...n],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();const n=e.updateTextureAtlas();e.recomputeBarSegments(n)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";const n={},r=new Map;let o=0,a=1;Ep(t.tmContext,t.axisTextStyle);let i=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:i.actualBoundingBoxAscent+2,startingHeight:a,width:i.width+2,textStyle:t.axisTextStyle};r.set(t.renderable.getAxisLabel(),s),a+=s.height,o=s.width,n.titleWidth=s.width,n.titleHeight=s.height,n.tickWidth=0,n.tickHeight=0,Ep(t.tmContext,t.tickTextStyle);const l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight)/a,0,(a-e.startingHeight)/a]})),t.tmCanvas.width=o,t.tmCanvas.height=a,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,o,a),r.forEach(((e,n)=>{Ep(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=r,n},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];const n=2*e.tickHeight/t.lastSize[1],r=[1,1];if(t.vertical){const o=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-o,t.barSize[1]=t.boxSize[1]-n}else{const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-n-o,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+o,t.barPosition[1]=t.boxPosition[1],r[1]=n}else{const n=(2*e.tickWidth-8)/t.lastSize[0],o=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-o,t.barPosition[1]=t.boxPosition[1],r[0]=n}return r},e.recomputeBarSegments=n=>{const r=e.computeBarSize(n);t.barSegments=[];const o=[0,0],a=t.vertical?1:0,i=t.vertical?.01:.02;function s(e,n){t.barSegments.push({corners:[[...o],[o[0]+r[0],o[1]],[o[0]+r[0],o[1]+r[1]],[o[0],o[1]+r[1]]],scalars:n,title:e}),o[a]+=r[a]+i}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);const l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();o[a]+=i;const c=r[a];r[a]=l?1-2*i-r[a]-o[a]:1-i-o[a],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(r[a]=c,o[a]+=i,s("Above",[1.1,1.1,1.1,1.1]))};const n=new Float64Array(3);e.createPolyDataForOneLabel=(e,r,o,a,i,s)=>{const l=t._tmAtlas.get(e);if(!l)return;let c=s.ptIdx,u=s.cellIdx;n[0]=(.5*r[0]+.5)*t.lastSize[0],n[1]=(.5*r[1]+.5)*t.lastSize[1],n[2]=r[2],n[0]+=i[0],n[1]+=i[1];const d=[],p="vertical"===a?[1,0]:[0,1];"vertical"===a?(d[0]=l.width,d[1]=-l.height,"middle"===o[0]?n[1]-=l.width/2:"right"===o[0]&&(n[1]-=l.width),"middle"===o[1]?n[0]+=l.height/2:"top"===o[1]&&(n[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===o[0]?n[0]-=l.width/2:"right"===o[0]&&(n[0]-=l.width),"middle"===o[1]?n[1]-=l.height/2:"top"===o[1]&&(n[1]-=l.height)),s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[0],s.tcoords[2*c+1]=l.tcoords[1],c++,n[p[0]]+=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[2],s.tcoords[2*c+1]=l.tcoords[3],c++,n[p[1]]+=d[1],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[4],s.tcoords[2*c+1]=l.tcoords[5],c++,n[p[0]]-=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[6],s.tcoords[2*c+1]=l.tcoords[7],c++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-3,s.polys[4*u+3]=c-2,u++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-2,s.polys[4*u+3]=c-1,s.ptIdx+=4,s.cellIdx+=2};const r=new Float64Array(3);e.updatePolyDataForLabels=()=>{const n=e.getTickStrings().length+t.barSegments.length,o=4*n,a=2*n,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o),c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l},u=t.vertical?0:1,d=t.vertical?1:0;r[2]=-.99;const p=t.vertical?["right","middle"]:["middle","bottom"];let f=[0,1];const g=[0,0];t.vertical?(g[0]=-t.tickLabelPixelOffset,t.topTitle?(r[0]=t.boxPosition[0]+.5*t.boxSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)):(r[0]=t.barPosition[0]+t.barSize[0],r[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],c)),f=[-1,0]):(g[1]=t.tickLabelPixelOffset,r[0]=t.barPosition[0]+.5*t.barSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)),r[u]=t.barPosition[u]+(.5*f[u]+.5)*t.barSize[u],r[d]=t.barPosition[d]+.5*t.barSize[d];let m=null;for(let n=0;n{const e=t.renderable.getScalarsToColors();let n=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(n+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(n+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(n+=1);const o=4*(1+n),a=o;let i=1;e.getVectorMode()===Vp.COMPONENT&&(i=e.getVectorComponent()+1);const s=new Float64Array(3*o),l=new Uint16Array(5*a),c=new Float32Array(o*i);let u=0,d=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),jt.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings"]),jt.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),jt.getArray(e,t,["boxPosition","boxSize"]),jt.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=fc.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=Pu.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=Ps.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=Pu.newInstance(),t.tmMapper=fc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=Ru.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=Ps.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],Bp(e,t)}),"vtkScalarBarActorHelper");function kp(e,t){t.classHierarchy.push("vtkScalarBarActor"),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(Dp(0,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(Lp())}}function Fp(e){return{automated:!0,autoLayout:null,axisLabel:"Scalar Value",barPosition:[0,0],barSize:[0,0],boxPosition:[.88,-.92],boxSize:[.1,1.1],scalarToColors:null,axisTitlePixelOffset:36,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:14,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},generateTicks:null,drawNanAnnotation:!0,drawBelowRangeSwatch:!0,drawAboveRangeSwatch:!0,...e}}function _p(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fp(n)),t.autoLayout||(t.autoLayout=Dp(0,t)),t.generateTicks||(t.generateTicks=Lp()),Ps.extend(e,t,n),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),jt.setGet(e,t,["automated","autoLayout","axisTitlePixelOffset","axisLabel","scalarsToColors","tickLabelPixelOffset","generateTicks","drawNanAnnotation","drawBelowRangeSwatch","drawAboveRangeSwatch"]),jt.get(e,t,["axisTextStyle","tickTextStyle"]),jt.getArray(e,t,["barPosition","barSize","boxPosition","boxSize"]),jt.setArray(e,t,["barPosition","barSize","boxPosition","boxSize"],2),kp(e,t)}var Gp={newInstance:jt.newInstance(_p,"vtkScalarBarActor"),extend:_p,newScalarBarActorHelper:Np};function Up(e,t){t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Wp={};const zp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wp,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Gp.newScalarBarActorHelper(),Up(e,t)}),"vtkOpenGLScalarBarActor");rn("vtkScalarBarActor",zp);const{vtkErrorMacro:Hp}=Kt;function jp(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=n=>{if(n){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera())}},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOpaqueActorCount()}},e.opaquePass=(n,r)=>{if(n&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);const n=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",n);const r=t._openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(r),a=new Float64Array(16);if(h(a,o.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",a),"box"===t.lastFormat){const e=r.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){const e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;const n=Us.newInstance({numberOfComponents:3,values:e});n.setName("points");const r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;const o=Us.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(o,"polys",ps.SURFACE,{points:n,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = texture2D(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Hp("Error setting vertexMC in shader VAO."));const e=t.renderable.getTextures();e.length||Hp("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}const Kp={context:null};const $p=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kp,n),Zt.extend(e,t,n),t.openGLTexture=$d.newInstance(),t.tris=Md.newInstance(),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},At(e,t,["context"]),xt(e,t,["activeTextures"]),jp(e,t)}));rn("vtkSkybox",$p);const{FieldAssociations:qp}=gl;function Xp(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,a)=>{const i=await e.getSourceDataAsync(t,n,r,o,a);return i?i.generateSelection(n,r,o,a):[]}}const Yp={fieldAssociation:qp.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Zp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yp,n),jt.obj(e,t),jt.setGet(e,t,["fieldAssociation","captureZValues"]),Xp(e,t)}var Qp={newInstance:jt.newInstance(Zp,"vtkHardwareSelector"),extend:Zp};function Jp(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):et("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void et("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void et("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else et("Attaching depth buffer textures to fbo requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else et("Attaching depth buffer textures to framebuffers requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=$d.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Vd.LINEAR),r.setMagnificationFilter(Vd.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,ws.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}const ef={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function tf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ef,n),yt(e,t),t.colorBuffers&&et("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Pt(e,t,["colorBuffers"]),Jp(e,t)}var nf={newInstance:Et(tf,"vtkFramebuffer"),extend:tf};function rf(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const of={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,of,n),jt.obj(e,t),t.properties={},jt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),rf(e,t)}var sf={newInstance:jt.newInstance(af,"vtkSelectionNode"),extend:af,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:lf}=ec,{SelectionContent:cf,SelectionField:uf}=sf,{FieldAssociations:df}=gl,{vtkErrorMacro:pf}=jt;function ff(e){return`${e.propID} ${e.compositeID}`}function gf(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function mf(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),a=n[o],i=n[o+1];return 256*(256*n[o+2]+i)+a}function hf(e,t){let n=t;return n<<=24,n|=e,n}function vf(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=mf(n[0],n[1],e.pixBuffer[lf.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const a={valid:!0};a.propID=o-1,a.prop=e.props[a.propID];let i=mf(n[0],n[1],e.pixBuffer[lf.COMPOSITE_INDEX_PASS],e.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);a.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,a.displayPosition=t}if(e.pixBuffer[lf.ID_LOW24]&&0===gf(n[0],n[1],e.pixBuffer[lf.ID_LOW24],e.area))return a;const s=mf(n[0],n[1],e.pixBuffer[lf.ID_LOW24],e.area),l=mf(n[0],n[1],e.pixBuffer[lf.ID_HIGH24],e.area);return a.attributeID=hf(s,l),a}const a=[t[0],t[1]],i=[0,0];let s=vf(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=vf(e,i,0,r),s&&s.valid))return s;if(i[0]=a[0]+t,s=vf(e,i,0,r),s&&s.valid)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=vf(e,i,0,r),s&&s.valid))return s;if(i[1]=a[1]+t,s=vf(e,i,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function yf(e,t,n,r,o){const a=[];let i=0;return t.forEach(((t,s)=>{const l=sf.newInstance();switch(l.setContentType(cf.INDICES),e){case df.FIELD_ASSOCIATION_CELLS:l.setFieldType(uf.CELL);break;case df.FIELD_ASSOCIATION_POINTS:l.setFieldType(uf.POINT);break;default:pf("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),a[i]=l,i++})),a}function bf(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=vf(e,[n,t],0,u);if(r&&r.valid){const t=ff(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=nf.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===df.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,a,i)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,a,i);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return pf("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=lf.MIN_KNOWN_PASS;t.currentPass<=lf.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===lf.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===lf.ID_HIGH24){if(t.fieldAssociation===df.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===df.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===lf.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let a=mf(o,r,e,t.area);a>0&&(a--,a in t.hitProps||(t.hitProps[a]=!0,t.propPixels[a]=[]),t.propPixels[a].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===lf.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===lf.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>jt.enumToString(lf,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const a=r<0?0:r;if(0===a){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=mf(e[0],e[1],t.pixBuffer[lf.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const a={valid:!0};a.propID=r-1,a.prop=t.props[a.propID];let i=mf(e[0],e[1],t.pixBuffer[lf.COMPOSITE_INDEX_PASS],t.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);a.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,a.displayPosition=n}if(t.pixBuffer[lf.ID_LOW24]&&0===gf(e[0],e[1],t.pixBuffer[lf.ID_LOW24],t.area))return a;const s=mf(e[0],e[1],t.pixBuffer[lf.ID_LOW24],t.area),l=mf(e[0],e[1],t.pixBuffer[lf.ID_HIGH24],t.area);return a.attributeID=hf(s,l),a}const i=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(s[1]=n,i[0]>=t&&(s[0]=i[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=i[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(s[0]=n,i[1]>=t&&(s[1]=i[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=i[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,a)=>{const i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=Math.floor(a),u=new Map,d=[0,0];for(let n=s;n<=c;n++)for(let r=i;r<=l;r++){const o=[r,n],a=e.getPixelInformation(o,0,d);if(a&&a.valid){const e=ff(a);if(u.has(e)){const n=u.get(e);n.pixelCount++,t.captureZValues&&a.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const Tf={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function Cf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tf,n),Qp.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),jt.setGetArray(e,t,["area"],4),jt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),jt.setGetArray(e,t,["propColorValue"],3),jt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),jt.event(e,t,"event"),xf(e,t)}var Sf={newInstance:jt.newInstance(Cf,"vtkOpenGLHardwareSelector"),extend:Cf,...ec};const{vtkErrorMacro:Af}=Kt,{Representation:Pf}=xs,{ObjectType:If}=ad,{PassTypes:wf}=Sf,Of={type:"StartEvent"},Mf={type:"EndEvent"};function Rf(e,t){t.classHierarchy.push("vtkOpenGLGlyph3DMapper");const n={...e};e.renderPiece=(n,r)=>{if(e.invokeEvent(Of),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(Mf),!t.currentInput)return void Af("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context;t._openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);const a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.multiply4x4WithOffset=(e,t,n,r)=>{const o=t[0],a=t[1],i=t[2],s=t[3],l=t[4],c=t[5],u=t[6],d=t[7],p=t[8],f=t[9],g=t[10],m=t[11],h=t[12],v=t[13],y=t[14],b=t[15];let x=n[r],T=n[r+1],C=n[r+2],S=n[r+3];e[0]=x*o+T*l+C*p+S*h,e[1]=x*a+T*c+C*f+S*v,e[2]=x*i+T*u+C*g+S*y,e[3]=x*s+T*d+C*m+S*b,x=n[r+4],T=n[r+5],C=n[r+6],S=n[r+7],e[4]=x*o+T*l+C*p+S*h,e[5]=x*a+T*c+C*f+S*v,e[6]=x*i+T*u+C*g+S*y,e[7]=x*s+T*d+C*m+S*b,x=n[r+8],T=n[r+9],C=n[r+10],S=n[r+11],e[8]=x*o+T*l+C*p+S*h,e[9]=x*a+T*c+C*f+S*v,e[10]=x*i+T*u+C*g+S*y,e[11]=x*s+T*d+C*m+S*b,x=n[r+12],T=n[r+13],C=n[r+14],S=n[r+15],e[12]=x*o+T*l+C*p+S*h,e[13]=x*a+T*c+C*f+S*v,e[14]=x*i+T*u+C*g+S*y,e[15]=x*s+T*d+C*m+S*b},e.replaceShaderNormal=(e,r,o)=>{if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(n=xd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=n}n.replaceShaderNormal(e,r,o)},e.replaceShaderColor=(e,r,o)=>{if(t.hardwareSupport&&t.renderable.getColorArray()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];a&&(i=i.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let s=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];a&&(s=s.concat([" vec3 specularColor;"," float specularPower;"])),s=s.concat([" opacity = opacityUniform;"]),a&&(s=s.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(i=i.concat(["varying vec4 vertexColorVSOutput;"]),n=xd.substitute(n,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,n=xd.substitute(n,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,r=xd.substitute(r,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,r=xd.substitute(r,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,s=s.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),o=xd.substitute(o,"//VTK::Color::Impl",s).result,o=xd.substitute(o,"//VTK::Color::Dec",i).result,e.Vertex=n,e.Geometry=r,e.Fragment=o}n.replaceShaderColor(e,r,o)},e.replaceShaderPositionVC=(e,r,o)=>{if(t.hardwareSupport){let n=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(n=xd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result,n=xd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(n=xd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,n=xd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result),e.Vertex=n}n.replaceShaderPositionVC(e,r,o)},e.replaceShaderPicking=(e,r,o)=>{if(t.hardwareSupport){let t=e.Fragment,n=e.Vertex;n=xd.substitute(n,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,n=xd.substitute(n,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,e.Vertex=n,t=xd.substitute(t,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,t=xd.substitute(t,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,e.Fragment=t}else n.replaceShaderPicking(e,r,o)},e.updateGlyphShaderParameters=(n,r,o,a,i,s,l,c)=>{const u=o.getProgram();if(n){const e=t.normalMatrix,n=s,r=9*l,o=t.tmpMat3,a=e[0],i=e[1],c=e[2],d=e[3],p=e[4],f=e[5],g=e[6],m=e[7],h=e[8],v=n[r],y=n[r+1],b=n[r+2],x=n[r+3],T=n[r+4],C=n[r+5],S=n[r+6],A=n[r+7],P=n[r+8];o[0]=v*a+y*d+b*g,o[1]=v*i+y*p+b*m,o[2]=v*c+y*f+b*h,o[3]=x*a+T*d+C*g,o[4]=x*i+T*p+C*m,o[5]=x*c+T*f+C*h,o[6]=S*a+A*d+P*g,o[7]=S*i+A*p+P*m,o[8]=S*c+A*f+P*h,u.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcpcMatrix,i,16*l),u.setUniformMatrix("MCPCMatrix",t.tmpMat4),r&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,i,16*l),u.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a){const e=a.getData();t.tmpColor[0]=e[4*l]/255,t.tmpColor[1]=e[4*l+1]/255,t.tmpColor[2]=e[4*l+2]/255,u.setUniform3fArray("ambientColorUniform",t.tmpColor),u.setUniform3fArray("diffuseColorUniform",t.tmpColor)}c&&u.setUniform3fArray("mapperIndex",c.getPropColorValue())},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=t.context,i=r.getProperty().getEdgeVisibility()&&o===Pf.SURFACE,s=t.openGLCamera.getKeyMatrices(n),l=t.openGLActor.getKeyMatrices();ve(t.normalMatrix,s.normalMatrix,l.normalMatrix),b(t.mcpcMatrix,s.wcpc,l.mcwc),b(t.mcvcMatrix,s.wcvc,l.mcwc);const c=t.renderable.getMatrixArray(),u=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),p=c.length/16;let f=!1;t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().getCurrentPass()===wf.COMPOSITE_INDEX_PASS&&(f=!0);for(let s=t.primTypes.Start;s{if(e.getCABO().getElementCount()&&(t.glyphBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime()))return e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||Af("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||Af("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||Af("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||Af("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(e,r,o),void e.getAttributeUpdateTime().modified();n.setMapperShaderParameters(e,r,o)},e.getNeedToRebuildBufferObjects=(e,r)=>(t.renderable.buildArrays(),t.VBOBuildTime.getMTime()!!(n.getNeedToRebuildShaders(e,r,o)||e.getShaderSourceTime().getMTime(){if(t.hardwareSupport){const e=t.renderable.getMatrixArray(),n=t.renderable.getNormalArray(),r=t.renderable.getColorArray();if(t.matrixBuffer||(t.matrixBuffer=ad.newInstance(),t.matrixBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.normalBuffer=ad.newInstance(),t.normalBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorBuffer=ad.newInstance(),t.colorBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.pickBuffer=ad.newInstance(),t.pickBuffer.setOpenGLRenderWindow(t._openGLRenderWindow)),t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(e,If.ARRAY_BUFFER),t.normalBuffer.upload(n,If.ARRAY_BUFFER),r?t.colorBuffer.upload(r.getData(),If.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();const o=e.length/16,a=new Uint8Array(4*o);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vf,n),fp.extend(e,t,n),t.tmpMat3=pe(new Float64Array(9)),t.normalMatrix=pe(new Float64Array(9)),t.mcpcMatrix=g(new Float64Array(16)),t.mcvcMatrix=g(new Float64Array(16)),t.tmpColor=[],t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),Rf(e,t)}),"vtkOpenGLGlyph3DMapper");rn("vtkGlyph3DMapper",Ef);const{vtkErrorMacro:Df}=jt;class Lf{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const a=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Df("Invalid or missing input");const r=Pu.newInstance();r.shallowCopy(n);const o=new Lf,a=n.getLines().getData();let i=0;for(;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),jt.obj(e,t),jt.algo(e,t,1,1),Bf(e,t)}var Ff={newInstance:jt.newInstance(kf,"vtkClosedPolyLineToSurfaceFilter"),extend:kf};const{vtkErrorMacro:_f}=Kt;function Gf(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void _f("Invalid or missing input");if(!t.cutFunction)return void _f("Missing cut function");const o=Pu.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),a=r.getNumberOfPoints(),i=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const a=[];for(let e=0;e0;if(g[r]>0===i)continue;let s=e,l=r,c=g[l]-g[s];c<=0&&(s=r,l=e,c*=-1);let u=0;0!==c&&(u=(t.cutValue-g[s])/c);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const h=[p[0]+u*(f[0]-p[0]),p[1]+u*(f[1]-p[1]),p[2]+u*(f[2]-p[2])];a.push({pointEdge1:d,pointEdge2:m,intersectedPoint:h,newPointID:-1})}for(let e=0;e2&&(l.push(c),a.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(it(r.getDataType(),i),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Uf={cutFunction:null,cutScalars:null,cutValue:0};function Wf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uf,n),yt(e,t),Mt(e,t,1,1),At(e,t,["cutFunction","cutValue"]),Gf(e,t)}var zf={newInstance:Et(Wf,"vtkCutter"),extend:Wf};const Hf=e=>e,jf=1e-6;class Kf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=g(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?l:Hf}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);Pn(n,e[0],e[1],e[2]),Pn(r,t[0],t[1],t[2]),Vn(n,n),Vn(r,r);const a=En(n,r);return a>=1||(Dn(this.tmp,n,r),Sn(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(ua(To,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qf,n),jt.obj(e,t),jt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),jt.setGetArray(e,t,["center","rotations"],3),jt.setGetArray(e,t,["matrix"],16),t._polys=xc.newInstance({values:Uint16Array.from(Yf)}),t._lineCells=xc.newInstance({values:Uint16Array.from(Xf)}),jt.moveToProtected(e,t,["polys","lineCells"]),jt.algo(e,t,0,1),Zf(e,t)}var eg={newInstance:jt.newInstance(Jf,"vtkCubeSource"),extend:Jf};const{vtkErrorMacro:tg}=jt;function ng(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void tg("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):tg("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const rg={};function og(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rg,n),jt.obj(e,t),jt.algo(e,t,1,1),t._cubeSource=eg.newInstance(),jt.moveToProtected(e,t,["cubeSource","tmpOut"]),ng(e,t)}var ag={newInstance:jt.newInstance(og,"vtkImageDataOutlineFilter"),extend:og};let ig;function sg(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Ln(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let a=0;a{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?b(n,t.matrix,e):b(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),a=t.preMultiplyFlag?()=>b(o,t.matrix,r):()=>b(o,r,t.matrix);for(let t=0;tig({matrix:za.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const lg={preMultiplyFlag:!1,matrix:[...To]};function cg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lg,n),jt.obj(e,t),jt.setGet(e,t,["preMultiplyFlag"]),jt.setGetArray(e,t,["matrix"],16),sg(e,t)}ig=jt.newInstance(cg,"vtkTransform");var ug={newInstance:ig,extend:cg};const dg={NEAREST:0,LINEAR:1};var pg={InterpolationType:dg};const{vtkErrorMacro:fg}=Kt;function gg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function mg(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function hg(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):fg("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===dg.NEAREST?(t.openGLTexture.setMinificationFilter(Vd.NEAREST),t.openGLTexture.setMagnificationFilter(Vd.NEAREST),t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST),t.pwfTexture.setMinificationFilter(Vd.NEAREST),t.pwfTexture.setMagnificationFilter(Vd.NEAREST)):(t.openGLTexture.setMinificationFilter(Vd.LINEAR),t.openGLTexture.setMagnificationFilter(Vd.LINEAR),t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR),t.pwfTexture.setMinificationFilter(Vd.LINEAR),t.pwfTexture.setMagnificationFilter(Vd.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const a=o.getNumberOfComponents();let i=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===i&&t.openGLTextureString===i)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=$d.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=i,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),c=l.getIndependentComponents(),u=c?a:1,d=c?2*u:1,p=l.getRGBTransferFunction();i=gg(l,p,u);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===i&&t.colorTextureString===i)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=$d.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:fg("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ps.SURFACE,r)}t.VBOBuildString=h,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){a.isUniformUsed("texture1")&&a.setUniformi("texture1",t.openGLTexture.getTextureUnit()),a.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||fg("Error setting vertexWC in shader VAO.")),a.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||fg("Error setting normalWC in shader VAO.")),a.isUniformUsed("slabThickness")&&a.setUniformf("slabThickness",t.renderable.getSlabThickness()),a.isUniformUsed("spacing")&&a.setUniform3fv("spacing",t.currentInput.getSpacing()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabTrapezoid")&&a.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(a.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();d(t.tmpMat4,n.getIndexToWorld()),T(t.tmpMat4,t.tmpMat4,r),h(t.tmpMat4,t.tmpMat4),e&&b(t.tmpMat4,t.tmpMat4,e),a.setUniformMatrix("WCTCMatrix",t.tmpMat4)}a.isUniformUsed("vboScaling")&&a.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const a=t._openGLCamera.getKeyMatrices(n),i=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",mg([a.wcpc,i.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",mg([a.wcvc,i.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.openGLTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let c=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(c=!0),!(!c&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a&&t.lastSlabThickness===i&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,t.lastSlabThickness=i,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=xd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=xd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const a=e.Geometry;let i=e.Fragment;const s=t.renderable.getSlabThickness();o=xd.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),c=r.getProperty().getIndependentComponents();let u=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(c){for(let e=1;e0&&(u=u.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),u=u.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),i=xd.substitute(i,"//VTK::TCoord::Dec",u).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),c){const e=["r","g","b","a"];for(let t=0;t{let a=n.Vertex;const i=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let c=["attribute vec4 vertexWC;"];c=c.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(c=c.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),a=xd.substitute(a,"//VTK::PositionVC::Dec",c).result;let u=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(u=u.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),a=xd.substitute(a,"//VTK::PositionVC::Impl",u).result,a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=xd.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=a,n.Geometry=i,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const i=t.renderable.getSlicePolyData(),s=t.renderable.getSlicePlane();if(i)e=e.concat(`PolyData${i.getMTime()}`);else if(s){e=e.concat(`Plane${s.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=ue(n?.getDirection());ge(t,t);const r=[...s.getNormal()];Bn(r,r,t),[o,a]=function(e){za.normalize(e);const t=[0,0,0];for(let r=0;r<3;++r){(n=t)[0]=0,n[1]=0,n[2]=0,t[r]=1;const o=za.dot(e,t);if(o<-.999||o>.999)return[!0,r]}var n;return[!1,2]}(r)}else{const o=ri.newInstance();o.setNormal(0,0,1);let a=[0,1,0,1,0,1];n&&(a=r),o.setOrigin(a[0],a[2],.5*(a[5]+a[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${s?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(i)t.resliceGeom||(t.resliceGeom=Pu.newInstance()),t.resliceGeom.getPoints().setData(i.getPoints().getData(),3),t.resliceGeom.getPolys().setData(i.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(i.getPointData().getNormals());else if(s)if(o){const e=new Float32Array(12),r=n.worldToIndex(s.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),l=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let c=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[c+a]=r[a],e[c+o[0]]=l[2*o[0]+n],e[c+o[1]]=l[2*o[1]+t],c+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const u=new Uint16Array(8);u[0]=3,u[1]=0,u[2]=1,u[3]=3,u[4]=3,u[5]=0,u[6]=3,u[7]=2;const d=s.getNormal();za.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=Pu.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(u,1);const f=Us.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(s),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=Pu.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=s.getNormal(),o=t.resliceGeom.getNumberOfPoints();za.normalize(r);const a=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const vg={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const yg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.tris=Md.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},yt(t.VBOBuildTime),t.tmpMat4=g(new Float64Array(16)),t.outlineFilter=ag.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=Pu.newInstance(),t.cutter=zf.newInstance(),t.lineToSurfaceFilter=Ff.newInstance(),t.transform=ug.newInstance(),xt(e,t,["openGLTexture"]),hg(e,t)}),"vtkOpenGLImageResliceMapper");rn("vtkImageResliceMapper",yg);var bg={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}};const{vtkErrorMacro:xg}=Kt,{SlicingMode:Tg}=bg;function Cg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Sg(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function Ag(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,a=xd.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,a=xd.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=a,n.Fragment=i,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(et("OpenGL has a limit of 6 clipping planes"),e=6),o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=xd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=xd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents();let i=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(i=!0),!(!i&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||xg("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||xg("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const a=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",a);const i=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(et("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const a=n.getProgram(),i=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();b(t.imagemat,i.mcwc,l);const c=t.openGLCamera.getKeyMatrices(r);if(b(t.imagemat,c.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,e)}if(a.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();a.setUniform3i("imageDimensions",o[0],o[1],1),a.setUniformMatrix("vWCtoIDX",n);const i=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,i.wcpc),t.openGLCamera.getKeyMatrices(r),a.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();a.setUniformf("vpWidth",l[0]),a.setUniformf("vpHeight",l[1]);const c=e.getRenderTargetOffset();a.setUniformf("vpOffsetX",c[0]/l[0]),a.setUniformf("vpOffsetY",c[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):xg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;const i=a.getDataType(),s=a.getNumberOfComponents(),l=r.getProperty(),c=l.getInterpolationType(),u=l.getIndependentComponents(),d=u?s:1,p=u?2*d:1,f=l.getRGBTransferFunction(),g=Cg(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===g&&t.colorTextureString===g)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=$d.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),c===dg.NEAREST?(t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST)):(t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Tg.X,Tg.Y,Tg.Z].includes(t.renderable.getSlicingMode())?x:T,p=o.getSpatialExtent(),f=a.getData();let g=null;if(b===Tg.I){g=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=$d.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Pg={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Ig=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pg,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.tris=Md.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),At(e,t,[]),t.VBOBuildTime={},yt(t.VBOBuildTime),Ag(e,t)}),"vtkOpenGLImageMapper");rn("vtkAbstractImageMapper",Ig);const{vtkErrorMacro:wg}=jt;function Og(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Mg(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===dg.NEAREST?(t.volumeTexture.setMinificationFilter(Vd.NEAREST),t.volumeTexture.setMagnificationFilter(Vd.NEAREST),t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST),t.pwfTexture.setMinificationFilter(Vd.NEAREST),t.pwfTexture.setMagnificationFilter(Vd.NEAREST)):(t.volumeTexture.setMinificationFilter(Vd.LINEAR),t.volumeTexture.setMagnificationFilter(Vd.LINEAR),t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR),t.pwfTexture.setMinificationFilter(Vd.LINEAR),t.pwfTexture.setMagnificationFilter(Vd.LINEAR));const a=r.getMTime();if(t.volumeTextureTime!==a){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=a}const i=r.getPointData()&&r.getPointData().getScalars();if(!i)return;const s=i.getNumberOfComponents(),l=n.getProperty(),c=l.getIndependentComponents(),u=c?s:1,d=c?2*u:1,p=Og(l,l.getRGBTransferFunction,u);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==i||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==a)&&(t.lastUseCenterPoint=i,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),a=xd.substitute(a,"//VTK::Color::Dec",s).result;const c=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?c.push("centerlineDirVSOutput = centerlineDirection;"):c.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),a=xd.substitute(a,"//VTK::Color::Impl",c).result;const u=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=xd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=xd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getShaderTemplate=(e,t,n)=>{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||wg("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&wg(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const a=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",a),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const i=t.currentImageDataInput,s=i.getWorldToIndex(),l=w(new Float32Array(16),Rn([],i.getDimensions())),c=oe(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",c),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentImageDataInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,a=t.openGLCamera.getKeyMatrices(n).wcpc;if(b(t.imagemat,a,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.volumeTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const Rg={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const Vg=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Zt.extend(e,t,n),Yd(e,t,n),jt.algo(e,t,2,0),t.tris=Md.newInstance(),t.volumeTexture=$d.newInstance(),t.colorTexture=$d.newInstance(),t.pwfTexture=$d.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),Mg(e,t)}),"vtkOpenGLImageCPRMapper");function Eg(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkImageCPRMapper",Vg);const Dg={context:null,keyMatrixTime:null,keyMatrices:null};const Lg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},At(e,t,["context"]),Eg(e,t)}),"vtkOpenGLImageSlice");function Bg(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.MCWCMatrix,t.renderable.getMatrix()),m(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?pe(t.normalMatrix):(se(t.normalMatrix,t.MCWCMatrix),ge(t.normalMatrix,t.normalMatrix),fe(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}rn("vtkImageSlice",Lg);const Ng={};const kg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ng,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),At(e,t,["context"]),Bg(e,t)}),"vtkOpenGLVolume");rn("vtkVolume",kg);const Fg=0,_g=1,Gg=1,Ug=0,Wg=1,zg=2,Hg=3,jg=4,{vtkWarningMacro:Kg,vtkErrorMacro:$g}=Kt;function qg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Xg(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Fragment;o.getProperty().getInterpolationType()===_g&&(a=xd.substitute(a,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(a=xd.substitute(a,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const i=t.scalarTexture.getComponents();a=xd.substitute(a,"//VTK::NumComponents",`#define vtkNumComponents ${i}`).result;const s=o.getProperty().getIndependentComponents();if(s){a=xd.substitute(a,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(a=xd.substitute(a,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),c=t.currentInput.getSpacing(),u=new Float64Array(3);Pn(u,(l[1]-l[0])*c[0],(l[3]-l[2])*c[1],(l[5]-l[4])*c[2]);const d=Sn(u)/e.getCurrentSampleDistance(r);a=xd.substitute(a,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,a=xd.substitute(a,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(a=xd.substitute(a,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(a=xd.substitute(a,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(a=xd.substitute(a,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,a=0;n.getLights().forEach((e=>{e.getSwitch()&&(a+=1)})),o=xd.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${a}];`,`uniform vec3 lightDirectionVC[${a}]; // normalized`,`uniform vec3 lightHalfAngleVC[${a}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=xd.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${a}];`,`uniform vec3 lightAttenuation[${a}];`,`uniform float lightConeAngle[${a}];`,`uniform float lightExponent[${a}];`,`uniform int lightPositional[${a}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=xd.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=xd.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=xd.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=xd.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let a=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===Ug&&(a=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===a&&(a=1)),1===a&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(a=2),a<3&&e.getPositional()&&(a=3)})));let i=!1;t.lastLightComplexity!==a&&(t.lastLightComplexity=a,i=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=!1;const u=[];if(l){for(let e=0;e0&&(c=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);Pn(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const g=Sn(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:c,iComps:l,maxSamples:g,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:u};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(a.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||$g("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),a.setUniformi("texture1",t.scalarTexture.getTextureUnit()),a.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const i=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],c=[];for(let e=0;e<4;e++)l[e]=s[0]*i.dataComputedScale[e]+i.dataComputedOffset[e],c[e]=s[1]*i.dataComputedScale[e]+i.dataComputedOffset[e],l[e]=(l[e]-i.offset[e])/i.scale[e],c[e]=(c[e]-i.offset[e])/i.scale[e];if(a.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),a.setUniform4f("ipScalarRangeMax",c[0],c[1],c[2],c[3]),null!==t.zBufferTexture){a.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();a.setUniformf("vpZWidth",e[0]),a.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const a=t.openGLCamera.getKeyMatrices(r),i=t.openGLVolume.getKeyMatrices();b(t.modelToView,a.wcvc,i.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),c=l.getClippingRange();s.setUniformf("camThick",c[1]-c[0]),s.setUniformf("camNear",c[0]),s.setUniformf("camFar",c[1]);const u=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let g=1,m=-1,v=1,y=-1;for(let e=0;e<8;++e)Pn(p,u[e%2],u[2+Math.floor(e/2)%2],u[4+Math.floor(e/4)]),Ln(p,p,t.modelToView),l.getParallelProjection()||(Vn(f,p),On(p,f,-c[0]/p[2])),Ln(p,p,a.vcpc),g=Math.min(p[0],g),m=Math.max(p[0],m),v=Math.min(p[1],v),y=Math.max(p[1],y);s.setUniformf("dcxmin",g),s.setUniformf("dcxmax",m),s.setUniformf("dcymin",v),s.setUniformf("dcymax",y),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),T=t.currentInput.getSpacing(),C=new Float64Array(3);Pn(C,(x[1]-x[0])*T[0],(x[3]-x[2])*T[1],(x[5]-x[4])*T[2]),s.setUniform3f("vSpacing",T[0],T[1],T[2]),Pn(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Ln(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();b(t.idxToView,t.modelToView,S),ve(t.idxNormalMatrix,a.normalMatrix,i.normalMatrix),ve(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const A=Sn(C)/e.getCurrentSampleDistance(r);A>t.renderable.getMaximumSamplesPerRay()&&Kg(`The number of steps required ${Math.ceil(A)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const P=new Float64Array(3);if(Pn(P,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(P,P,C),s.setUniform3f("vVCToIJK",P[0],P[1],P[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const I=new Float64Array(3),w=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:Pn(I,-1,0,0),Pn(w,x[0],x[2],x[4]);break;case 2:Pn(I,0,1,0),Pn(w,x[1],x[3],x[5]);break;case 3:Pn(I,0,-1,0),Pn(w,x[0],x[2],x[4]);break;case 4:Pn(I,0,0,1),Pn(w,x[1],x[3],x[5]);break;case 5:Pn(I,0,0,-1),Pn(w,x[0],x[2],x[4]);break;default:Pn(I,1,0,0),Pn(w,x[1],x[3],x[5])}Bn(I,I,t.idxNormalMatrix),Ln(w,w,t.idxToView);const n=-1*En(w,I);s.setUniform3f(`vPlaneNormal${e}`,I[0],I[1],I[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[a,i]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const c=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,c.wcpc),o.setClippingRange(a,i),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const u=e.getRenderTargetSize();s.setUniformf("vpWidth",u[0]),s.setUniformf("vpHeight",u[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/u[0]),s.setUniformf("vpOffsetY",d[1]/u[1])}if(h(t.projectionToView,a.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let O=0;const M=[],R=[],V=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();M[0+3*O]=t[0]*n,M[1+3*O]=t[1]*n,M[2+3*O]=t[2]*n;const r=e.getDirection();Pn(I,r[0],r[1],r[2]),Bn(I,I,a.normalMatrix),Vn(I,I),R[0+3*O]=I[0],R[1+3*O]=I[1],R[2+3*O]=I[2],V[0+3*O]=-.5*I[0],V[1+3*O]=-.5*I[1],V[2+3*O]=-.5*(I[2]-1),O++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",O),s.setUniform3fv("lightColor",M),s.setUniform3fv("lightDirectionVC",R),s.setUniform3fv("lightHalfAngleVC",V),3===t.lastLightComplexity){O=0;const e=[],n=[],o=[],a=[],i=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*O]=s[0],n[1+3*O]=s[1],n[2+3*O]=s[2],a[O]=r.getExponent(),o[O]=r.getConeAngle(),i[O]=r.getPositional();const l=r.getTransformedPosition();Ln(l,l,t.modelToView),e[0+3*O]=l[0],e[1+3*O]=l[1],e[2+3*O]=l[2],O+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",a),s.setUniformiv("lightPositional",i)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const a=t.scalarTexture.getVolumeInfo(),i=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",i.getAmbient()),o.setUniformf("vDiffuse",i.getDiffuse()),o.setUniformf("vSpecular",i.getSpecular()),o.setUniformf("vSpecularPower",i.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],a=[],i=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Fg?(t.scalarTexture.setMinificationFilter(Vd.NEAREST),t.scalarTexture.setMagnificationFilter(Vd.NEAREST)):(t.scalarTexture.setMinificationFilter(Vd.LINEAR),t.scalarTexture.setMagnificationFilter(Vd.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ad.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||$g("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):$g("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;t._scalars!==a&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=a);const i=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Vd.LINEAR),t.jitterTexture.setMagnificationFilter(Vd.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,ws.UNSIGNED_CHAR,e)}const s=a.getNumberOfComponents(),l=i.getIndependentComponents()?s:1,c=i.getScalarOpacity(),u=t._openGLRenderWindow.getGraphicsResourceForObject(c);let d=qg(i,c,l);if(u.vtkObj&&u.hash===d&&t.opacityTextureString===d)t.opacityTexture=u.vtkObj,t.opacityTextureString=u.hash;else{const r=1024,o=2*r*l,a=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Us.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Us.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ps.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yg,n),Zt.extend(e,t,n),t.VBOBuildTime={},yt(t.VBOBuildTime,{mtime:0}),t.tris=Md.newInstance(),t.scalarTexture=$d.newInstance(),t.opacityTexture=$d.newInstance(),t.colorTexture=$d.newInstance(),t.jitterTexture=$d.newInstance(),t.jitterTexture.setWrapS(Rd.REPEAT),t.jitterTexture.setWrapT(Rd.REPEAT),t.labelOutlineThicknessTexture=$d.newInstance(),t.framebuffer=nf.newInstance(),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),At(e,t,["context"]),Xg(e,t)}),"vtkOpenGLVolumeMapper");rn("vtkVolumeMapper",Zg);const{vtkDebugMacro:Qg}=Kt;function Jg(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),a=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,i=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),a=t._openGLRenderWindow.getContext();e.bind();const i=r.getFramebuffer();i?i.saveCurrentBindingsAndBuffers():Qg("No framebuffer to save/restore");const l=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.getHandle(),0),a.checkFramebufferStatus(a.FRAMEBUFFER)===a.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),a.viewport(0,0,n,o),a.readPixels(0,0,n,o,a.RGBA,a.UNSIGNED_BYTE,s)),i&&i.restorePreviousBindingsAndBuffers(),a.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const em={};const tm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,em,n),Zt.extend(e,t,n),Jg(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");rn("vtkPixelSpaceCallbackMapper",tm);var nm="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtktextureObjectVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\nattribute vec2 tcoordDC;\nvarying vec2 tcoordVC;\n\nvoid main()\n{\n tcoordVC = tcoordDC;\n gl_Position = vertexDC;\n}\n";const{Representation:rm}=xs;function om(e,t,n,r){let[o,a]=t;const i=e.getContext(),s=$d.newInstance({autoParameters:!1,wrapS:r,wrapT:r,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:i.FLOAT,baseLevel:0,maxLevel:0});return s.setOpenGLRenderWindow(e),s.setInternalFormat(i.RGBA32F),s.create2DFromRaw(o,a,4,"Float32Array",null),s.activate(),s.sendParameters(),s.deactivate(),s}function am(e,t){return om(e,t,$d.Filter.NEAREST,$d.Wrap.CLAMP_TO_EDGE)}function im(e,t){t.classHierarchy.push("vtkLICPingPongBufferManager"),t._openGLRenderWindow?(t.quad=function(e){const t=Md.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Us.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Us.newInstance({numberOfComponents:1,values:o}),s=Us.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",rm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow),t.context=t._openGLRenderWindow.getContext(),t.licTexture0=am(t._openGLRenderWindow,t.size),t.seedTexture0=am(t._openGLRenderWindow,t.size),t.licTexture1=am(t._openGLRenderWindow,t.size),t.seedTexture1=am(t._openGLRenderWindow,t.size),t.eeTexture=t.doEEPass?om(t._openGLRenderWindow,t.size,$d.Filter.NEAREST,$d.Wrap.CLAMP_TO_EDGE):null,t.imageVectorTexture=t.doVTPass?function(e,t){return om(e,t,$d.Filter.LINEAR,$d.Wrap.CLAMP_TO_EDGE)}(t._openGLRenderWindow,t.size):null,t.pingTextures[0]=t.licTexture0,t.pingTextures[1]=t.seedTexture0,t.pongTextures[0]=t.licTexture1,t.pongTextures[1]=t.seedTexture1,t.textures[0]=t.pingTextures,t.textures[1]=t.pongTextures,e.swap=()=>{t.readIndex=1-t.readIndex},e.renderQuad=(e,n)=>{const r=t.quad,o=t.context;let a=t.quadVAO;a||(a=Ad.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.quadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.getLastLICBuffer=()=>0===t.readIndex?t.licTexture0:t.licTexture1,e.getLastSeedBuffer=()=>0===t.readIndex?t.seedTexture0:t.seedTexture1,e.getLICBuffer=()=>1-t.readIndex==0?t.licTexture0:t.licTexture1,e.getSeedBuffer=()=>1-t.readIndex==0?t.seedTexture0:t.seedTexture1,e.getLICTextureUnit=()=>{const e=t.textures[t.readIndex][0];return e.activate(),e.getTextureUnit()},e.getSeedTextureUnit=()=>{const e=t.textures[t.readIndex][1];return e.activate(),e.getTextureUnit()},e.getNoiseTextureUnit=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 0===e?(t.noiseTexture.activate(),t.noiseTexture.getTextureUnit()):(t.eeTexture.activate(),t.eeTexture.getTextureUnit())},e.getVectorTextureUnit=()=>(t.vectorTexture.activate(),t.vectorTexture.getTextureUnit()),e.getImageVectorTextureUnit=()=>t.imageVectorTexture?(t.imageVectorTexture.activate(),t.imageVectorTexture.getTextureUnit()):e.getVectorTextureUnit(),e.getMaskVectorTextureUnit=()=>t.maskVectorTexture?(t.maskVectorTexture.activate(),t.maskVectorTexture.getTextureUnit()):e.getImageVectorTextureUnit(),e.clearBuffers=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),n.setColorBuffer(t.licTexture0,0),n.setColorBuffer(t.seedTexture0,1),n.setColorBuffer(t.licTexture1,2),n.setColorBuffer(t.seedTexture1,3);const o=[r.COLOR_ATTACHMENT0,r.COLOR_ATTACHMENT1,r.COLOR_ATTACHMENT2,r.COLOR_ATTACHMENT3];e&&(n.removeColorBuffer(4),n.setColorBuffer(t.eeTexture,4),o.push(r.COLOR_ATTACHMENT4)),r.drawBuffers(o),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),e&&n.removeColorBuffer(4),r.drawBuffers([r.NONE])},e.clearBuffer=e=>{const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.setColorBuffer(e,0),r.drawBuffers([r.COLOR_ATTACHMENT0]),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(e,0),r.drawBuffers([r.NONE])},e.activateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.activate():t.vectorTexture.activate(),t.maskVectorTexture&&t.maskVectorTexture.activate()},e.deactivateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.deactivate():t.vectorTexture.deactivate(),t.maskVectorTexture&&t.maskVectorTexture.deactivate()},e.activateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.activate();break;case 1:t.eeTexture.activate();break;default:console.error("Wrong LIC pass number")}},e.deactivateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.deactivate();break;case 1:t.eeTexture.deactivate();break;default:console.error("Wrong LIC pass number")}},e.attachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.textures[1-t.readIndex],r=t.framebuffer,o=t.context;e[0].activate(),e[1].activate(),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(n[0],0),r.setColorBuffer(n[1],1),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1])},e.detachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.context,r=t.framebuffer;e[0].deactivate(),e[1].deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE])},e.attachImageVectorBuffer=()=>{const e=t.framebuffer,n=t.context;t.vectorTexture.activate(),e.removeColorBuffer(0),e.setColorBuffer(t.imageVectorTexture,0),n.drawBuffers([n.COLOR_ATTACHMENT0])},e.detachImageVectorBuffer=()=>{const e=t.context,n=t.framebuffer;t.vectorTexture.deactivate(),n.removeColorBuffer(0),e.drawBuffers([e.NONE])},e.attachEEBuffer=()=>{t.textures[t.readIndex][0].activate(),t.framebuffer.removeColorBuffer(0),t.framebuffer.setColorBuffer(t.eeTexture,0);const e=t.context;e.drawBuffers([e.COLOR_ATTACHMENT0])},e.detachEEBuffer=()=>{const e=t.context;t.framebuffer.removeColorBuffer(0),e.drawBuffers([e.NONE]),t.textures[t.readIndex][0].deactivate()},e.detachBuffers=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),e.drawBuffers([e.NONE]);const r=t.textures[t.readIndex],o=t.textures[1-t.readIndex];r[0]&&r[0].deactivate(),r[1]&&r[1].deactivate(),o[0]&&o[0].deactivate(),o[1]&&o[1].deactivate(),t.eeTexture&&t.eeTexture.deactivate(),t.noiseTexture&&t.noiseTexture.deactivate()},e.getWriteIndex=()=>1-t.readIndex,e.detachBuffers()):console.error("Pass renderwindow to ping pong manager")}const sm={vectorTexture:null,maskVectorTexture:null,noiseTexture:null,doEEPass:!1,doVTPass:!1,readIndex:0,quad:null,lastProgramHash:null,framebuffer:null,size:null,pingTextures:[],pongTextures:[],textures:[]};function lm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sm,n),jt.obj(e,t),jt.get(e,t,["readIndex"]),jt.setGet(e,t,["doEEPass","doVTPass","_openGLRenderWindow","vectorTexture","maskVectorTexture","noiseTexture","framebuffer","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),im(e,t)}var cm={newInstance:jt.newInstance(lm,"vtkLICPingPongBufferManager"),extend:lm};const um=0,dm=1,pm=2,fm=3,gm=1;function mm(e,t){function n(e,t){e.setUniformi("texLIC",t.getLICTextureUnit()),e.setUniformi("texSeedPts",t.getSeedTextureUnit())}function r(e,t,n){e.attachLICBuffers(),e.renderQuad(t,n),e.detachLICBuffers(),e.swap()}t.classHierarchy.push("vtkLineIntegralConvolution2D"),e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(nm,e,""),e.dumpTextureValues=function(e,n){let[r,o]=n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4;const l=nf.newInstance(),c=a;let u=null;return l.setOpenGLRenderWindow(i),l.saveCurrentBindingsAndBuffers(),l.create(r,o),l.populateFramebuffer(),l.setColorBuffer(e),u=new Float32Array(r*o*s),c.readPixels(0,0,r,o,4===s?c.RGBA:c.RGB,c.FLOAT,u),l.restorePreviousBindingsAndBuffers(),u},e.getTextureMinMax=function(n,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow;const i=e.dumpTextureValues(n,r,o,a,4);let s=Number.MAX_VALUE,l=Number.MIN_VALUE;for(let e=0;el&&(l=t)}return{min:s,max:l}},e.getComponentSelectionProgram=e=>{const t="xyzw";return`.${t[e[0]]}${t[e[1]]}`},e.buildShaders=()=>{t.LIC0ShaderProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LIC0.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n/**\nThis shader initializes the convolution for the LIC computation.\n*/\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texMaskVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\n\nuniform int uStepNo; // in step 0 initialize lic and seeds, else just seeds\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uMaskThreshold; // if |V| < uMaskThreshold render transparent\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the *whole* domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value. this\n// depends on the pass number.\nvec2 getNoiseTC(vec2 vectc)\n{\n // in pass 1 : convert from vector tc to noise tc\n // in pass 2 : use vector tc\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(vectc);\n }\n else\n {\n return vectc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the\n// need to convert to noise texture coordinates.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\nvoid main(void)\n{\n vec2 vectc = tcoordVC.st;\n\n // lic => (convolution, mask, 0, step count)\n if (uStepNo == 0)\n {\n float maskCriteria = length(texture2D(texMaskVectors, vectc).xyz);\n float maskFlag;\n if (maskCriteria <= uMaskThreshold)\n {\n maskFlag = 1.0;\n }\n else\n {\n maskFlag = 0.0;\n }\n float noise = getNoise(vectc);\n LICOutput = vec4(noise, maskFlag, 0.0, 1.0);\n }\n else\n {\n LICOutput = texture2D(texLIC, vectc);\n }\n\n // initial seed\n SeedOutput = vec4(vectc, 0.0, 1.0);\n}\n");const n=xd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_VT.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// move vector field to normalized image space\n// pre-processing for vtkLineIntegralConvolution2D\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Fragment shader used by the gaussian blur filter render pass.\n\nuniform sampler2D texVectors; // input texture\nuniform vec2 uTexSize; // size of texture\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n //VTK::LICComponentSelection::Impl\n V = V/uTexSize;\n gl_FragData[0] = vec4(V, 0.0, 1.0);\n}\n","//VTK::LICComponentSelection::Impl",`vec2 V = texture2D(texVectors, tcoordVC.st)${e.getComponentSelectionProgram(t.componentIds)};`).result;t.VTProgram=e.buildAShader(n);const r=xd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs1.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\nuniform sampler2D texSeedPts;\n\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uStepSize; // step size in parametric space\n\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n//VTK::LICVectorLookup::Impl\n\n// We need to do this manually since CLAMP_TO_BORDER and and borderColor\n// are very poorly supported in webgl\nvec2 clampToBorder(vec2 uv){\n if(uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)\n {\n return vec2(0.0, 0.0);\n }\n return getVector(uv);\n}\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the whole domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value.\n// in pass 1 repeatedly tile the noise texture across\n// the computational domain.\nvec2 getNoiseTC(vec2 tc)\n{\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(tc);\n }\n else\n {\n return tc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the need\n// to convert to either noise or lic texture coordinates in\n// pass 1 and 2 respectively.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\n// fourth-order Runge-Kutta streamline integration\n// no bounds checks are made, therefore it's essential\n// to have the entire texture initialized to 0\n// and set clamp to border and have border color 0\n// an integer is set if the step was taken, keeping\n// an accurate step count is necessary to prevent\n// boundary artifacts. Don't count the step if\n// all vector lookups are identically 0. This is\n// a proxy for \"stepped outside valid domain\"\nvec2 rk4(vec2 pt0, float dt, out bool count)\n{\n count=true;\n float dtHalf = dt * 0.5;\n vec2 pt1;\n\n vec2 v0 = clampToBorder(pt0);\n pt1 = pt0 + v0 * dtHalf;\n\n vec2 v1 = clampToBorder(pt1);\n pt1 = pt0 + v1 * dtHalf;\n\n vec2 v2 = clampToBorder(pt1);\n pt1 = pt0 + v2 * dt;\n\n vec2 v3 = clampToBorder(pt1);\n vec2 vSum = v0 + v1 + v1 + v2 + v2 + v3;\n\n if (vSum == vec2(0.0, 0.0))\n {\n count = false;\n }\n\n pt1 = pt0 + (vSum) * (dt * (1.0/6.0));\n\n return pt1;\n}\n\nvoid main(void)\n{\n vec2 lictc = tcoordVC.st;\n vec4 lic = texture2D(texLIC, lictc);\n vec2 pt0 = texture2D(texSeedPts, lictc).st;\n\n bool count;\n vec2 pt1 = rk4(pt0, uStepSize, count);\n\n if (count)\n {\n // accumulate lic step\n // (lic, mask, 0, step count)\n float noise = getNoise(pt1);\n LICOutput = vec4(lic.r + noise, lic.g, 0.0, lic.a + 1.0);\n SeedOutput = vec4(pt1, 0.0, 1.0);\n }\n else\n {\n // keep existing values\n LICOutput = lic;\n SeedOutput = vec4(pt0, 0.0, 1.0);\n }\n}\n","//VTK::LICVectorLookup::Impl",function(){const e="\n vec2 getVector( vec2 vectc )\n\n {\n\n vec2 V = texture2D( texVectors, vectc ).xy;\n\n // normalize if |V| not 0\n\n float lenV = length( V );\n\n if ( lenV > 1.0e-8 )\n\n {\n\n return V/lenV;\n\n }\n\n else\n\n {\n\n return vec2( 0.0, 0.0 );\n\n }\n\n }\n\n ",t="\n vec2 getVector( vec2 vectc )\n\n {\n\n return texture2D( texVectors, vectc ).xy;\n\n }\n\n ";return arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?t:e}(t.normalizeVectors),!0).result;t.LICIShaderProgram=e.buildAShader(r),t.LICNShaderProgram=e.buildAShader(" //VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LICN.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n/**\nThis shader finalizes the convolution for the LIC computation\napplying the normalization. eg. if box kernel is used the this\nis the number of steps taken.\n*/\n\nuniform sampler2D texLIC;\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n vec4 conv = texture2D(texLIC, tcoordVC.st);\n conv.r = conv.r/conv.a;\n // lic => (convolution, mask, 0, 1)\n LICOutput = vec4(conv.rg , 0.0, 1.0);\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.CEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// gray scale contrast enhance stage implemented via histogram stretching\n// if the min and max are tweaked it can generate out-of-range values\n// these will be clamped in 0 to 1\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uMin; // min gray scale color value\nuniform float uMaxMinDiff; // max-min\n\nin vec2 tcoordVC;\n\nvoid main( void )\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g!=0.0)\n {\n LICOutput = lic;\n }\n else\n {\n float CElic = clamp((lic.r - uMin)/uMaxMinDiff, 0.0, 1.0);\n LICOutput = vec4(CElic, lic.gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.EEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// high-pass filter stage employed by vtkLineIntegralConvolution2D\n// between LIC pass 1 and LIC pass 2. filtered LIC pass 1, becomes\n// noise for pass2.\n\n// the output of this shader\nlayout(location = 0) out vec4 EEOutput;\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uDx; // fragment size\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n// kernel for simple laplace edge enhancement.\n// p=Laplace(p)+p\nfloat K[9] = float[9](\n -1.0, -1.0, -1.0,\n -1.0, 9.0, -1.0,\n -1.0, -1.0, -1.0\n );\n\n// determine if the fragment was masked\nbool Masked(float val) { return val != 0.0; }\n\nvoid main(void)\n{\n // tex coord neighbor offsets\n vec2 fragDx[9] = vec2[9](\n vec2(-uDx, uDy), vec2(0.0, uDy), vec2(uDx, uDy),\n vec2(-uDx, 0.0), vec2(0.0, 0.0), vec2(uDx, 0.0),\n vec2(-uDx,-uDy), vec2(0.0,-uDy), vec2(uDx,-uDy)\n );\n\n vec2 lictc = tcoordVC.st;\n\n // compute the convolution but don't use convovled values if\n // any masked fragments on the stencil. Fragments outside\n // the valid domain are masked during initialization, and\n // texture wrap parameters are clamp to border with border\n // color that contains masked flag\n float conv = 0.0;\n bool dontUse = false;\n for (int i=0; i<9; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n vec4 lic = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic.g);\n conv = conv + K[i] * lic.r;\n }\n\n if (dontUse)\n {\n EEOutput = vec4(texture2D(texLIC, lictc).rg, 0.0, 1.0);\n }\n else\n {\n conv = clamp(conv, 0.0, 1.0);\n EEOutput = vec4(conv,texture2D(texLIC, lictc).g, 0.0, 1.0);\n }\n\n}\n"),t.AAHProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAH.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// horizontal pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDx; // fragment size\n\nin vec2 tcoordVC;\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDx[3] = vec2[3](vec2(-uDx,0.0), vec2(0.0,0.0), vec2(uDx,0.0));\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.AAVProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAV.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// vertical pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDy[3] = vec2[3](vec2(0.0,-uDy), vec2(0.0,0.0), vec2(0.0,uDy));\n\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDy[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n")},e.executeLIC=(o,a,i,s,l,c)=>{if(t._openGLRenderWindow=l,t.context=l.getContext(),Object.assign(t,c),o[0]<=0||o[1]<=0)return null;const u=[1/o[0],1/o[1]];let d=t.stepSize*Math.sqrt(u[0]*u[0]+u[1]*u[1]);d<=0&&(d=1e-10);const p=t.context;let f=t.framebuffer;f&&o[0]===f.getSize()[0]&&o[1]===f.getSize()[1]||(f=nf.newInstance(),f.setOpenGLRenderWindow(t._openGLRenderWindow),f.saveCurrentBindingsAndBuffers(),f.create(...o),f.populateFramebuffer(),f.restorePreviousBindingsAndBuffers(),t.framebuffer=f),f.saveCurrentBindingsAndBuffers(),f.bind(),p.viewport(0,0,...o),p.scissor(0,0,...o),t.shadersNeedBuild&&(e.buildShaders(),t.shadersNeedBuild=!1),t.bufs?(t.bufs.setVectorTexture(a),t.bufs.setMaskVectorTexture(i),t.bufs.setNoiseTexture(s)):t.bufs=cm.newInstance({openGLRenderWindow:l,doEEPass:t.enhancedLIC,doVTPass:t.transformVectors,vectorTexture:a,maskVectorTexture:i,noiseTexture:s,framebuffer:f,size:o});const g=[(s.getWidth()+1)/o[0],(s.getHeight()+1)/o[1]],m=1/o[0],h=1/o[1],v=t._openGLRenderWindow.getShaderCache();if(t.transformVectors){const e=t.VTProgram;v.readyShaderProgram(e),t.bufs.attachImageVectorBuffer(),e.setUniform2f("uTexSize",...o),e.setUniformi("texVectors",t.bufs.getVectorTextureUnit()),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT),t.bufs.renderQuad(o,e),t.bufs.detachImageVectorBuffer()}t.bufs.clearBuffers(t.enhancedLIC),t.bufs.activateVectorTextures(),t.bufs.activateNoiseTexture(0);const{LIC0ShaderProgram:y}=t;v.readyShaderProgram(y),y.setUniformi("uStepNo",0),y.setUniformi("uPassNo",0),y.setUniformf("uMaskThreshold",t.maskThreshold),y.setUniform2f("uNoiseBoundsPt1",...g),y.setUniformi("texMaskVectors",t.bufs.getMaskVectorTextureUnit()),y.setUniformi("texLIC",t.bufs.getLICTextureUnit()),y.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0)),r(t.bufs,o,y);const{LICIShaderProgram:b}=t;v.readyShaderProgram(b),b.setUniformi("uPassNo",0),b.setUniformf("uStepSize",-d),b.setUniform2f("uNoiseBoundsPt1",...g),b.setUniformi("texVectors",t.bufs.getImageVectorTextureUnit()),b.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0));for(let e=0;e{const a=t._openGLRenderWindow.getShaderCache();let{min:i,max:s}=e.getTextureMinMax(t.bufs.getLastLICBuffer(),o,t.context,t._openGLRenderWindow);(s<=i||s>1||i<0)&&(console.error("Invalid color range: ",i,s),i=0,s=1);let l=s-i;n&&(i+=l*t.lowLICContrastEnhancementFactor,s-=l*t.highLICContrastEnhancementFactor,l=s-i);const{CEProgram:c}=t;a.readyShaderProgram(c),c.setUniformi("texLIC",t.bufs.getLICTextureUnit()),c.setUniformf("uMin",i),c.setUniformf("uMaxMinDiff",l),r(t.bufs,o,c)}}const hm={shadersNeedBuild:!0,stepSize:1,numberOfSteps:10,enhancedLIC:!0,enhanceContrast:!1,lowContrastEnhancementFactor:0,highContrastEnhancementFactor:0,antiAlias:0,componentIds:[0,1],normalizeVectors:!0,maskThreshold:0,transformVectors:!0,bufs:null,isComposite:!0};function vm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hm,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","nuberOfSteps","stepSize","normalizeVectors","maskThreshold","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","componentIds","isComposite"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),mm(e,t)}var ym={newInstance:jt.newInstance(vm,"vtkLineIntegralConvolution2D"),extend:vm};function bm(e,t){t.classHierarchy.push("vtkSurfaceLICInterface")}const xm={enableLIC:!1,nuberOfSteps:40,stepSize:.25,transformVectors:!0,normalizeVectors:!0,maskOnSurface:!1,maskThreshold:0,maskColor:[0,0,0],maskIntensity:0,enhancedLIC:!0,enhanceContrast:um,lowLICContrastEnhancementFactor:0,highLICContrastEnhancementFactor:0,lowColorContrastEnhancementFactor:0,highColorContrastEnhancementFactor:0,antiAlias:0,colorMode:0,LICIntensity:1,mapModeBias:0,noiseTextureSize:200,noiseTextureType:gm,noiseGrainSize:8,noiseImpulseProbability:.1,noiseImpulseBackgroundValue:0,noiseGeneratorSeed:0,minNoiseValue:0,maxNoiseValue:1,numberOfNoiseLevels:2,shadersNeedBuilding:!0,reallocateTextures:!0,rebuildNoiseTexture:!1,viewPortScale:1};function Tm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xm,n),jt.obj(e,t),jt.setGet(e,t,["enableLIC","numberOfSteps","stepSize","normalizeVectors","transformVectors","maskOnSurface","maskThreshold","maskColor","maskIntensity","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor","antiAlias","colorMode","LICIntensity","mapModeBias","noiseTextureSize","noiseTextureType","noiseGrainSize","minNoiseValue","maxNoiseValue","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","noiseGeneratorSeed","viewPortScale","rebuildNoiseTexture"]),bm(0,t)}var Cm={newInstance:jt.newInstance(Tm,"vtkSurfaceLICInterface"),extend:Tm};const{Representation:Sm}=xs;function Am(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICInterface"),e.renderQuad=(e,n)=>{const r=t.licQuad,o=t.context;let a=t.licQuadVAO;a||(a=Ad.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.licQuadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.generateNoiseTexture=e=>{if(!t.noiseTexture||t.licInterface.getRebuildNoiseTexture()){t.licInterface.setRebuildNoiseTexture(!1),t.noiseTexture&&t.noiseTexture.releaseGraphicsResources(),xo()(t.noiseGeneratorSeed,{global:!0});let n=[];const{noiseTextureType:r,noiseGrainSize:o,numberOfNoiseLevels:a,noiseImpulseProbability:i,noiseImpulseBackgroundValue:s,minNoiseValue:l,maxNoiseValue:c}=t.licInterface.get("noiseTextureType","noiseGrainSize","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","minNoiseValue","maxNoiseValue");n=r===gm?function(e,t,n,r,o,a){const i=Math.max(0,Math.min(1,n)),s=Float32Array.from({length:e*e},(()=>{let e=0;if(1===i||Math.random()>1-i)for(let t=0;t<2048;++t)e+=Math.random();return e}));let l=0,c=2049;s.forEach((e=>{c=1===i?e0?e:c,l=e>l?e:l}));let u=l-c;0===u&&(c=0,u=0===l?1:l);const d=t-1,p=0!==d?1/d:0,f=a-o;return s.map((e=>{const n=e=c?1===t?a:o+(i>d?d:i)*p*f:r}))}(Math.floor(e/o),a,i,s,l,c):function(e,t,n,r){let[o,a]=e;const i=r-n;return Float32Array.from({length:o*a},(()=>{let e=Math.random();return e=Math.floor(e*t)/t,e=e*i+n,e>1?1:e<0?0:e}))}([Math.ceil(e/o),Math.ceil(e/o)],a,l,c);const u=1/o,d=Float32Array.from({length:e*e*4},((t,r)=>{const a=r/4;if(r%4==0){const t=Math.floor(a%e*u),r=Math.floor(a/e*u);return n[r*(e/o)+t]}return r%4==1||r%4==3?1:0})),p=$d.newInstance({wrapS:$d.Wrap.REPEAT,wrapT:$d.Wrap.REPEAT,minificationFilter:$d.Filter.NEAREST,magnificationFilter:$d.Filter.NEAREST,generateMipMap:!1,openGLDataType:t.context.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});p.setOpenGLRenderWindow(t._openGLRenderWindow),p.create2DFromRaw(e,e,4,"Float32Array",d),p.activate(),p.sendParameters(),p.deactivate(),t.noiseTexture=p}},e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(nm,e,""),e.allocateTextures=()=>{const n=$d.Filter.NEAREST,r=$d.Filter.LINEAR,o=t._openGLRenderWindow;t.geometryImage||(t.geometryImage=e.allocateTexture(o,n)),t.vectorImage||(t.vectorImage=e.allocateTexture(o,r)),t.maskVectorImage||(t.maskVectorImage=e.allocateTexture(o,r)),t.LICImage||(t.LICImage=e.allocateTexture(o,n)),t.RGBColorImage||(t.RGBColorImage=e.allocateTexture(o,n)),t.HSLColorImage||(t.HSLColorImage=e.allocateTexture(o,n)),t.depthTexture||(t.depthTexture=e.allocateDepthTexture(o))},e.allocateTexture=(e,n)=>{const r=t.context,o=$d.newInstance({wrapS:$d.Wrap.CLAMP_TO_EDGE,wrapT:$d.Wrap.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:r.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});return o.setOpenGLRenderWindow(e),o.setInternalFormat(r.RGBA32F),o.create2DFromRaw(...t.size,4,"Float32Array",null),o.activate(),o.sendParameters(),o.deactivate(),o},e.allocateDepthTexture=e=>{const n=t.context,r=$d.newInstance({generateMipmap:!1,openGLDataType:n.FLOAT,autoParameters:!1});return r.setOpenGLRenderWindow(e),r.createDepthFromRaw(...t.size,"Float32Array",null),r.activate(),r.sendParameters(),r.deactivate(),r},e.createFBO=()=>{if(!t.framebuffer){t.licHelper=null;const e=nf.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow),e.saveCurrentBindingsAndBuffers(),e.create(...t.size),e.populateFramebuffer(),t.framebuffer=e,e.restorePreviousBindingsAndBuffers()}},e.completedGeometry=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeDepthBuffer(),e.drawBuffers([e.NONE]),n.restorePreviousBindingsAndBuffers()},e.buildAllShaders=()=>{t.shadersNeedBuilding&&(t.licColorPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader combines surface geometry, LIC, and scalar colors.\n\n// the output of this shader\nlayout(location = 0) out vec4 RGBOutput;\nlayout(location = 1) out vec4 HSLOutput;\n\nuniform sampler2D texVectors; // vectors, depth\nuniform sampler2D texGeomColors; // scalar colors + lighting\nuniform sampler2D texLIC; // image lic\nuniform int uScalarColorMode; // select between blend, and map shader\nuniform float uLICIntensity; // blend shader: blending factor for lic'd colors\nuniform float uMapBias; // map shader: adjust the brightness of the result\nuniform float uMaskIntensity; // blending factor for mask color\nuniform vec3 uMaskColor; // color for the masked out fragments\n\nin vec2 tcoordVC;\n\n/**\nConvert from RGB color space into HSL colorspace.\n*/\nvec3 RGBToHSL(vec3 RGB)\n{\n vec3 HSL = vec3(0.0, 0.0, 0.0);\n\n float RGBMin = min(min(RGB.r, RGB.g), RGB.b);\n float RGBMax = max(max(RGB.r, RGB.g), RGB.b);\n float RGBMaxMinDiff = RGBMax - RGBMin;\n\n HSL.z = (RGBMax + RGBMin) / 2.0;\n\n if (RGBMaxMinDiff == 0.0)\n {\n // Gray scale\n HSL.x = 0.0;\n HSL.y = 0.0;\n }\n else\n {\n // Color\n if (HSL.z < 0.5)\n HSL.y = RGBMaxMinDiff / (RGBMax + RGBMin);\n else\n HSL.y = RGBMaxMinDiff / (2.0 - RGBMax - RGBMin);\n\n float dR\n = (((RGBMax - RGB.r) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dG\n = (((RGBMax - RGB.g) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dB\n = (((RGBMax - RGB.b) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n\n if (RGB.r == RGBMax)\n HSL.x = dB - dG;\n else\n if (RGB.g == RGBMax)\n HSL.x = (1.0 / 3.0) + dR - dB;\n else\n if (RGB.b == RGBMax)\n HSL.x = (2.0 / 3.0) + dG - dR;\n\n if (HSL.x < 0.0)\n HSL.x += 1.0;\n\n if (HSL.x > 1.0)\n HSL.x -= 1.0;\n }\n\n return HSL;\n}\n\n/**\nHelper for HSL to RGB conversion.\n*/\nfloat Util(float v1, float v2, float vH)\n{\n if (vH < 0.0)\n vH += 1.0;\n\n if (vH > 1.0)\n vH -= 1.0;\n\n if ((6.0 * vH) < 1.0)\n return (v1 + (v2 - v1) * 6.0 * vH);\n\n if ((2.0 * vH) < 1.0)\n return (v2);\n\n if ((3.0 * vH) < 2.0)\n return (v1 + (v2 - v1) * ((2.0 / 3.0) - vH) * 6.0);\n\n return v1;\n}\n\n/**\nConvert from HSL space into RGB space.\n*/\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n if (HSL.y == 0.0)\n {\n // Gray\n RGB.r = HSL.z;\n RGB.g = HSL.z;\n RGB.b = HSL.z;\n }\n else\n {\n // Chromatic\n float v2;\n if (HSL.z < 0.5)\n v2 = HSL.z * (1.0 + HSL.y);\n else\n v2 = (HSL.z + HSL.y) - (HSL.y * HSL.z);\n\n float v1 = 2.0 * HSL.z - v2;\n\n RGB.r = Util(v1, v2, HSL.x + (1.0 / 3.0));\n RGB.g = Util(v1, v2, HSL.x);\n RGB.b = Util(v1, v2, HSL.x - (1.0 / 3.0));\n }\n\n return RGB.rgb;\n}\n\nvoid main()\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n\n // depth is used to determine which fragment belong to us\n // and we can change\n float depth = texture2D(texVectors, tcoordVC.st).a;\n\n vec3 fragColorRGB;\n float valid;\n if (depth > 1.0e-3)\n {\n // we own it\n // shade LIC'ed geometry, or apply mask\n if (lic.g!=0.0)\n {\n // it's masked\n // apply fragment mask\n fragColorRGB = uMaskIntensity * uMaskColor + (1.0 - uMaskIntensity) * geomColor.rgb;\n valid = 0.0;\n }\n else\n {\n if (uScalarColorMode==0)\n {\n // blend with scalars\n fragColorRGB = lic.rrr * uLICIntensity + geomColor.rgb * (1.0 - uLICIntensity);\n }\n else\n {\n // multiply with scalars\n fragColorRGB = geomColor.rgb * clamp((uMapBias + lic.r), 0.0, 1.0);\n }\n if (lic.b != 0.0)\n {\n // didn't have the required guard pixels\n // don't consider it in min max estimation\n // for histpgram stretching\n valid = 0.0;\n }\n else\n {\n // ok to use in min/max estimates for histogram\n // stretching\n valid = 1.0;\n }\n }\n }\n else\n {\n // we don't own it\n // pass through scalars\n fragColorRGB = geomColor.rgb;\n valid = 0.0;\n }\n\n // if no further stages this texture is\n // copied to the screen\n RGBOutput = vec4(fragColorRGB, geomColor.a);\n\n // if further stages, move to hsl space for contrast\n // enhancement. encoding validity saves moving a texture to the cpu\n vec3 fragColorHSL = RGBToHSL(fragColorRGB);\n HSLOutput = vec4(fragColorHSL, valid);\n}\n"),t.licCopyPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_DCpy.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader copies fragments and depths to the output buffer\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texDepth; // z values from vertex shader\nuniform sampler2D texRGBColors; // final rgb LIC colors\n\nin vec2 tcoordVC;\n\nvoid main()\n{\n gl_FragDepth = texture2D(texDepth, tcoordVC).x;\n gl_FragData[0] = texture2D(texRGBColors, tcoordVC);\n\n // since we render a screen aligned quad\n // we're going to be writing fragments\n // not touched by the original geometry\n // it's critical not to modify those\n // fragments.\n if (gl_FragDepth == 1.0)\n {\n discard;\n }\n}\n"),t.enhanceContrastPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// color contrast enhance stage implemented via histogram stretching\n// on lightness channel. if the min and max are tweaked it can generate\n// out-of-range values these will be clamped in 0 to 1\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texGeomColors; // scalars + lighting\nuniform sampler2D texLIC; // image lic, mask\nuniform sampler2D texHSLColors; // hsla colors\n\nuniform float uLMin; // min lightness over all fragments\nuniform float uLMaxMinDiff; // max - min lightness over all fragments\n\nin vec2 tcoordVC;\n\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n float v;\n float h = HSL.x;\n float sl = HSL.y;\n float l = HSL.z;\n\n v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);\n if (v <= 0.0) {\n RGB = vec3(0.0,0.0,0.0);\n } else {\n float m;\n int sextant;\n float fract, vsf, mid1, mid2;\n\n m = l + l - v;\n h *= 6.0;\n sextant = int(h);\n fract = h - float(sextant);\n\n vsf = (v - m) * fract;\n mid1 = m + vsf;\n mid2 = v - vsf;\n switch (sextant) {\n case 0: RGB.r = v; RGB.g = mid1; RGB.b = m; break;\n case 1: RGB.r = mid2; RGB.g = v; RGB.b = m; break;\n case 2: RGB.r = m; RGB.g = v; RGB.b = mid1; break;\n case 3: RGB.r = m; RGB.g = mid2; RGB.b = v; break;\n case 4: RGB.r = mid1; RGB.g = m; RGB.b = v; break;\n case 5: RGB.r = v; RGB.g = m; RGB.b = mid2; break;\n }\n }\n return RGB;\n}\n\nvoid main()\n{\n // lookup hsl color , mask\n vec4 fragColor = texture2D(texHSLColors, tcoordVC.st);\n\n // don't modify masked fragments (masked => lic.g==1)\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g==0.0)\n {\n // normalize lightness channel\n fragColor.z = clamp((fragColor.z - uLMin)/uLMaxMinDiff, 0.0, 1.0);\n }\n\n // back into rgb space\n fragColor.rgb = HSLToRGB(fragColor.xyz);\n\n // add alpha\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n fragColor.a = geomColor.a;\n\n gl_FragData[0] = fragColor;\n}\n"),t.shadersNeedBuilding=!1)},e.initializeResources=()=>{e.createFBO(),e.generateNoiseTexture(t.licInterface.getNoiseTextureSize()),e.allocateTextures(),e.buildAllShaders(),t.licQuad||(t.licQuad=function(e){const t=Md.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Us.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Us.newInstance({numberOfComponents:1,values:o}),s=Us.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",Sm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow)),t.licHelper||(t.licHelper=ym.newInstance())},e.prepareForGeometry=()=>{const e=t.framebuffer;e.saveCurrentBindingsAndBuffers(),e.bind(),t.geometryImage.activate(),t.vectorImage.activate(),t.maskVectorImage.activate(),e.removeColorBuffer(0),e.removeColorBuffer(2),e.removeColorBuffer(3),e.setColorBuffer(t.geometryImage,0),e.setColorBuffer(t.vectorImage,2),e.setColorBuffer(t.maskVectorImage,3),e.setDepthBuffer(t.depthTexture);const n=t.context;n.drawBuffers([n.COLOR_ATTACHMENT0,n.NONE,n.COLOR_ATTACHMENT2,n.COLOR_ATTACHMENT3]),n.viewport(0,0,...t.size),n.scissor(0,0,...t.size),n.disable(n.BLEND),n.disable(n.DEPTH_TEST),n.disable(n.SCISSOR_TEST),n.clearColor(0,0,0,0),n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT)},e.copyToScreen=n=>{t.RGBColorImage.activate(),t.depthTexture.activate(),t.licCopyPass||e.initializeResources();const r=t.licCopyPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(r);const o=t.context;o.viewport(0,0,...n),o.scissor(0,0,...n),o.disable(o.BLEND),o.enable(o.DEPTH_TEST),o.disable(o.SCISSOR_TEST),r.setUniformi("texDepth",t.depthTexture.getTextureUnit()),r.setUniformi("texRGBColors",t.RGBColorImage.getTextureUnit()),e.renderQuad(n,r),t.RGBColorImage.deactivate(),t.depthTexture.deactivate()},e.combineColorsAndLIC=()=>{const n=t.context,r=t.framebuffer;r.saveCurrentBindingsAndBuffers(),r.bind(),r.create(...t.size),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(t.RGBColorImage,0),r.setColorBuffer(t.HSLColorImage,1),n.drawBuffers([n.COLOR_ATTACHMENT0,n.COLOR_ATTACHMENT1]),n.disable(n.DEPTH_TEST),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),t.vectorImage.activate(),t.geometryImage.activate(),t.LICImage.activate(),t.licColorPass||e.initializeResources();const o=t.licColorPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(o),o.setUniformi("texVectors",t.vectorImage.getTextureUnit()),o.setUniformi("texGeomColors",t.geometryImage.getTextureUnit());const{colorMode:a,LICIntensity:i,mapModeBias:s,maskIntensity:l,maskColor:c,enhanceContrast:u,lowColorContrastEnhancementFactor:d,highColorContrastEnhancementFactor:p}=t.licInterface.get("colorMode","LICIntensity","mapModeBias","maskIntensity","maskColor","enhanceContrast","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor");if(o.setUniformi("texLIC",t.LICImage.getTextureUnit()),o.setUniformi("uScalarColorMode",a),o.setUniformf("uLICIntensity",i),o.setUniformf("uMapBias",s),o.setUniformf("uMaskIntensity",l),o.setUniform3f("uMaskColor",...c),e.renderQuad(t.size,o),t.vectorImage.deactivate(),t.geometryImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE]),u===pm||u===fm){let o=0,a=1,i=a-o;o+=i*d,a-=i*p,i=a-o,r.setColorBuffer(t.RGBColorImage),n.drawBuffers([n.COLOR_ATTACHMENT0]),t.geometryImage.activate(),t.HSLColorImage.activate(),t.LICImage.activate(),t.enhanceContrastPass||e.initializeResources();const{enhanceContrastPass:s}=t;t._openGLRenderWindow.getShaderCache().readyShaderProgram(s),s.setUniformi("texGeomColors",t.geometryImage.getTextureUnit()),s.setUniformi("texHSLColors",t.HSLColorImage.getTextureUnit()),s.setUniformi("texLIC",t.LICImage.getTextureUnit()),s.setUniformf("uLMin",o),s.setUniformf("uLMaxMinDiff",i),e.renderQuad(t.size,s),t.geometryImage.deactivate(),t.HSLColorImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),n.drawBuffers([n.NONE])}r.restorePreviousBindingsAndBuffers()},e.applyLIC=()=>{const e=t.licInterface.get("stepSize","numberOfSteps","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","normalizeVectors","maskThreshold","transformVectors"),n=t.licHelper.executeLIC(t.size,t.vectorImage,t.maskVectorImage,t.noiseTexture,t._openGLRenderWindow,e);if(!n)return console.error("Failed to compute image LIC"),void(t.LICImage=null);t.LICImage=n},e.setSize=n=>{Array.isArray(n)&&2===n.length&&(t.size&&t.size[0]===n[0]&&t.size[1]===n[1]||(t.size=n,e.releaseGraphicsResources()))},e.releaseGraphicsResources=()=>{t.geometryImage&&(t.geometryImage.releaseGraphicsResources(),t.geometryImage=null),t.vectorImage&&(t.vectorImage.releaseGraphicsResources(),t.vectorImage=null),t.maskVectorImage&&(t.maskVectorImage.releaseGraphicsResources(),t.maskVectorImage=null),t.LICImage&&(t.LICImage.releaseGraphicsResources(),t.LICImage=null),t.RGBColorImage&&(t.RGBColorImage.releaseGraphicsResources(),t.RGBColorImage=null),t.HSLColorImage&&(t.HSLColorImage.releaseGraphicsResources(),t.HSLColorImage=null),t.depthTexture&&(t.depthTexture.releaseGraphicsResources(),t.depthTexture=null),t.framebuffer&&(t.framebuffer.releaseGraphicsResources(),t.framebuffer=null)}}const Pm={context:null,shadersNeedBuilding:!0,reallocateTextures:!0,size:null,licInterface:null};function Im(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pm,n),Cm.extend(e,t,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","reallocateTextures","licInterface","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),Am(e,t)}var wm={newInstance:jt.newInstance(Im,"vtkSurfaceLICInterface"),extend:Im};const{vtkErrorMacro:Om}=Kt;function Mm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICMapper");const n={...e};e.getNeedToRebuildShaders=(e,r,o)=>t.rebuildLICShaders||n.getNeedToRebuildShaders(e,r,o),e.replaceShaderValues=(e,r,o)=>{const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=e.Vertex,s=e.Fragment;const l=t.renderable.getInputArrayToProcess(0);if(l&&t.canDrawLIC){s=xd.substitute(s,"//VTK::Output::Dec",["//VTK::Output::Dec","layout(location = 2) out vec4 vectorTexture;","layout(location = 3) out vec4 maskVectorTexture;"]).result;const n=`${l.getName()}MC`;0===a&&t.lastBoundBO.set({lastLightComplexity:1},!0),i=xd.substitute(i,"//VTK::TCoord::Dec",[`attribute vec3 ${n};`,"out vec3 licOutput;","//VTK::TCoord::Dec"]).result,i=xd.substitute(i,"//VTK::TCoord::Impl",[`licOutput = ${n};`,"//VTK::TCoord::Impl"]).result,s=xd.substitute(s,"//VTK::TCoord::Dec",["uniform int uMaskOnSurface;","uniform mat3 normalMatrix;","in vec3 licOutput;","//VTK::TCoord::Dec"]).result,s=xd.substitute(s,"//VTK::TCoord::Impl",["// projected vectors"," vec3 tcoordLIC = normalMatrix * licOutput;"," vec3 normN = normalize(normalVCVSOutput);"," float k = dot(tcoordLIC, normN);"," vec3 projected = (tcoordLIC - k*normN);"," vectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);","// vectors for fragment masking"," if (uMaskOnSurface == 0)"," {"," maskVectorTexture = vec4(licOutput, 1.0);"," }"," else"," {"," maskVectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);"," }","//VTK::TCoord::Impl"],!1).result,e.Vertex=i}t.rebuildLICShaders=!1,e.Fragment=s,n.replaceShaderValues(e,r,o),a>0&&t.lastBoundBO.set({lastLightComplexity:a},!0)},e.setMapperShaderParameters=(e,r,o)=>{n.setMapperShaderParameters(e,r,o),t.canDrawLIC&&e.getProgram().setUniformi("uMaskOnSurface",t.maskOnSurface)},e.getNeedToRebuildBufferObjects=(e,r)=>t.rebuildLICBuffers||n.getNeedToRebuildBufferObjects(e,r),e.buildBufferObjects=(e,r)=>{if(t.canDrawLIC){const e=t.renderable.getInputArrayToProcess(0);e&&e.getNumberOfComponents()>1&&t.renderable.setCustomShaderAttributes([e.getName()])}t.rebuildLICBuffers=!1,n.buildBufferObjects(e,r)},e.pushState=e=>{t.stateCache={[e.BLEND]:e.isEnabled(e.BLEND),[e.DEPTH_TEST]:e.isEnabled(e.DEPTH_TEST),[e.SCISSOR_TEST]:e.isEnabled(e.SCISSOR_TEST),[e.CULL_FACE]:e.isEnabled(e.CULL_FACE)}},e.popState=e=>{const n=n=>t.stateCache[n]?e.enable(n):e.disable(n);n(e.BLEND),n(e.DEPTH_TEST),n(e.SCISSOR_TEST),n(e.CULL_FACE)},e.renderPiece=(r,o)=>{let a=!0;t._openGLRenderWindow.getWebgl2()||(Om("SurfaceLICMapper Requires WebGL 2"),a=!1),t.context.getExtension("EXT_color_buffer_float")&&t.context.getExtension("OES_texture_float_linear")||(Om("SurfaceLICMapper requires the EXT_color_buffer_float and OES_texture_float_linear WebGL2 extensions."),a=!1),t.currentInput=t.renderable.getInputData(),t.currentInput||(Om("No input"),a=!1);let i=t.renderable.getLicInterface();i||(i=Cm.newInstance(),t.renderable.setLicInterface(i)),t.openGLLicInterface||(t.openGLLicInterface=wm.newInstance()),i!==t.openGLLicInterface.getLicInterface()&&t.openGLLicInterface.setLicInterface(i);const s=t.renderable.getInputArrayToProcess(0);if(i.getEnableLIC()&&(!s||s.getNumberOfComponents()<2)&&(Om("No vector input array"),a=!1),i.getEnableLIC()||(a=!1),t.canDrawLIC!==a&&(t.rebuildLICShaders=!0,t.rebuildLICBuffers=!0),t.canDrawLIC=a,!a||!i.getEnableLIC())return void n.renderPiece(r,o);const l=t.context,c=o.getProperty().getBackfaceCulling(),u=o.getProperty().getFrontfaceCulling();c||u?u?(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.FRONT)):(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.BACK)):t._openGLRenderWindow.disableCullFace();const d=t._openGLRenderWindow.getSize(),p=d.map((e=>Math.round(e*i.getViewPortScale())));t.openGLLicInterface.setSize(p),t.openGLLicInterface.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLLicInterface.setContext(t.context),e.pushState(t.context),t.openGLLicInterface.initializeResources(),t.openGLLicInterface.prepareForGeometry(),e.popState(t.context),n.renderPieceStart(r,o),n.renderPieceDraw(r,o),n.renderPieceFinish(r,o),e.pushState(t.context),t.VBOBuildTime.modified(),t.openGLLicInterface.completedGeometry(),t.context.disable(t.context.CULL_FACE),t.openGLLicInterface.applyLIC(),t.openGLLicInterface.combineColorsAndLIC(),t.openGLLicInterface.copyToScreen(d),e.popState(t.context)}}const Rm={canDrawLIC:!1,rebuildLICShaders:!1,rebuildLICBuffers:!1,openGLLicInterface:null};const Vm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),fp.extend(e,t,n),Mm(e,t),At(e,t,["openGLLicInterface"])}),"vtkOpenGLSurfaceLICMapper");rn("vtkSurfaceLICMapper",Vm);const{vtkErrorMacro:Em}=Kt;function Dm(e,t){t.classHierarchy.push("vtkOpenGLSphereMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,i=xd.substitute(i,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=xd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=xd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{if(e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)||Em("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),e.getProgram().isUniformUsed("scaleFactor")){const n=t.currentInput.getPointData();null!=t.renderable.getScaleArray()&&n.hasArray(t.renderable.getScaleArray())?e.getProgram().setUniformf("scaleFactor",t.renderable.getScaleFactor()):e.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),o.isUniformUsed("MCVCMatrix"))if(r.getIsIdentity())o.setUniformMatrix("MCVCMatrix",i.wcvc);else{const e=t.openGLActor.getKeyMatrices(),n=new Float64Array(16);b(n,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",n)}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(u=i.getArray(t.renderable.getScaleArray()).getData());let d=null,p=0,f=null;o?(p=o.getNumberOfComponents(),a.setColorOffset(0),a.setColorBOStride(4),d=o.getData(),f=new Uint8Array(3*l*4),a.getColorBO()||a.setColorBO(ad.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow)):a.getColorBO()&&a.setColorBO(null),a.setColorComponents(p);const g=new Float32Array(5*l*3);a.setStride(20);const m=Math.cos(Eo(30));let h=0,v=0,y=0,b=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lm,n),fp.extend(e,t,n),Dm(e,t)}),"vtkOpenGLSphereMapper");rn("vtkSphereMapper",Bm);const{vtkErrorMacro:Nm}=Kt;function km(e,t){t.classHierarchy.push("vtkOpenGLStickMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkStickMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Sticks\n\nattribute vec4 vertexMC;\nattribute vec3 orientMC;\nattribute vec4 offsetMC;\nattribute float radiusMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying float lengthVCVSOutput;\nvarying vec3 centerVCVSOutput;\nvarying vec3 orientVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = radiusMC;\n lengthVCVSOutput = length(orientMC);\n orientVCVSOutput = normalMatrix * normalize(orientMC);\n\n // make sure it is pointing out of the screen\n if (orientVCVSOutput.z < 0.0)\n {\n orientVCVSOutput = -orientVCVSOutput;\n }\n\n // make the basis\n vec3 xbase;\n vec3 ybase;\n vec3 dir = vec3(0.0,0.0,1.0);\n if (cameraParallel == 0)\n {\n dir = normalize(-vertexVCVSOutput.xyz);\n }\n if (abs(dot(dir,orientVCVSOutput)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));\n ybase = cross(xbase,orientVCVSOutput);\n }\n else\n {\n xbase = normalize(cross(orientVCVSOutput,dir));\n ybase = cross(orientVCVSOutput,xbase);\n }\n\n vec3 offsets = offsetMC.xyz*2.0-1.0;\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +\n radiusVCVSOutput*offsets.x*xbase +\n radiusVCVSOutput*offsets.y*ybase +\n 0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,i=xd.substitute(i,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,i=xd.substitute(i,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=xd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=xd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)||Nm("Error setting 'orientMC' in shader VAO.")),e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)||Nm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isAttributeUsed("radiusMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)||Nm("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),r.getIsIdentity())o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",i.wcvc),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",i.normalMatrix);else{const e=t.openGLActor.getKeyMatrices();if(o.isUniformUsed("MCVCMatrix")){const t=new Float64Array(16);b(t,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",t)}if(o.isUniformUsed("normalMatrix")){const t=new Float64Array(9);ve(t,i.normalMatrix,e.normalMatrix),o.setUniformMatrix3x3("normalMatrix",t)}}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=3;u+=4;let d=null,p=0;a.setColorBOStride(4),a.getColorBO()||a.setColorBO(ad.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow),o&&(p=o.getNumberOfComponents(),a.setColorOffset(4),d=o.getData(),a.setColorBOStride(8)),a.setColorComponents(p),a.setStride(28);const f=new Float32Array(7*l*12),g=new Uint8Array(12*l*(d?8:4));let m=null,h=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(m=i.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&i.hasArray(t.renderable.getOrientationArray())?h=i.getArray(t.renderable.getOrientationArray()).getData():Nm(["Error setting orientationArray.\n","You have to specify the stick orientation"]);const v=[0,1,3,0,3,2,2,3,5,2,5,4];let y=0,b=0,x=0,T=0;for(let e=0;e=4?255:0,g[T++]=v[t]>=2?255:0,g[T++]=255,b=e*p,d&&(g[T++]=d[b],g[T++]=d[b+1],g[T++]=d[b+2],g[T++]=d[b+3])}a.setElementCount(x/7),a.upload(f,Ju.ARRAY_BUFFER),a.getColorBO().upload(g,Ju.ARRAY_BUFFER),t.VBOBuildTime.modified()}}const Fm={};const _m=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fm,n),fp.extend(e,t,n),km(e,t)}),"vtkOpenGLStickMapper");rn("vtkStickMapper",_m);const Gm=Object.create(null);function Um(e,t){Gm[e]=t}function Wm(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const zm={};function Hm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zm,n),t.overrides=Gm,tn.extend(e,t,n),Wm(0,t)}var jm={newInstance:jt.newInstance(Hm,"vtkWebGPUViewNodeFactory"),extend:Hm};function Km(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(g(e),t.renderable.getParallelProjection()){const a=t.renderable.getParallelScale(),i=a*n,s=a,l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(c-l),f=1/(d-u);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(c+l)*p,e[13]=(d+u)*f,e[14]=r[1]/(r[1]-r[0])}else{const a=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let i,s;!0===t.renderable.getUseHorizontalViewAngle()?(i=r[0]*a,s=r[0]*a/n):(i=r[0]*a*n,s=r[0]*a);const l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(c-l),e[5]=2*r[0]/(d-u),e[12]=(l+c)/(c-l),e[13]=(u+d)/(d-u),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();d(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();x(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const a=n.getAspectRatio(),i=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,a,i,t.renderable.getWindowCenterByReference()),b(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),h(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const $m={keyMatrixTime:null,keyMatrices:null};const qm=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$m,n),Zt.extend(e,t,n),t.keyMatrixTime={},jt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},jt.setGet(e,t,["keyMatrixTime"]),Km(e,t)}));function Xm(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ym,n),jt.obj(e,t),t.bindables=[],t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),jt.setGet(e,t,["label","device","arrayInformation"]),Xm(e,t)}var Qm={newInstance:jt.newInstance(Zm),extend:Zm};function Jm(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const eh={device:null,handle:null};function th(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eh,n),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["device","handle"]),Jm(e,t)}var nh={newInstance:jt.newInstance(th,"vtkWebGPUShaderModule"),extend:th};function rh(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oh,n),t._shaderModules=new Map,jt.obj(e,t),jt.setGet(e,t,["device","window"]),rh(e,t)}var ih={newInstance:jt.newInstance(ah,"vtkWebGPUShaderCache"),extend:ah,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let a=!1;-1!==e.search(t)&&(a=!0);let i="";r&&(i="g");const s=new RegExp(t,i),l=e.replace(s,o);return{replace:a,result:l}}};function sh(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const lh={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lh,n),yt(e,t),t.layouts=[],t.shaderDescriptions=[],xt(e,t,["handle","pipelineDescription"]),At(e,t,["device","renderEncoder","topology","vertexState"]),sh(e,t)}var uh={newInstance:Et(ch,"vtkWebGPUPipeline"),extend:ch};function dh(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=ih.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=ih.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const ph={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function fh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ph,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],jt.obj(e,t),jt.setGet(e,t,["type","hash","code"]),jt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),dh(e,t)}var gh={newInstance:jt.newInstance(fh,"vtkWebGPUShaderDescription"),extend:fh};const mh={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var hh=function(e){return!e||e.length<6?0:e in mh==1?mh[e]:(et(`unknown format ${e}`),null)},vh=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(et(`unknown format ${e}`),0):t*(5-r/2)},yh=function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},bh=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void et(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;et(`unknown format ${e}`)},xh=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void et(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},Th=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Ch=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void et(`unknown format ${e}`)};function Sh(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${i}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Ph={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ph,n),yt(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],At(e,t,["created","device","handle","indexBuffer"]),Ah(e,t)}var wh={newInstance:Et(Ih,"vtkWebGPUVertexInput"),extend:Ih};const Oh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",Mh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function Rh(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const a=gh.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),i=gh.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(a),s.push(i);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,c=new RegExp("//VTK::[^:]*::","g"),u=l.match(c).filter(((e,t,n)=>n.indexOf(e)===t)),d=u.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=ih.substitute(i,"//VTK::Renderer::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");i=s.getCode(),i=ih.substitute(i,"//VTK::Renderer::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=ih.substitute(i,"//VTK::Mapper::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),i=s.getCode(),i=ih.substitute(i,"//VTK::Mapper::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=uh.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const Vh={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Eh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vh,n),Zt.extend(e,t,n),t.textureViews=[],t.vertexInput=wh.newInstance(),t.bindGroup=Qm.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||Mh,t.vertexShaderTemplate=t.vertexShaderTemplate||Oh,t.shaderReplacements=new Map,jt.get(e,t,["pipeline","vertexInput"]),jt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),Rh(e,t)}var Dh={newInstance:jt.newInstance(Eh,"vtkWebGPUSimpleMapper"),extend:Eh};function Lh(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const Bh={};function Nh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh,n),Dh.extend(e,t,n),Lh(e,t)}var kh={newInstance:jt.newInstance(Nh,"vtkWebGPUFullScreenQuad"),extend:Nh},Fh={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const _h=["getMappedRange","mapAsync","unmap"];function Gh(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,a=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=a.getMappedRange(0,o);new Uint8Array(i).set(new Uint8Array(r)),a.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(a,0,t,0,o);const l=s.finish();e.queue.submit([l]),a.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n<_h.length;n++)e[_h[n]]=function(){return t.handle[_h[n]](...arguments)}}const Uh={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function Wh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uh,n),jt.obj(e,t),jt.get(e,t,["handle","sizeInBytes","usage"]),jt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),Gh(e,t)}var zh={newInstance:jt.newInstance(Wh),extend:Wh,...Fh};const{Representation:Hh}=xs,{PrimitiveTypes:jh}=Fh;class Kh{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let a=0;a2){for(let a=0;a{const n=e.cells,r=e.primitiveType,o=e.representation,a=e.cellOffset,i=n.getData(),s=i.length,l=function(e){switch(e){case jh.Points:return"points";case jh.Lines:return"lines";case jh.Triangles:case jh.TriangleEdges:return"polys";case jh.TriangleStripEdges:case jh.TriangleStrips:return"strips";default:return""}}(r),c=e.numberOfPoints,u={provokedPointIds:new Uint8Array(c),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Kh};let d=null;d=o===Hh.POINTS||r===jh.Points?ev.anythingToPoints:o===Hh.WIREFRAME||r===jh.Lines?ev[`${l}ToWireframe`]:ev[`${l}ToSurface`],Yh=Xh;let p=a||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),zh.extend(e,t,n),jt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),tv(e,t)}var ov={newInstance:jt.newInstance(rv),extend:rv,...Fh};const{BufferUsage:av}=Fh,{vtkErrorMacro:iv}=Kt,{VtkDataTypes:sv}=Us;function lv(e,t,n,r,o){const a={},i=e.getFlatSize();if(!i)return a;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const c=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let u,d=0;const p=at(r,i*(n+(c?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?u=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||c?3===n&&c?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case sv.UNSIGNED_CHAR:t="uint8";break;case sv.FLOAT:t="float32";break;case sv.UNSIGNED_INT:t="uint32";break;case sv.INT:t="sint32";break;case sv.DOUBLE:t="float32";break;case sv.UNSIGNED_SHORT:t="uint16";break;case sv.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||iv(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:av.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=zh.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const dv={device:null,fullScreenQuadBuffer:null};function pv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dv,n),yt(e,t),At(e,t,["device"]),uv(e,t)}var fv={newInstance:Et(pv),extend:pv,...Fh};const{BufferUsage:gv}=fv,{vtkErrorMacro:mv}=jt;function hv(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void mv(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=Th(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Ch(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:gv.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void mv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType];s[(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void mv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType],l=(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const vv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function yv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},jt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},jt.get(e,t,["bindGroupTime"]),jt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),hv(e,t)}var bv={newInstance:jt.newInstance(yv,"vtkWebGPUStorageBuffer"),extend:yv};const{BufferUsage:xv}=fv,{vtkErrorMacro:Tv}=jt;function Cv(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?Tv(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:Th(n),offset:-1,nativeType:Ch(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:xv.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void Tv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];a.lastValue!==r&&(i[a.offset/i.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),a.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void Tv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const Sv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function Av(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},jt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,jt.get(e,t,["binding","bindGroupTime"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),Cv(e,t)}var Pv={newInstance:jt.newInstance(Av,"vtkWebGPUUniformBuffer"),extend:Av};const{vtkDebugMacro:Iv}=Kt,wv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",Ov=new Float64Array(16),Mv=new Float64Array(16);function Rv(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];On(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),In(r,n,o),_n(o,r,t.stabilizedCenter),Un(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(Iv("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(Eo(n[t].getConeAngle())),s[l+2]=Math.cos(Eo(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",i),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var a;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=kh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(wv);const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=kh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(wv);const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),m(Mv,r.normalMatrix),oe(Ov,r.scvc,r.pcsc),oe(Ov,Mv,Ov),t.clearFSQ.getUBO().setArray("FSQMatrix",Ov),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const Vv={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const Ev=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vv,n),Zt.extend(e,t,n),t.UBO=Pv.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=bv.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=Qm.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=g(new Float64Array(16)),t.stabilizedTime={},yt(t.stabilizedTime,{mtime:0}),xt(e,t,["bindGroup","stabilizedTime"]),Pt(e,t,["stabilizedCenter"]),At(e,t,["renderEncoder","selector","suppressClear","UBO"]),Rv(e,t)}),"vtkWebGPURenderer");Um("vtkRenderer",Ev);const{CoordinateSystem:Dv}=is;function Lv(e,t){t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix();t.bufferShift[0]=n[3],t.bufferShift[1]=n[7],t.bufferShift[2]=n[11];const r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Dv.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Dv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Bv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Nv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Lv(e,t)}));Um("vtkActor",Nv);const{CoordinateSystem:kv}=is;function Fv(e,t){t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;const n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===kv.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),g(t.keyMatrices.bcwc),g(t.keyMatrices.normalMatrix),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===kv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const _v={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Gv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_v,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Fv(e,t)}));function Uv(e,t){t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Um("vtkActor2D",Gv);const Wv={};const zv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wv,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Xu.newCubeAxesActorHelper(),Uv(e,t)}),"vtkWebGPUCubeAxesActor");Um("vtkCubeAxesActor",zv);const{DisplayLocation:Hv}=Cp;function jv(e,t){t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(Hv.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(Hv.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(ps.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(ps.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(ps.POINTS),e.getRepresentationAsString=()=>jt.enumToString(ps,t.representation)}const Kv={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:ps.SURFACE,displayLocation:Hv.FOREGROUND};function $v(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kv,n),jt.obj(e,t),jt.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation"]),jt.setGetArray(e,t,["color"],3),jv(e,t)}var qv={newInstance:jt.newInstance($v,"vtkProperty2D"),extend:$v,...Cp};const{BufferUsage:Xv,PrimitiveTypes:Yv}=fv,{Representation:Zv}=xs,{ScalarMode:Qv}=fc,{CoordinateSystem:Jv}=is,{DisplayLocation:ey}=qv,ty="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ny='\nstruct PBRData {\n diffuse: vec3,\n specular: vec3,\n}\n\n// Dot product with the max already in it\nfn mdot(a: vec3, b: vec3) -> f32 {\n return max(0.0, dot(a, b));\n}\n// Dot product with a max in it that does not allow for negative values\n// Physically based rendering is accurate as long as normals are accurate,\n// however this is pretty often not the case. In order to prevent negative\n// values from ruining light calculations and creating zones of zero light,\n// this remapping is used, which smoothly clamps the dot product between\n// zero and one while still maintaining a good amount of accuracy.\nfn cdot(a: vec3, b: vec3) -> f32 {\n var d: f32 = max(0.0, dot(a, b));\n d = pow((d + 1) / 2.0, 2.6);\n return d;\n}\n\n// Lambertian diffuse model\nfn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 {\n var pi: f32 = 3.14159265359; \n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5);\n return (base/pi)*NdotL;\n}\n\n// Yasuhiro Fujii improvement on the Oren-Nayar model\n// https://mimosa-pudica.net/improved-oren-nayar.html\n// p is surface color, o is roughness\nfn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 {\n var invpi: f32 = 0.31830988618; // 1/pi\n\n var o2 = o*o;\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better\n\n var NdotV: f32 = mdot(N, V);\n var LdotV: f32 = mdot(L, V);\n\n var s: f32 = LdotV - NdotL*NdotV;\n var t: f32 = mix(1, max(NdotL, NdotV), step(0, s)); // Mix with step is the equivalent of an if statement\n var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13));\n A = invpi*(1 - A);\n var B: f32 = 0.45*(o2 / (o2 + 0.09));\n B = invpi*B;\n\n return p*NdotL*(A + B*(s/t));\n}\n\n// Fresnel portion of BRDF (IOR only, simplified)\nfn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 {\n var NdotV: f32 = mdot(V, N);\n var F0: f32 = (pow((ior - 1.0), 2) + k*k) / (pow((ior + 1.0), 2) + k*k); // This takes into account the roughness, which the other one does not\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Fresnel portion of BRDF (Color ior, better)\nfn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 {\n var NdotV: f32 = mdot(V, N);\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Normal portion of BRDF\n// https://learnopengl.com/PBR/Theory\n// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2\nfn trGGX(N: vec3, H: vec3, a: f32) -> f32 {\n var pi: f32 = 3.14159265359; \n\n var a2: f32 = a*a;\n var NdotH = mdot(N, H);\n var NdotH2 = NdotH*NdotH;\n \n var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0;\n\n return a2 / max((pi*denom*denom), 0.000001);\n}\n\n// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent\nfn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 {\n var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz;\n\n var ggx1: f32 = trGGX(N + Op*s, H, a);\n var ggx2: f32 = trGGX(N - Op*s, H, a);\n return (0.5 * ggx1 + 0.5 * ggx2);\n}\n\n// Geometry portion of BRDF\nfn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 {\n var NdotX = cdot(N, X);\n return NdotX / max(0.000001, (NdotX*(1-k) + k));\n}\n\nfn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 {\n var ggx1: f32 = min(1, schlickGGX(N, V, k));\n var ggx2: f32 = min(1, schlickGGX(N, L, k));\n return ggx1*ggx2;\n}\n\n// BRDF Combination\nfn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 {\n var num: f32 = D*F*G;\n var denom: f32 = 4*cdot(V, N)*cdot(L, N);\n\n return num / max(denom, 0.000001);\n}\n\n// Different lighting calculations for different light sources\nfn calcDirectionalLight(N: vec3, V: vec3, ior: f32, roughness: f32, metallic: f32, direction: vec3, color: vec3, base: vec3) -> PBRData { \n var L: vec3 = normalize(direction); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); // Fresnel term is replaced with 1 because it is added later\n var incoming: vec3 = color;\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5);\n\n var specular: vec3 = brdf*incoming*angle;\n // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate\n // control property for the diffuse vs specular roughness\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V); \n // Stores the specular and diffuse separately to allow for finer post processing\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// TODO: find some way to reduce the number of arguments going in here\nfn calcPointLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n var incoming: vec3 = color * (1. / (dist*dist));\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights\nfn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, direction: vec3, cones: vec2, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos);\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n \n // Cones.x is the inner phi and cones.y is the outer phi\n var theta: f32 = mdot(normalize(direction), L);\n var epsilon: f32 = cones.x - cones.y;\n var intensity: f32 = (theta - cones.y) / epsilon;\n intensity = clamp(intensity, 0.0, 1.0);\n intensity /= dist*dist;\n\n var incoming: vec3 = color * intensity;\n\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// Environment mapping stuff\n// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::TCoord::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n // Temporary ambient, diffuse, and opacity\n var ambientColor: vec4 = mapperUBO.AmbientColor;\n var diffuseColor: vec4 = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n\n // This should be declared somewhere else\n var _diffuseMap: vec4 = vec4(1);\n var _roughnessMap: vec4 = vec4(1);\n var _metallicMap: vec4 = vec4(1);\n var _normalMap: vec4 = vec4(0, 0, 1, 0); // normal map was setting off the normal vector detection in fragment\n var _ambientOcclusionMap: vec4 = vec4(1);\n var _emissionMap: vec4 = vec4(0);\n\n //VTK::Color::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Normal::Impl\n\n var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0);\n\n //VTK::Light::Impl\n\n //VTK::Select::Impl\n\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n\n return output;\n}\n';function ry(e){return e.indexOf("edge")>=0}function oy(e,t){t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=n=>{n&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==Jv.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.translucentPass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.opaquePass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.updateUBO=()=>{const n=t.WebGPUActor.getRenderable().getProperty(),r=t.UBO.getSendTime();if(e.getMTime()>r||n.getMTime()>r||t.renderable.getMTime()>r){const e=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",e.bcwc),t.UBO.setArray("BCSCMatrix",e.bcsc),t.UBO.setArray("MCWCNormals",e.normalMatrix),t.is2D){t.UBO.setValue("ZValue",t.WebGPUActor.getRenderable().getProperty().getDisplayLocation()===ey.FOREGROUND?1:0);const e=n.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setValue("SpecularIntensity",0)}else{let e=n.getAmbientColorByReference();t.UBO.setValue("AmbientIntensity",n.getAmbient()),t.UBO.setArray("AmbientColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",n.getDiffuse()),e=n.getDiffuseColorByReference(),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("Roughness",n.getRoughness()),t.UBO.setValue("BaseIOR",n.getBaseIOR()),t.UBO.setValue("Metallic",n.getMetallic()),t.UBO.setValue("NormalStrength",n.getNormalStrength()),t.UBO.setValue("Emission",n.getEmission()),t.UBO.setValue("SpecularIntensity",n.getSpecular()),e=n.getSpecularColorByReference(),t.UBO.setArray("SpecularColor",[e[0],e[1],e[2],1])}const r=n.getEdgeColorByReference?.();r&&t.UBO.setArray("EdgeColor",[r[0],r[1],r[2],1]),t.UBO.setValue("LineWidth",n.getLineWidth()),t.UBO.setValue("Opacity",n.getOpacity()),t.UBO.setValue("PropID",t.WebGPUActor.getPropID());const o=t.WebGPURenderWindow.getDevice();t.UBO.sendIfNeeded(o)}},e.haveWideLines=()=>{const e=t.WebGPUActor.getRenderable(),n=e.getProperty().getRepresentation();return!(e.getProperty().getLineWidth()<=1)&&t.primitiveType!==Yv.Verts&&(t.primitiveType!==Yv.Triangles&&t.primitiveType!==Yv.TriangleStrips||n===Zv.WIREFRAME)},e.replaceShaderPosition=(n,r,o)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position"),a.hasOutput("vertexVC")||a.addOutput("vec4","vertexVC");let i=a.getCode();t.useRendererMatrix?(i=ih.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(i=ih.substitute(i,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(i=ih.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(i=ih.substitute(i,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(a.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),i=ih.substitute(i,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),i=ih.substitute(i,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,a.setCode(i)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,n,r)=>{const o=r.getBuffer("normalMC"),a=t.WebGPUActor.getRenderable();if(o){const e=n.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",o.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",o.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",o.getArrayInformation()[0].interpolation);let t=e.getCode();t=ih.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);const r=n.getShaderDescription("fragment");t=r.getCode(),t=a.getProperty().getNormalTexture()?ih.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, mapperUBO.NormalStrength);"," normal = normalize(normal);"]).result:ih.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,r.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,n,r)=>{if(e.includes("sel"))return;const o=n.getShaderDescription("vertex");o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC");const a=t.WebGPURenderer.getRenderable(),i=n.getShaderDescription("fragment");let s=i.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||ry(e)||t.is2D||e.includes("sel"))s=ih.substitute(s,"//VTK::Light::Impl",[" var diffuse: vec3 = diffuseColor.rgb;"," var specular: vec3 = mapperUBO.SpecularColor.rgb * mapperUBO.SpecularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, mapperUBO.Opacity);"]).result,i.setCode(s);else{const e=[" var pi: f32 = 3.14159265359;"," var fragPos: vec3 = vec3(input.vertexVC.xyz);"," var V: vec3 = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," var baseColor: vec3 = _diffuseMap.rgb * diffuseColor.rgb;"," var roughness: f32 = max(0.000001, mapperUBO.Roughness * _roughnessMap.r);"," var metallic: f32 = mapperUBO.Metallic * _metallicMap.r;"," var alpha: f32 = roughness*roughness;"," var ior: f32 = mapperUBO.BaseIOR;"," var k: f32 = alpha*alpha / 2;"," var diffuse: vec3 = vec3(0.);"," var specular: vec3 = vec3(0.);"," var emission: vec3 = _emissionMap.rgb * mapperUBO.Emission;"," {"," var i: i32 = 0;"," loop {"," if !(i < rendererUBO.LightCount) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var calculated: PBRData = calcPointLight(normal, V, fragPos, ior, roughness, metallic, pos, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Directional light"," case 1 {"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var calculated: PBRData = calcDirectionalLight(normal, V, ior, roughness, metallic, dir, color, baseColor); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Spot Light"," case 2 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var cones: vec2 = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," var calculated: PBRData = calcSpotLight(normal, V, fragPos, ior, roughness, metallic, pos, dir, cones, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," var fresnel: f32 = schlickFresnelIOR(V, normal, ior, k); // Fresnel"," fresnel = min(1, fresnel);"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," var fresnelMetallic: vec3 = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," var kS: vec3 = mix(vec3(fresnel), fresnelMetallic, metallic);"," kS = min(vec3(1), kS);"," var kD: vec3 = (1.0 - kS) * (1.0 - metallic);"," var PBR: vec3 = mapperUBO.DiffuseIntensity*kD*diffuse + kS*specular;"," PBR += emission;"," computedColor = vec4(PBR, mapperUBO.Opacity);"];a.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," var diffuseIBLCoords: vec3 = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," var diffuseCoords: vec2 = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," var VreflN: vec3 = normalize(reflect(-V, normal));"," var reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," var specularCoords: vec2 = vecToRectCoord(reflectionIBLCoords);"," var diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," var level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," var specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," var specularIBLContribution: vec3 = specularIBL.rgb*rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution*kS, 0);"," var diffuseIBLContribution: vec3 = diffuseIBL.rgb*rendererUBO.BackgroundDiffuseStrength;"," diffuseIBLContribution *= baseColor * _ambientOcclusionMap.rgb;"," computedColor += vec4(diffuseIBLContribution*kD, 0);"),s=ih.substitute(s,"//VTK::Light::Impl",e).result,i.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,t,n)=>{if(ry(e)){const e=t.getShaderDescription("fragment");let n=e.getCode();return n=ih.substitute(n,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,void e.setCode(n)}const r=n.getBuffer("colorVI");if(!r)return;const o=t.getShaderDescription("vertex");o.addOutput("vec4","color",r.getArrayInformation()[0].interpolation);let a=o.getCode();a=ih.substitute(a,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,o.setCode(a);const i=t.getShaderDescription("fragment");a=i.getCode(),a=ih.substitute(a,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,i.setCode(a)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,n,r)=>{if(!r.hasAttribute("tcoord"))return;const o=n.getShaderDescription("vertex"),a=r.getBuffer("tcoord"),i=yh(a.getArrayInformation()[0].format);let s=o.getCode();o.addOutput(`vec${i}`,"tcoordVS"),s=ih.substitute(s,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,o.setCode(s);const l=n.getShaderDescription("fragment");s=l.getCode();const c=t.WebGPUActor.getRenderable(),u=e=>!!e&&e.getDimensionality()===i,d=[];(c.getProperty().getDiffuseTexture?.()?.getImageLoaded()||c.getTextures()[0]||t.colorTexture)&&(u(c.getProperty().getDiffuseTexture?.())||u(c.getTextures()[0])||u(t.colorTexture))&&d.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);"),c.getProperty().getRoughnessTexture?.()?.getImageLoaded()&&u(c.getProperty().getRoughnessTexture())&&d.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS);"),c.getProperty().getMetallicTexture?.()?.getImageLoaded()&&u(c.getProperty().getMetallicTexture())&&d.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS);"),c.getProperty().getNormalTexture?.()?.getImageLoaded()&&u(c.getProperty().getNormalTexture())&&d.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),c.getProperty().getAmbientOcclusionTexture?.()?.getImageLoaded()&&u(c.getProperty().getAmbientOcclusionTexture())&&d.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS);"),c.getProperty().getEmissionTexture?.()?.getImageLoaded()&&u(c.getProperty().getEmissionTexture())&&d.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),s=ih.substitute(s,"//VTK::TCoord::Impl",d).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("fragment");let n=e.getCode();n=ih.substitute(n,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"]).result,e.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===Zv.POINTS||t===Yv.Points?Xv.Verts:t===Yv.Lines?Xv.Lines:e===Zv.WIREFRAME?t===Yv.Triangles?Xv.LinesFromTriangles:Xv.LinesFromStrips:t===Yv.Triangles?Xv.Triangles:t===Yv.TriangleStrips?Xv.Strips:t===Yv.TriangleEdges?Xv.LinesFromTriangles:Xv.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case Xv.Triangles:return"triangle-list";case Xv.Verts:return"point-list";case Xv.Lines:default:return"line-list"}},e.buildVertexInput=()=>{const n=t.currentInput,r=t.cellArray,o=t.primitiveType;let a=t.WebGPUActor.getRenderable().getProperty().getRepresentation();const i=t.WebGPURenderWindow.getDevice();let s=!1;o===Yv.TriangleEdges&&(s=!0,a=Zv.WIREFRAME);const l=t.vertexInput,c=n.getPoints();let u;if(r){const e={hash:`R${a}P${o}${r.getMTime()}`,usage:Xv.Index,cells:r,numberOfPoints:c.getNumberOfPoints(),primitiveType:o,representation:a};u=i.getBufferManager().getBuffer(e),l.setIndexBuffer(u)}else l.setIndexBuffer(null);if(c){const e=t.WebGPUActor.getBufferShift(t.WebGPURenderer),n={hash:`${c.getMTime()}I${u.getMTime()}${e.join()}float32x4`,usage:Xv.PointArray,format:"float32x4",dataArray:c,indexBuffer:u,shift:e,packExtra:!0},r=i.getBufferManager().getBuffer(n);l.addBuffer(r,["vertexBC"])}else l.removeBufferIfPresent("vertexBC");const d=e.getUsage(a,o);if(t._usesCellNormals=!1,t.is2D||d!==Xv.Triangles&&d!==Xv.Strips)l.removeBufferIfPresent("normalMC");else{const e=n.getPointData().getNormals(),a={format:"snorm8x4",indexBuffer:u,packExtra:!0,shift:0,scale:127};if(e){a.hash=`${e.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=e,a.usage=Xv.PointArray;const t=i.getBufferManager().getBuffer(a);l.addBuffer(t,["normalMC"])}else if(o===Yv.Triangles){t._usesCellNormals=!0,a.hash=`PFN${c.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=c,a.cells=r,a.usage=Xv.NormalsFromPoints;const e=i.getBufferManager().getBuffer(a);l.addBuffer(e,["normalMC"])}else l.removeBufferIfPresent("normalMC")}let p=!1;if(t.renderable.getScalarVisibility()){const e=t.renderable.getColorMapColors();if(e&&!s){const r=t.renderable.getScalarMode();let o=!1;r!==Qv.USE_CELL_DATA&&r!==Qv.USE_CELL_FIELD_DATA&&r!==Qv.USE_FIELD_DATA&&n.getPointData().getScalars()||r===Qv.USE_POINT_FIELD_DATA||!e||(o=!0);const a={usage:Xv.PointArray,format:"unorm8x4",hash:`${o}${e.getMTime()}I${u.getMTime()}unorm8x4`,dataArray:e,indexBuffer:u,cellData:o,cellOffset:0},s=i.getBufferManager().getBuffer(a);l.addBuffer(s,["colorVI"]),p=!0}}p||l.removeBufferIfPresent("colorVI");let f=null;if(f=t.renderable.getInterpolateScalarsBeforeMapping?.()&&t.renderable.getColorCoordinates()?t.renderable.getColorCoordinates():n.getPointData().getTCoords(),f&&!s){const e=i.getBufferManager().getBufferForPointArray(f,l.getIndexBuffer());l.addBuffer(e,["tcoord"])}else l.removeBufferIfPresent("tcoord")},e.updateTextures=()=>{const e=[],n=[],r=t.renderable.getColorTextureMap?.();r&&(t.colorTexture||(t.colorTexture=Ru.newInstance({label:"polyDataColor"})),t.colorTexture.setInputData(r),n.push(["Diffuse",t.colorTexture]));const o=t.WebGPUActor.getRenderable(),a=t.WebGPURenderer.getRenderable(),i=[];if(o.getProperty().getDiffuseTexture?.()){const e=["Diffuse",o.getProperty().getDiffuseTexture()];i.push(e)}if(o.getTextures()[0]){const e=["Diffuse",o.getTextures()[0]];i.push(e)}if(t.colorTexture){const e=["Diffuse",t.colorTexture];i.push(e)}if(o.getProperty().getRoughnessTexture?.()){const e=["Roughness",o.getProperty().getRoughnessTexture()];i.push(e)}if(o.getProperty().getMetallicTexture?.()){const e=["Metallic",o.getProperty().getMetallicTexture()];i.push(e)}if(o.getProperty().getNormalTexture?.()){const e=["Normal",o.getProperty().getNormalTexture()];i.push(e)}if(o.getProperty().getAmbientOcclusionTexture?.()){const e=["AmbientOcclusion",o.getProperty().getAmbientOcclusionTexture()];i.push(e)}if(o.getProperty().getEmissionTexture?.()){const e=["Emission",o.getProperty().getEmissionTexture()];i.push(e)}if(a.getEnvironmentTexture?.()){const e=["Environment",a.getEnvironmentTexture()];i.push(e)}for(let e=0;e=0;n--)e[n]||(t.textures.splice(n,1),t.textureViews.splice(n,1))},e.computePipelineHash=()=>{let n=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.primitiveType===Yv.TriangleEdges||t.primitiveType===Yv.TriangleStripEdges)n+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(n+="n"),t.vertexInput.hasAttribute("colorVI")&&(n+="c"),t.vertexInput.hasAttribute("tcoord")){const e=t.vertexInput.getBuffer("tcoord");n+=`t${yh(e.getArrayInformation()[0].format)}`}t.textures.length&&(n+=`tx${t.textures.length}`)}t._usesCellNormals&&(n+="cn"),t.SSBO&&(n+="ssbo"),n+=e.getHashFromUsage(t.usage),n+=t.renderEncoder.getPipelineHash(),t.pipelineHash=n},e.updateBuffers=()=>{t.primitiveType!==Yv.TriangleEdges&&t.primitiveType!==Yv.TriangleStripEdges&&e.updateTextures();const n=t.WebGPUActor.getRenderable(),r=n.getProperty().getRepresentation();t.usage=e.getUsage(r,t.primitiveType),e.buildVertexInput();const o=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(o.getSizeInBytes()/o.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){const t=n.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}const ay={is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function iy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ay,n),Dh.extend(e,t,n),t.fragmentShaderTemplate=ny,t.vertexShaderTemplate=ty,t._tmpMat3=pe(new Float64Array(9)),t._tmpMat4=g(new Float64Array(16)),t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),At(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],oy(e,t)}var sy={newInstance:Et(iy,"vtkWebGPUCellArrayMapper"),extend:iy};const{PrimitiveTypes:ly}=fv;function cy(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>sy.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=ly.Points;i<=ly.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility())for(let a=ly.TriangleEdges;a<=ly.TriangleStripEdges;a++)if(r[a-2].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const i=t.primitives[a];i.setCellArray(r[a-2]),i.setCurrentInput(n),i.setCellOffset(t.primitives[a-2].getCellOffset()),i.setPrimitiveType(a),i.setRenderable(t.renderable),o.push(i)}else t.primitives[a]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}const uy={primitives:null};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uy,n),Zt.extend(e,t,n),t.primitives=[],cy(e,t)}const py=Et(dy,"vtkWebGPUPolyDataMapper");var fy={newInstance:py,extend:dy};Um("vtkMapper",py);const{PrimitiveTypes:gy}=fv;function my(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>sy.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=gy.Points;i<=gy.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),s.setIs2D(!0),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}function hy(e){return{primitives:[],...e}}const vy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hy(n)),Zt.extend(e,t,n),t.primitives=[],my(e,t)}),"vtkWebGPUPolyDataMapper2D");function yy(e,t){t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Um("vtkMapper2D",vy);const by={};const xy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,by,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Gp.newScalarBarActorHelper(),yy(e,t)}),"vtkWebGPUScalarBarActor");function Ty(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}Um("vtkScalarBarActor",xy);const Cy={device:null,handle:null,label:null,options:null};function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cy,n),jt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","options"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),Ty(e,t)}var Ay={newInstance:jt.newInstance(Sy),extend:Sy};function Py(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=hh(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=hh(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=Ay.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const Iy={texture:null,handle:null,sampler:null,label:null};function wy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iy,n),jt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","texture"]),jt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Py(e,t)}var Oy={newInstance:jt.newInstance(wy),extend:wy};const{BufferUsage:My}=fv;function Ry(e,t){t.classHierarchy.push("vtkWebGPUTexture"),e.create=(e,n)=>{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=hh(t.format);let a=t.width*o.stride;const i=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,a=2===o.elementSize&&"float"===o.sampleType;if(a||r%256){const i=e,s=r/i.BYTES_PER_ELEMENT,l=o.elementSize,c=256*Math.floor((s*l+255)/256),u=c/l,d=jt.newTypedArray(a?"Uint16Array":i.constructor.name,u*t*n);for(let e=0;e{const e=hh(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>hh(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Oy.newInstance({label:n});return o.create(e,r),o}}const Vy={device:null,handle:null,buffer:null,ready:!1,label:null};function Ey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),jt.obj(e,t),jt.get(e,t,["handle","ready","width","height","depth","format","usage"]),jt.setGet(e,t,["device","label"]),Ry(e,t)}var Dy={newInstance:jt.newInstance(Ey),extend:Ey};function Ly(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DCellArrayMapper");const n={...e};e.setGlyphInstances=e=>{t.glyphInstances=e},e.updateBuffers=()=>{n.updateBuffers(),e.setNumberOfInstances(t.glyphInstances)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),r.addBuiltinOutput("vec4","@builtin(position) Position"),r.hasOutput("vertexVC")||r.addOutput("vec3","vertexVC");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" var vertexSC: vec4 = mapperUBO.BCSCMatrix*glyphSSBO.values[input.instanceIndex].matrix*vertexBC;"," output.vertexVC = (rendererUBO.SCVCMatrix*vertexSC).xyz;"," output.Position = rendererUBO.SCPCMatrix*vertexSC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,t,r)=>{if(r.hasAttribute("normalMC")){const e=t.getShaderDescription("vertex");let n=e.getCode();n=ih.substitute(n,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals"," * mapperUBO.MCWCNormals"," * glyphSSBO.values[input.instanceIndex].normal*normalMC).xyz);"]).result,e.setCode(n)}n.replaceShaderNormal(e,t,r)},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderColor=(e,r,o)=>{if(!t.renderable.getColorArray())return void n.replaceShaderColor(e,r,o);const a=r.getShaderDescription("vertex");a.addOutput("vec4","color");let i=a.getCode();i=ih.substitute(i,"//VTK::Color::Impl",[" output.color = glyphSSBO.values[input.instanceIndex].color;"]).result,a.setCode(i);const s=r.getShaderDescription("fragment");i=s.getCode(),i=ih.substitute(i,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("vertex");e.addOutput("u32","compositeID","flat");let n=e.getCode();n=ih.substitute(n,"//VTK::Select::Impl",[" output.compositeID = input.instanceIndex;"]).result,e.setCode(n);const r=t.getShaderDescription("fragment");n=r.getCode(),n=ih.substitute(n,"//VTK::Select::Impl",["var compositeID: u32 = input.compositeID;"]).result,r.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect)}const By=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,{},n),sy.extend(e,t,n),Ly(e,t)}),"vtkWebGPUGlyph3DCellArrayMapper");function Ny(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DMapper"),e.createCellArrayMapper=()=>{const e=By();return e.setSSBO(t.SSBO),e.setRenderable(t.renderable),e},e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData(1);t.renderable.mapScalars(n,1),e.updateSSBO(),e.updateCellArrayMappers(n);for(let e=0;e{t.currentInput=t.renderable.getInputData(1),t.renderable.buildArrays();const n=t.renderable.getMatrixArray(),r=t.renderable.getNormalArray();if(t.carray=t.renderable.getColorArray(),t.numInstances=n.length/16,t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.WebGPURenderWindow=e.getFirstAncestorOfType("vtkWebGPURenderWindow");const o=t.WebGPURenderWindow.getDevice();t.SSBO.clearData(),t.SSBO.setNumberOfInstances(t.numInstances),t.SSBO.addEntry("matrix","mat4x4"),t.SSBO.addEntry("normal","mat4x4"),t.carray&&t.SSBO.addEntry("color","vec4"),t.SSBO.setAllInstancesFromArray("matrix",n),t.SSBO.setAllInstancesFromArray3x3To4x4("normal",r),t.carray&&t.SSBO.setAllInstancesFromArrayColorToFloat("color",t.carray.getData()),t.SSBO.send(o),t.glyphBOBuildTime.modified()}}}const ky={};const Fy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ky,n),fy.extend(e,t,n),t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),t.SSBO=bv.newInstance({label:"glyphSSBO"}),Ny(e,t)}),"vtkWebGPUGlyph3DMapper");Um("vtkGlyph3DMapper",Fy);const{SlicingMode:_y}=bg,Gy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",Uy=new Float64Array(16),Wy=new Float64Array(16),zy=new Float64Array(16),Hy=new Float64Array(4),jy=new Float64Array(4);function Ky(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();g(Uy),x(Uy,Uy,n);const a=r.getMatrix();m(Wy,a),h(Wy,Wy),b(Uy,Wy,Uy);const i=e.getWorldToIndex();b(Uy,i,Uy),h(zy,Uy),I(Wy,[.5,.5,.5]),b(Uy,Wy,Uy);const s=e.getDimensions();g(Wy),T(Wy,Wy,[1/s[0],1/s[1],1/s[2]]),b(Uy,Wy,Uy),t.UBO.setArray("SCTCMatrix",Uy);const l=t.currentInput.getExtent(),{ijkMode:c}=t.renderable.getClosestIJKAxis();let u=t.renderable.getSlice();c!==t.renderable.getSlicingMode()&&(u=t.renderable.getSliceAtPosition(u));let d=2,p=0,f=1;c===_y.I?(d=0,p=1,f=2):c===_y.J&&(d=1,p=2,f=0),Hy[d]=u,Hy[p]=l[2*p]-.5,Hy[f]=l[2*f]-.5,Hy[3]=1,zi(Hy,Hy,zy),t.UBO.setArray("Origin",Hy),jy[d]=u,jy[p]=l[2*p+1]+.5,jy[f]=l[2*f]-.5,jy[3]=1,zi(jy,jy,zy),Wi(jy,jy,Hy),jy[3]=1,t.UBO.setArray("Axis1",jy),jy[d]=u,jy[p]=l[2*p]-.5,jy[f]=l[2*f+1]+.5,jy[3]=1,zi(jy,jy,zy),Wi(jy,jy,Hy),jy[3]=1,t.UBO.setArray("Axis2",jy);const v=[1,1,1,1],y=[0,0,0,0],C=t.textureViews[0],S=C.getTexture().getScale(),A=C.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let a=0;a<1;a++){o=n.getRGBTransferFunction(a);const i=o.getRange();o.getTable(i[0],i[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const a=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===dg.NEAREST?"nearest":"linear";t.clampSampler&&a===t.clampSampler.getOptions().minFilter||(t.clampSampler=Ay.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:a,magFilter:a}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let a=o.getCode();const i=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?i.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):i.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),i.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),a=ih.substitute(a,"//VTK::Position::Impl",i).result,o.setCode(a)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();t.dimensions,a=ih.substitute(a,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,a=ih.substitute(a,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(a)},r.set("replaceShaderImage",e.replaceShaderImage)}const $y={rowLength:1024};const qy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$y,n),kh.extend(e,t,n),e.setFragmentShaderTemplate(Gy),t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},yt(t.lutBuildTime,{mtime:0}),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},yt(t.VBOBuildTime),Ky(e,t)}),"vtkWebGPUImageMapper");function Xy(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Um("vtkImageMapper",qy);const Yy={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Zy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yy,n),Zt.extend(e,t,n),t.keyMatricesTime={},yt(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},t.bufferShift=[0,0,0,0],xt(e,t,["propID","keyMatricesTime"]),Xy(e,t)}),"vtkWebGPUImageSlice");function Qy(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const a=t.renderable.getMapper().getInputData();if(!a)return;const i=a.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=i[t];for(let t=2;t<4;t++){n[1]=i[t];for(let t=0;t<2;t++){n[0]=i[t],a.indexToWorld(n,r);let c=o+3*l;e[c++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[c++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[c++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();m(t.keyMatrices.bcwc,n),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Um("vtkImageSlice",Zy);const Jy={propID:void 0,keyMatricesTime:null};const eb=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jy,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),Qy(e,t)}),"vtkWebGPUVolume");function tb(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),a=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,i=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,null)}}Um("vtkVolume",eb);const nb={};const rb=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nb,n),Zt.extend(e,t,n),tb(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");Um("vtkPixelSpaceCallbackMapper",rb);const{BufferUsage:ob}=fv,{vtkErrorMacro:ab}=Kt,ib="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3 = normalize(-vertexVC.xyz);\n var base2: vec3 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n var base1: vec3 = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2 = vertexVC.xy + offsetMC;\n vertexVC = vec4(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vec4(vertexVC.xyz, 0.0);\n\n //VTK::Position::Impl\n\n return output;\n}\n";function sb(e,t){t.classHierarchy.push("vtkWebGPUSphereMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("f32","radiusVC");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=ih.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n var invertedDepth: f32 = 1.0;\n if (rendererUBO.cameraParallel != 0u) {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0) {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n // find the intersection\n var b: f32 = 2.0*dot(EyePos,EyeDir);\n var c: f32 = dot(EyePos,EyePos) - 1.0;\n var d: f32 = b*b - 4.0*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else {\n var t: f32 = (-b - invertedDepth*sqrt(d))*0.5;\n\n // compute the normal, for unit sphere this is just\n // the intersection point\n normal = invertedDepth*normalize(EyePos + t*EyeDir);\n // compute the intersection point in VC\n vertexVC = vec4(normal * input.radiusVC + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="spm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=n.getPoints(),o=r.getNumberOfPoints(),a=r.getData();e.setNumberOfInstances(1),e.setNumberOfVertices(3*o);const i=t.vertexInput;let s=`spm${r.getMTime()}float32x3`;if(!t.device.getBufferManager().hasBuffer(s)){const e={hash:s,usage:ob.RawVertex,format:"float32x3"},n=new Float32Array(3*o*3);let r=0,l=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lb,n),sy.extend(e,t,n),e.setVertexShaderTemplate(ib),sb(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUSphereMapper");Um("vtkSphereMapper",cb);const{BufferUsage:ub}=fv,{vtkErrorMacro:db}=Kt,pb="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array, 12> = array, 12>(\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(-1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n vec3(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3;\n var ybase: vec3;\n var dir: vec3 = vec3(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3 = offsetsArray[vertIdx];\n\n vertexVC = vec4(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n";function fb(e,t){t.classHierarchy.push("vtkWebGPUStickMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("vec3","orientVC"),r.addOutput("f32","radiusVC"),r.addOutput("f32","lengthVC"),r.addBuiltinInput("u32","@builtin(vertex_index) vertexIndex");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=ih.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n\n if (rendererUBO.cameraParallel != 0u)\n {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else\n {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0)\n {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n\n // rotate to new basis\n // base1, base2, orientVC\n var base1: vec3;\n if (abs(input.orientVC.z) < 0.99)\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,0.0,1.0)));\n }\n else\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,1.0,0.0)));\n }\n var base2: vec3 = cross(input.orientVC,base1);\n EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,input.orientVC));\n EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,input.orientVC));\n\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n\n // find the intersection\n var a: f32 = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n var b: f32 = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n var c: f32 = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n var d: f32 = b*b - 4.0*a*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else\n {\n var t: f32 = (-b - sqrt(d))*(0.5 / a);\n var tz: f32 = EyePos.z + t*EyeDir.z;\n var iPoint: vec3 = EyePos + t*EyeDir;\n if (abs(iPoint.z)*input.radiusVC > input.lengthVC*0.5)\n {\n // test for end cap\n var t2: f32 = (-b + sqrt(d))*(0.5 / a);\n var tz2: f32 = EyePos.z + t2*EyeDir.z;\n if (tz2*input.radiusVC > input.lengthVC*0.5 || tz*input.radiusVC < -0.5*input.lengthVC) { discard; }\n else\n {\n normal = input.orientVC;\n var t3: f32 = (input.lengthVC*0.5/input.radiusVC - EyePos.z)/EyeDir.z;\n iPoint = EyePos + t3*EyeDir;\n vertexVC = vec4(input.radiusVC*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n else\n {\n // The normal is the iPoint.xy rotated back into VC\n normal = iPoint.x*base1 + iPoint.y*base2;\n // rescale rerotate and translate\n vertexVC = vec4(input.radiusVC*(normal + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="stm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=t.device,o=n.getPoints(),a=n.getPointData(),i=o.getNumberOfPoints(),s=o.getData();e.setNumberOfInstances(i),e.setNumberOfVertices(12);const l=t.vertexInput;let c=`stm${o.getMTime()}float32x3`;if(!r.getBufferManager().hasBuffer(c)){const e={hash:c,usage:ub.RawVertex,format:"float32x3"},t=new Float32Array(3*i);let n=0,o=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gb,n),sy.extend(e,t,n),e.setVertexShaderTemplate(pb),fb(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUStickMapper");Um("vtkStickMapper",mb);var hb=Uint8Array,vb=Uint16Array,yb=Uint32Array,bb=new hb([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,0,0,0]),xb=new hb([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,0,0]),Tb=new hb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cb=function(e,t){for(var n=new vb(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Mb)<<1;Rb=(61680&(Rb=(52428&Rb)>>>2|(13107&Rb)<<2))>>>4|(3855&Rb)<<4,Ob[Mb]=((65280&Rb)>>>8|(255&Rb)<<8)>>>1}var Vb=function(e,t,n){for(var r=e.length,o=0,a=new vb(t);o>>l]=c}else for(i=new vb(r),o=0;o>>15-e[o]);return i},Eb=new hb(288);for(Mb=0;Mb<144;++Mb)Eb[Mb]=8;for(Mb=144;Mb<256;++Mb)Eb[Mb]=9;for(Mb=256;Mb<280;++Mb)Eb[Mb]=7;for(Mb=280;Mb<288;++Mb)Eb[Mb]=8;var Db=new hb(32);for(Mb=0;Mb<32;++Mb)Db[Mb]=5;var Lb=Vb(Eb,9,1),Bb=Vb(Db,5,1),Nb=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},kb=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Fb=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},_b=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?vb:4==e.BYTES_PER_ELEMENT?yb:hb)(n-t);return r.set(e.subarray(t,n)),r},Gb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ub=function(e,t,n){var r=new Error(t||Gb[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ub),!n)throw r;return r},Wb=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new hb(0);var o=!t||n,a=!n||n.i;n||(n={}),t||(t=new hb(3*r));var i,s=function(e){var n=t.length;if(e>n){var r=new hb(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,c=n.p||0,u=n.b||0,d=n.l,p=n.d,f=n.m,g=n.n,m=8*r;do{if(!d){l=kb(e,c,1);var h=kb(e,c+1,3);if(c+=3,!h){var v=e[(i=c,(O=4+((i+7)/8|0))-4)]|e[O-3]<<8,y=O+v;if(y>r){a&&Ub(0);break}o&&s(u+v),t.set(e.subarray(O,y),u),n.b=u+=v,n.p=c=8*y,n.f=l;continue}if(1==h)d=Lb,p=Bb,f=9,g=5;else if(2==h){var b=kb(e,c,31)+257,x=kb(e,c+10,15)+4,T=b+kb(e,c+5,31)+1;c+=14;for(var C=new hb(T),S=new hb(19),A=0;A>>4)<16)C[A++]=O;else{var R=0,V=0;for(16==O?(V=3+kb(e,c,3),c+=2,R=C[A-1]):17==O?(V=3+kb(e,c,7),c+=3):18==O&&(V=11+kb(e,c,127),c+=7);V--;)C[A++]=R}}var E=C.subarray(0,b),D=C.subarray(b);f=Nb(E),g=Nb(D),d=Vb(E,f,1),p=Vb(D,g,1)}else Ub(1);if(c>m){a&&Ub(0);break}}o&&s(u+131072);for(var L=(1<>>4;if((c+=15&R)>m){a&&Ub(0);break}if(R||Ub(2),k<256)t[u++]=k;else{if(256==k){N=c,d=null;break}var F=k-254;if(k>264){var _=bb[A=k-257];F=kb(e,c,(1<<_)-1)+Ab[A],c+=_}var G=p[Fb(e,c)&B],U=G>>>4;if(G||Ub(3),c+=15&G,D=wb[U],U>3&&(_=xb[U],D+=Fb(e,c)&(1<<_)-1,c+=_),c>m){a&&Ub(0);break}o&&s(u+131072);for(var W=u+F;u>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new hb((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function jb(e,t){return Wb(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&Ub(6,"invalid zlib data"),32&n[1]&&Ub(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function Kb(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?Hb(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return Wb(e,t)}(e,t):jb(e,t)}var $b="undefined"!=typeof TextDecoder&&new TextDecoder;try{$b.decode(zb,{stream:!0})}catch(e){}function qb(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,_b(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=o[0];return o[1].length&&Ub(8),a}function Xb(){const e=new ArrayBuffer(4),t=new Uint8Array(e),n=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===n[0]?"LittleEndian":2712847316===n[0]?"BigEndian":null}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var Yb=Xb(),Zb=function(e,t){if(t<2)return;const n=new Int8Array(e),r=n.length,o=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Qb[e](t)};const{vtkErrorMacro:nx,vtkDebugMacro:rx}=jt;let ox=0;function ax(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const ix={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,a)=>{let i=null;i=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=ax("GET",i,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++ox&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=qb(Kb(new Uint8Array(n.buffer))):n.buffer=Kb(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Yb!==n.ref.encode&&Yb&&(rx(`Swap bytes of ${n.name}`),Zb(n.buffer,Is[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&nx(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const a=ax("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++ox&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(JSON.parse(qb(Kb(new Uint8Array(a.response))))):r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(nx("Supported algorithms are: [gz]"),nx(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const a=ax("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++ox&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(qb(Kb(new Uint8Array(a.response)))):r(a.responseText):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(nx("Supported algorithms are: [gz]"),nx(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=ax("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(Kb(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};ex("http",(e=>ix));const sx={DEFAULT:0,GEOMETRY:1,SLICE:2,VOLUME:3,YZ_PLANE:4,XZ_PLANE:5,XY_PLANE:6},lx={PICKING_BUFFER:0,FRONT_BUFFER:1};var cx={ViewTypes:sx,RenderingTypes:lx,CaptureOn:{MOUSE_MOVE:0,MOUSE_RELEASE:1}};const ux=0,dx=1,px=2,fx="translateAxis",gx="rotateLine",mx="translateCenter",hx="translateCenterAndUpdatePlanes",vx=(sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,["X","Y","Z"]),yx={[sx.YZ_PLANE]:"X",[sx.XZ_PLANE]:"Y",[sx.XY_PLANE]:"Z"},bx={X:sx.YZ_PLANE,Y:sx.XZ_PLANE,Z:sx.XY_PLANE};function xx(e,t,n){const r=[...e];return qf().rotate(n,t).apply(r),r}function Tx(e){return e[0]}function Cx(e){return e[3]}function Sx(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vx;const t=[];return e.forEach((n=>{e.forEach((e=>{n!==e&&t.push(`${n}in${e}`)}))})),t}function Ax(e,t){const n=Tx(t),r=Cx(t),o=function(e){return Object.keys(e.getPlanes()).map((e=>yx[e]))}(e).find((e=>e!==n&&e!==r));return`${o}in${r}`}function Px(e,t,n,r){return Ko([...e],t*(r?1:n)/2)}function Ix(e,t,n){const r=Object.keys(e.getPlanes()).map((e=>yx[e])),o=r.reduce(((t,n)=>(r.filter((e=>n!==e)).forEach((r=>{const o=Yo(e.getPlanes()[bx[n]].normal,e.getPlanes()[bx[r]].normal,[]);t[`${n}${r}`]=o,t[`${r}${n}`]=o})),t)),{}),a=e.getImage().getBounds(),i=e.getCenter(),s=Ui.getDiagonalLength(a);e.getCenterHandle().setOrigin(i),Sx(r).forEach((r=>{const a=Tx(r),l=Cx(r),c=o[`${a}${l}`];e[`getRotationHandle${r}0`]().setOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal),e[`getRotationHandle${r}0`]().setOffset(Px(c,n,s,t)),e[`getRotationHandle${r}1`]().setOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal),e[`getRotationHandle${r}1`]().setOffset(Px(c,-n,s,t));const u=e[`getAxis${r}`]();u.setOrigin(i),u.getManipulator()?.setHandleOrigin(i),u.getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal);const d=Qo(c),p=u.getScale3();p[2]=2*d,u.setScale3(p);const f=e.getPlanes()[bx[l]].normal,g=Yo(c,f,[]);u.setRight(f),u.setUp(g),u.setDirection(c)}))}function wx(e,t){t.classHierarchy.push("vtkAbstractManipulator"),e.getOrigin=e=>t.userOrigin?t.userOrigin:t.useCameraFocalPoint?e.pokedRenderer.getActiveCamera().getFocalPoint():t.handleOrigin?t.handleOrigin:t.widgetOrigin?t.widgetOrigin:[0,0,0],e.getNormal=e=>t.userNormal?t.userNormal:t.useCameraNormal?e.pokedRenderer.getActiveCamera().getDirectionOfProjection():t.handleNormal?t.handleNormal:t.widgetNormal?t.widgetNormal:[0,0,1]}const Ox={useCameraFocalPoint:!1,useCameraNormal:!1};function Mx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ox,n),jt.obj(e,t),jt.setGet(e,t,["useCameraFocalPoint","useCameraNormal"]),jt.setGetArray(e,t,["userOrigin","handleOrigin","widgetOrigin","userNormal","handleNormal","widgetNormal"],3),wx(e,t)}var Rx={extend:Mx,newInstance:jt.newInstance(Mx,"vtkAbstractManipulator")};function Vx(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ri.intersectWithLine(i,s,n,r).x}function Ex(e,t){t.classHierarchy.push("vtkCPRManipulator"),e.handleEvent=(n,r)=>{const o=t.cprActor?.getMapper();if(!o)return{worldCoords:null};const a=[];m(a,t.cprActor.getMatrix());const i=a.slice(8,11),s=a.slice(12,15),l=[];h(l,a);const c=[];Ln(c,Vx(n.position.x,n.position.y,s,i,n.pokedRenderer,r),l);const u=o.getHeight()-c[1];return e.distanceEvent(u)},e.distanceEvent=e=>{const n=t.cprActor?.getMapper();if(!n)return{worldCoords:null};const r=n.getHeight(),o=Math.max(0,Math.min(r,e)),{position:a,orientation:i}=n.getCenterlinePositionAndOrientation(o);let s;if(i){const e=Pe([],i),t=n.getDirectionMatrix();s=Ne([],e,t)}return t.currentDistance=o,{worldCoords:a,worldDirection:s}},e.handleScroll=n=>{const r=t.currentDistance+e.getDistanceStep()*n;return e.distanceEvent(r)},e.getDistanceStep=()=>{if(!t.distanceStep){const e=t.cprActor?.getMapper()?.getInputData(0)?.getSpacing?.();if(e)return Math.min(...e)}return t.distanceStep}}function Dx(e){return{distanceStep:0,currentDistance:0,cprActor:null,...e}}function Lx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Rx.extend(e,t,Dx(n)),jt.setGet(e,t,["distance","currentDistance","cprActor"]),jt.set(e,t,["distanceStep"]),Ex(e,t)}var Bx={intersectDisplayWithPlane:Vx,extend:Lx,newInstance:jt.newInstance(Lx,"vtkCPRManipulator")};const{vtkDebugMacro:Nx}=jt;function kx(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),a=g(new Float64Array(16)),i=g(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),c=new Float64Array(3),u=g(new Float64Array(16)),p=g(new Float64Array(16)),f=new Float64Array(3),v=new Float64Array(3);function y(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Nx("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Nx("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,y()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,a=t.viewUp,i=new Float64Array([a[0],a[1],a[2],0]);g(u);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);C(u,u,Eo(n),s),zi(i,i,u),t.viewUp[0]=i[0],t.viewUp[1]=i[1],t.viewUp[2]=i[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;g(p),x(p,p,r),C(p,p,Eo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Ln(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.yaw=n=>{const r=t.position;g(p),x(p,p,r),C(p,p,Eo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Ln(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),a=[-o[0],-o[1],-o[2]];g(p),x(p,p,r),C(p,p,Eo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Ln(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),a=[o[0],o[1],o[2]];g(p),x(p,p,r),C(p,p,Eo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Ln(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const a=[n,r,o];Ho(t.position,a,t.position),Ho(t.focalPoint,a,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],a=[],i=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],zi(o,[...t.position,1],n),zi(a,[...t.focalPoint,1],n),zi(i,r,n),i[0]-=o[0],i[1]-=o[1],i[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...a.slice(0,3)),e.setViewUp(...i.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Nx("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Nx("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(d(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{d(a,e.getViewMatrix()),h(a,a),w(i,[t.distance,t.distance,t.distance]),b(a,a,i),g(t.cameraLightTransform),x(t.cameraLightTransform,a,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Yi(e[0],e[1],e[2],e[3]),n=Hi(),r=Yi(0,0,1,0);var o,a;return a=t,(o=n)[0]=-a[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],Ki(r,t,r),Ki(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),h(t,t)},e.getWorldToPhysicalMatrix=e=>{g(e);const n=[3];Yo(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],m(e,e),Pn(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),T(e,e,s),x(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=i=>{h(a,i),Ln(s,n,a),e.computeDistance();const u=t.distance;e.setPosition(s[0],s[1],s[2]),Ln(l,r,a),wn(l,l,s),Vn(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Ln(c,o,a),wn(c,c,s),Vn(c,c),e.setViewUp(c[0],c[1],c[2]),e.setDistance(u)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(a),b(a,t,a),e.computeViewParametersFromViewMatrix(a)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(d(a,t.viewMatrix),e.computeViewParametersFromViewMatrix(a),m(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;q(a,t.position,t.focalPoint,t.viewUp),m(a,a);const e=new Float64Array(16);return d(e,a),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(g(o),t.projectionMatrix){const e=1/t.physicalScale;return Pn(s,e,e,e),d(o,t.projectionMatrix),T(o,o,s),m(o,o),o}g(a);const i=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*i/2,t.clippingRange[0]+(r+1)*i/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,i=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,c=(t.windowCenter[1]+1)*r;K(a,o,i,s,c,l[0],l[1]),m(a,a)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(Eo(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const i=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,c=(t.windowCenter[1]-1)*o,u=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];a[0]=2*d/(s-i),a[5]=2*d/(u-c),a[2]=(i+s)/(s-i),a[6]=(c+u)/(u-c),a[10]=-(d+p)/(p-d),a[14]=-1,a[11]=-2*d*p/(p-d),a[15]=0}}return d(o,a),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),a=e.getProjectionMatrix(t,n,r);return b(a,o,a),a},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,y()},e.setDeviceAngles=(n,r,o,a)=>{const i=[3];Yo(t.physicalViewNorth,t.physicalViewUp,i);const s=g(new Float64Array(16));C(s,s,Eo(n),t.physicalViewUp),C(s,s,Eo(r),i),C(s,s,Eo(o),t.physicalViewNorth),C(s,s,Eo(-a),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),c=new Float64Array(t.physicalViewNorth);Ln(l,l,s),Ln(c,c,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(c[0],c[1],c[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const a=g(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=Eo(t),i=Hi();ji(i,[n,r,o],e),_(a,i)}const i=new Float64Array(3);Ln(i,[0,0,-1],a);const s=new Float64Array(3);Ln(s,[0,1,0],a),e.setDirectionOfProjection(...i),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],a=-n[1],i=-n[2],s=-(o*r[0]+a*r[1]+i*r[2]),l=[o*e[0]+a*e[2]+i*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const c=o*e[r]+a*e[2+n]+i*e[4+t]+s;l[0]=cl[1]?c:l[1]}return l}}const Fx={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:c(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function _x(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fx,n),jt.obj(e,t),jt.get(e,t,["distance"]),jt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),jt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),jt.setGetArray(e,t,["clippingRange","windowCenter"],2),jt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),kx(e,t)}var Gx={newInstance:jt.newInstance(_x,"vtkCamera"),extend:_x};function Ux(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Ln(n,t.position,t.transformMatrix):Pn(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Ln(n,t.focalPoint,t.transformMatrix):Pn(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);_n(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=Eo(t),o=Eo(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Wx={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function zx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wx,n),jt.obj(e,t),jt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),jt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Ux(e,t)}var Hx={newInstance:jt.newInstance(zx,"vtkLight"),extend:zx,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:jx}=jt;function Kx(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>jx("call displayToView on your view instead"),e.viewToDisplay=()=>jx("callviewtodisplay on your view instead"),e.getSize=()=>jx("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>jx("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const $x={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function qx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$x,n),jt.obj(e,t),jt.event(e,t,"event"),jt.setGetArray(e,t,["viewport"],4),jt.setGetArray(e,t,["background","background2"],3),Kx(e,t)}var Xx={newInstance:jt.newInstance(qx,"vtkViewport"),extend:qx};const{vtkDebugMacro:Yx,vtkErrorMacro:Zx,vtkWarningMacro:Qx}=Kt;function Jx(e){return()=>Zx(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function eT(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(Yx("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(c())):Zx("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Jx("allocateTime"),e.updateGeometry=Jx("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{Yx(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Gx.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Hx.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let a=e.normalizedDisplayToProjection(t,n,r);return a=e.projectionToView(a[0],a[1],a[2],o),e.viewToWorld(a[0],a[1],a[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let a=e.worldToView(t,n,r);return a=e.viewToProjection(a[0],a[1],a[2],o),e.projectionToNormalizedDisplay(a[0],a[1],a[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return Zx("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o),m(o,o);const a=new Float64Array([e,n,r]);return Ln(a,a,o),a},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return Zx("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);h(a,a),m(a,a);const i=new Float64Array([e,n,r]);return Ln(i,i,a),i},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return Zx("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o);const a=new Float64Array([e,n,r]);return Ln(a,a,o),a},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return Zx("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);m(a,a);const i=new Float64Array([e,n,r]);return Ln(i,i,a),i},e.computeVisiblePropBounds=()=>{t.allBounds[0]=Ui.INIT_BOUNDS[0],t.allBounds[1]=Ui.INIT_BOUNDS[1],t.allBounds[2]=Ui.INIT_BOUNDS[2],t.allBounds[3]=Ui.INIT_BOUNDS[3],t.allBounds[4]=Ui.INIT_BOUNDS[4],t.allBounds[5]=Ui.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(Ra(t.allBounds),Yx("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),a=[0,0,0];if(!Va(r))return Yx("Cannot reset camera!"),!1;let i=null;if(!e.getActiveCamera())return Zx("Trying to reset non-existent camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),a[0]=(r[0]+r[1])/2,a[1]=(r[2]+r[3])/2,a[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],c=r[5]-r[4];s*=s,l*=l,c*=c;let u=s+l+c;u=0===u?1:u,u=.5*Math.sqrt(u);const d=Eo(t.activeCamera.getViewAngle()),p=u,f=u/Math.sin(.5*d),g=t.activeCamera.getViewUp();return Math.abs(Xo(g,i))>.999&&(Qx("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-g[2],g[0],g[1])),t.activeCamera.setFocalPoint(a[0],a[1],a[2]),t.activeCamera.setPosition(a[0]+f*i[0],a[1]+f*i[1],a[2]+f*i[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(u),t.activeCamera.setPhysicalTranslation(-a[0],-a[1],-a[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!Va(o))return Yx("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return Zx("Trying to reset clipping range of non-existent camera"),!1;const a=t.activeCamera.computeClippingRange(o);let i=0;if(t.activeCamera.getParallelProjection())i=.2*t.activeCamera.getParallelScale();else{const e=Eo(t.activeCamera.getViewAngle());i=.2*Math.tan(e/2)*a[1]}return a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const tT={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:_a(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function nT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,tT,n),Xx.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),xt(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),At(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Pt(e,t,["actors","volumes","lights"]),wt(e,t,["background"],4,1),Ot(0,t,["renderWindow"]),eT(e,t)}var rT={newInstance:Et(nT,"vtkRenderer"),extend:nT};const oT=Object.create(null);function aT(e,t){oT[e]=t}function iT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return oT[e]&&oT[e](t)}function sT(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return iT(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const lT={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function cT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lT,n),jt.obj(e,t),jt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),jt.get(e,t,["neverRendered"]),jt.getArray(e,t,["renderers"]),jt.moveToProtected(e,t,["views"]),jt.event(e,t,"completion"),sT(e,t)}var uT={newInstance:jt.newInstance(cT,"vtkRenderWindow"),extend:cT,registerViewConstructor:aT,listViewAPIs:function(){return Object.keys(oT)},newAPISpecificView:iT};const dT={Unknown:0,LeftController:1,RightController:2},pT={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var fT={Device:dT,Input:pT,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:gT,Input:mT}=fT,{vtkWarningMacro:hT,vtkErrorMacro:vT,normalizeWheel:yT,vtkOnceErrorMacro:bT}=jt,xT={ctrlKey:!1,altKey:!1,shiftKey:!1},TT={"xr-standard":[mT.Trigger,mT.Grip,mT.TrackPad,mT.Thumbstick,mT.A,mT.B]},CT=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function ST(e){e.cancelable&&e.preventDefault()}function AT(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function PT(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function a(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{vT("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>hT("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||a(0,0),t.currentRenderer);const i=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),i=n.width/o.width,s=n.height/o.height,l={x:i*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&a(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function c(e){return e.pointerType||""}function u(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",ST),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",ST),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&ST(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&hT("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:i(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&ST(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=i(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:vT(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?hT("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):vT("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;hT(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const a=null==n.gripSpace?null:r.getPose(n.gripSpace,o),i=n.gamepad,s=n.handedness;if(i){i.index in t.lastGamepadValues||(t.lastGamepadValues[i.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:i(n),deviceType:c(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),u(),n.size>0||Date.now(){ST(n);const r={...yT(n),...s(n),position:i(n),deviceType:c(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:vT(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=AT(r);if(2===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(xT),position:i(n),deviceType:c(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=AT(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(xT),position:i(n),deviceType:c(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=AT(r);e.recognizeGesture("TouchEnd",t);const a={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonPressEvent(a)}else{const t=AT(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,a=null,i=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){i=l;break}null===o&&l.getInteractive()&&(o=l),null===a&&t._view.isInViewport(e,n,l)&&(a=l)}return null===i&&(i=o),null===i&&(i=a),null==i&&(i=r[0]),i},e.render=()=>{e.isAnimating()||t.inRender||u()},CT.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void bT("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const a=[],i=[];Object.keys(r).forEach((e=>{a[o]=r[e],i[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y)),l=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y));let c=Do(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),u=Do(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),d=u-c;u=u+180>=360?u-180:u+180,c=c+180>=360?c-180:c+180,Math.abs(u-c)n&&o>a&&o>i){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(a>n&&a>i){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(i>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const IT={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function wT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IT,n),jt.obj(e,t),t._animationExtendedEnd=0,jt.event(e,t,"RenderEvent"),CT.forEach((n=>jt.event(e,t,n))),jt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),jt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),jt.moveToProtected(e,t,["view"]),PT(e,t)}var OT={newInstance:jt.newInstance(wT,"vtkRenderWindowInteractor"),extend:wT,handledEvents:CT,...fT};const{vtkErrorMacro:MT,VOID:RT}=jt;function VT(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){OT.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):RT),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():MT("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const ET={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function DT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ET,n),jt.obj(e,t),jt.event(e,t,"InteractionEvent"),jt.event(e,t,"StartInteractionEvent"),jt.event(e,t,"EndInteractionEvent"),jt.get(e,t,["_interactor","enabled"]),jt.setGet(e,t,["priority","processEvents"]),jt.moveToProtected(e,t,["interactor"]),VT(e,t)}var LT={newInstance:jt.newInstance(DT,"vtkInteractorObserver"),extend:DT,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}};const BT={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025};var NT={States:BT};const{States:kT}=NT,FT={Rotate:kT.IS_ROTATE,Pan:kT.IS_PAN,Spin:kT.IS_SPIN,Dolly:kT.IS_DOLLY,CameraPose:kT.IS_CAMERA_POSE,WindowLevel:kT.IS_WINDOW_LEVEL,Slice:kT.IS_SLICE};function _T(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(FT).forEach((n=>{jt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===kT.IS_NONE&&(t.state=FT[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},jt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===FT[n]&&(t.state=kT.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const GT={state:kT.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function UT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,GT,n),LT.extend(e,t,n),_T(e,t)}var WT={newInstance:jt.newInstance(UT,"vtkInteractorStyle"),extend:UT,...NT};const{States:zT}=NT;function HT(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case zT.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==dT.RightController||n.input!==pT.Trigger&&n.input!==pT.TrackPad?!n||n.pressed||n.device!==dT.RightController||n.input!==pT.Trigger&&n.input!==pT.TrackPad||t.state!==zT.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===zT.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case zT.IS_DOLLY:e.endDolly();break;case zT.IS_PAN:e.endPan();break;case zT.IS_SPIN:e.endSpin();break;case zT.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const a=o[2],i=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+i[0]-s[0],o[1]+i[1]-s[1],a),c=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],a),u=[];u[0]=c[0]-l[0],u[1]=c[1]-l[1],u[2]=c[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(u[0]+o[0],u[1]+o[1],u[2]+o[2]),r.setPosition(u[0]+d[0],u[1]+d[1],u[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,a=n.y-t.previousPosition.y,i=r.getView().getViewportSize(e);let s=-.1,l=-.1;i[0]&&i[1]&&(s=-20/i[1],l=-20/i[0]);const c=o*l*t.motionFactor,u=a*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(c)||Number.isNaN(u)||(d.azimuth(c),d.elevation(u),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),a=r.getView().getViewportCenter(e),i=Do(Math.atan2(t.previousPosition.y-a[1],t.previousPosition.x-a[0])),s=Do(Math.atan2(n.y-a[1],n.x-a[0]))-i;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let a=o.getFocalPoint();a=e.computeWorldToDisplay(n,a[0],a[1],a[2]);const i=a[2],s=e.computeDisplayToWorld(n,r.x,r.y,i),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,i),c=[];c[0]=l[0]-s[0],c[1]=l[1]-s[1],c[2]=l[2]-s[2],a=o.getFocalPoint();const u=o.getPosition();o.setFocalPoint(c[0]+a[0],c[1]+a[1],c[2]+a[2]),o.setPosition(c[0]+u[0],c[1]+u[1],c[2]+u[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,a=t._interactor.getView().getViewportCenter(n),i=t.motionFactor*o/a[1];e.dollyByFactor(n,1.1**i)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const jT={motionFactor:10,zoomFactor:10};function KT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jT,n),WT.extend(e,t,n),jt.setGet(e,t,["motionFactor","zoomFactor"]),HT(e,t)}var $T={newInstance:jt.newInstance(KT,"vtkInteractorStyleTrackballCamera"),extend:KT};function qT(e){return e}function XT(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>XT(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var YT=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?XT:qT,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n};function ZT(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${jt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}const QT={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function JT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,QT,n),jt.obj(e,t),jt.get(e,t,["currentOperation"]),jt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),jt.moveToProtected(e,t,["currentParent"]),ZT(e,t)}var eC={newInstance:jt.newInstance(JT,"vtkRenderPass"),extend:JT};const{Representation:tC}=xs,{vtkErrorMacro:nC}=jt;function rC(e){const t=xd.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function oC(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Us.newInstance({numberOfComponents:3,values:e});o.setName("points");const a=Us.newInstance({numberOfComponents:2,values:n});a.setName("tcoords");const i=Us.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",tC.SURFACE,{points:o,tcoords:a,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=nf.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=$d.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=$d.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=$d.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||nC("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||nC("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const a=n.getSize(),i=n.getContext();if(t._supported=!1,r.getSelector()||!i||!n.getWebgl2()||!i.getExtension("EXT_color_buffer_half_float")&&!i.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==a[0]||r[1]!==a[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}i.drawBuffers([i.COLOR_ATTACHMENT0]),i.clearBufferfv(i.COLOR,0,[0,0,0,0]),i.clearBufferfv(i.DEPTH,0,[1]),i.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),i.colorMask(!0,!0,!0,!0),i.drawBuffers([i.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1]),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),i.clearBufferfv(i.COLOR,0,[0,0,0,1]),i.clearBufferfv(i.COLOR,1,[0,0,0,0]),i.enable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFuncSeparate(i.ONE,i.ONE,i.ZERO,i.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),i.drawBuffers([i.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ad.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?rC:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const aC={framebuffer:null,copyShader:null,tris:null};function iC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,aC,n),eC.extend(e,t,n),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Md.newInstance(),jt.get(e,t,["framebuffer"]),oC(e,t)}var sC={newInstance:jt.newInstance(iC,"vtkOpenGLOrderIndependentTranslucentPass"),extend:iC};function lC(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=nf.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),i.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),i.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),i.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=sC.newInstance()),t.translucentPass.traverse(n,i,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),i.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),i.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const cC={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function uC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cC,n),eC.extend(e,t,n),jt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),lC(e,t)}var dC={newInstance:jt.newInstance(uC,"vtkForwardPass"),extend:uC},pC=n(594),fC=n.n(pC);const gC=["lastShaderProgramBound","context","_openGLRenderWindow"];function mC(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=xd.substitute(o,"VSOut","GSOut").result);const a=t._openGLRenderWindow.getWebgl2();let i="\n",s="#version 100\n";a?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(i="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(i+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=xd.substitute(o,"//VTK::System::Dec",[`${s}\n`,a?"":"#extension GL_OES_standard_derivatives : enable\n",i,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=xd.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(a){l=xd.substitute(l,"varying","out").result,o=xd.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=xd.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=xd.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:xd.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),a=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(a)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,a=fC().hash(o);if(!(a in t.shaderPrograms)){const o=xd.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(a),t.shaderPrograms[a]=o,o}return t.shaderPrograms[a]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const hC={lastShaderProgramBound:null,shaderPrograms:null,context:null};function vC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hC,n),t.shaderPrograms={},jt.obj(e,t),jt.setGet(e,t,gC),jt.moveToProtected(e,t,["openGLRenderWindow"]),mC(e,t)}var yC={newInstance:jt.newInstance(vC,"vtkShaderCache"),extend:vC};const{vtkErrorMacro:bC}=jt;function xC(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TC,n),jt.obj(e,t),t.textureUnits=[],jt.get(e,t,["numberOfTextureUnits"]),jt.setGet(e,t,["context"]),xC(e,t)}var SC={newInstance:jt.newInstance(CC,"vtkOpenGLTextureUnitManager"),extend:CC};function AC(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),a=e.getFramebufferSize();return o[0]*a[0]<=t&&o[2]*a[0]>=t&&o[1]*a[1]<=n&&o[3]*a[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const a=o.worldToView(t,n,r),i=e.getViewportSize(o),s=o.viewToProjection(a[0],a[1],a[2],i[0]/i[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const a=e.displayToNormalizedDisplay(t,n,r),i=o.normalizedDisplayToProjection(a[0],a[1],a[2]),s=e.getViewportSize(o),l=o.projectionToView(i[0],i[1],i[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=e.normalizedDisplayToDisplay(t,n,r);return[i[0]-a[0]-.5,i[1]-a[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return a&&0!==a[0]&&0!==a[1]?[t/(a[0]-1),n/(a[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return[t*(a[0]-1),n*(a[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=t+a[0]+.5,s=n+a[1]+.5;return e.displayToNormalizedDisplay(i,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{jt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{jt.vtkErrorMacro("not implemented")},e.createSelector=()=>{jt.vtkErrorMacro("not implemented")}}const PC={size:void 0,selector:void 0};function IC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,PC,n),t.size||(t.size=[300,300]),jt.getArray(e,t,["size"],2),jt.get(e,t,["selector"]),Zt.extend(e,t,n),AC(e,t)}var wC={newInstance:jt.newInstance(IC,"vtkRenderWindowViewNode"),extend:IC};const{vtkDebugMacro:OC,vtkErrorMacro:MC}=jt,RC={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function VC(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),a===e.FRAMEBUFFER_COMPLETE}let EC=0;const DC=[];function LC(){EC++,DC.forEach((e=>e(EC)))}function BC(){EC--,DC.forEach((e=>e(EC)))}function NC(e){e.preventDefault()}function kC(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(a=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(a,r[0]),t.apply(n,r))}));var a},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const a=n[t];return a?a(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",NC,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=SC.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&MC("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const a=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,a),a},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,OC("using webgl2"))),r||(OC("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=eC.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?MC("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case ws.CHAR:case ws.SIGNED_CHAR:case ws.UNSIGNED_CHAR:return 1;case n:case r:case ws.UNSIGNED_SHORT:case ws.SHORT:case ws.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case ws.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&ws.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&ws.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=RC,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),a=n.getExtension("WEBGL_debug_renderer_info"),i=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&VC(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&VC(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&VC(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&VC(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&VC(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&VC(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&VC(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&VC(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&VC(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&VC(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&VC(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&VC(n,n.RGB,n.FLOAT)?"RGB":"",r&&VC(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&VC(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&VC(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",i?n.getParameter(i.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",a&&n.getParameter(a.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",a&&n.getParameter(a.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],c={};for(;l.length;){const[e,t,n]=l.pop();t&&(c[t]={label:e,value:n})}return t._glInformation=c,c},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const a=t.canvas.getBoundingClientRect(),i=t.renderable;i.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=Sf.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=jt.chain((function(){t.canvas.removeEventListener("webglcontextlost",NC),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,BC),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const a=e.setSize;e.setSize=(t,n)=>{const r=a(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const FC={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const _C=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FC,n),wC.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",LC(),t.selector||(t.selector=Sf.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=ln.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",_C),t.shaderCache=yC.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=dC.newInstance(),jt.event(e,t,"imageReady"),jt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),jt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),kC(e,t)}),"vtkOpenGLRenderWindow");aT("WebGL",_C);const GC=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function UC(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),a=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==a&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${a}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,WC,n),yt(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],xt(e,t,["boundPipeline","colorTextureViews"]),At(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),UC(e,t)}var HC={newInstance:Et(zC,"vtkWebGPURenderEncoder"),extend:zC};function jC(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=Dy.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=Dy.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(a)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=HC.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const KC={renderEncoder:null,colorTexture:null,depthTexture:null};function $C(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,KC,n),eC.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),jC(e,t)}var qC={newInstance:jt.newInstance($C,"vtkWebGPUOpaquePass"),extend:$C};function XC(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=Dy.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=Dy.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const a=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,a),t.fullScreenQuad=kh.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=HC.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=HC.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const YC={colorTextureView:null,depthTextureView:null};function ZC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,YC,n),eC.extend(e,t,n),jt.setGet(e,t,["colorTextureView","depthTextureView"]),XC(e,t)}var QC={newInstance:jt.newInstance(ZC,"vtkWebGPUOrderIndependentTranslucentPass"),extend:ZC};const JC="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",eS=new Float64Array(16),tS=new Float64Array(16);function nS(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();const i=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));a=ih.substitute(a,"//VTK::Volume::CompositeCalls",i).result,a=ih.substitute(a,"//VTK::Volume::TraverseCalls",s).result,a=ih.substitute(a,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",a),t.SSBO.setAllInstancesFromArray("planeNormals",i),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",c),t.SSBO.setAllInstancesFromArray("ipScalarRange",u),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),f=new Float64Array(t.numRows),v=new Float64Array(t.numRows),y=new Float64Array(t.numRows),C=new Float64Array(t.numRows),S=new Float64Array(t.numRows),A=new Float64Array(t.numRows);let P=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const rS={volumes:null,rowLength:1024,lastVolumeLength:0};function oS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rS,n),kh.extend(e,t,n),t.fragmentShaderTemplate=JC,t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=bv.newInstance({label:"volumeSSBO"}),t.componentSSBO=bv.newInstance({label:"componentSSBO"}),t.lutBuildTime={},jt.obj(t.lutBuildTime,{mtime:0}),nS(e,t)}var aS={newInstance:jt.newInstance(oS,"vtkWebGPUVolumePassFSQ"),extend:oS};const{Representation:iS}=xs,{BufferUsage:sS,PrimitiveTypes:lS}=fv,cS=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],uS="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function dS(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=aS.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=kh.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=Pv.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),a=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>a){const o=n.getRenderable().getActiveCamera().getPosition(),i=[];for(let e=0;ei[t]-i[e]));let l=[],c=s.length%a;for(let o=0;o=c&&(e.rayCastPass(r,n,l),l=[],c=a,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=jt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let a=t._colorTextureView.getTexture().getWidth(),i=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),a=t._smallViewportWidth,i=t._smallViewportHeight}o.getHandle().setViewport(0,0,a,i,0,1),o.getHandle().setScissorRect(0,0,a,i),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,a=o.getPoints(),i=o.getPolys();let s={hash:`vp${i.getMTime()}`,usage:sS.Index,cells:i,numberOfPoints:a.getNumberOfPoints(),primitiveType:lS.Triangles,representation:iS.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:sS.PointArray,format:"float32x4",hash:`vp${a.getMTime()}${i.getMTime()}`,dataArray:a,indexBuffer:l,packExtra:!0};const c=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(c,["vertexBC"]),t._mapper.setNumberOfVertices(c.getSizeInBytes()/c.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=HC.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=Dy.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=Dy.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=Dy.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=HC.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=HC.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=HC.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pS,n),eC.extend(e,t,n),t._mapper=Dh.newInstance(),t._mapper.setFragmentShaderTemplate(uS),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=Pu.newInstance(),t._lastMTimes=[],jt.setGet(e,t,["colorTextureView","depthTextureView"]),dS(e,t)}var gS={newInstance:jt.newInstance(fS,"vtkWebGPUVolumePass"),extend:fS};function mS(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=qC.newInstance());const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=QC.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(i,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=gS.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(i,n)),e.finalPass(n,i))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=HC.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=Ay.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=kh.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Oy.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const hS={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function vS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hS,n),eC.extend(e,t,n),jt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),mS(e,t)}var yS={newInstance:jt.newInstance(vS,"vtkForwardPass"),extend:vS};const{VtkDataTypes:bS}=Us;function xS(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case bS.UNSIGNED_CHAR:e.format+="8unorm";break;case bS.FLOAT:case bS.UNSIGNED_INT:case bS.INT:case bS.DOUBLE:case bS.UNSIGNED_SHORT:case bS.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=Dy.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const TS={handle:null,device:null};function CS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TS,n),jt.obj(e,t),jt.setGet(e,t,["device"]),xS(e,t)}var SS={newInstance:jt.newInstance(CS),extend:CS};class AS extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function PS(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IS,n),yt(e,t),At(e,t,["handle"]),xt(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new AS,t.shaderCache=ih.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=fv.newInstance(),t.bufferManager.setDevice(e),t.textureManager=SS.newInstance(),t.textureManager.setDevice(e),t.pipelines={},PS(e,t)}var OS={newInstance:Et(wS,"vtkWebGPUDevice"),extend:wS};function MS(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=Dy.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=Dy.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(a)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=HC.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const RS={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function VS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,RS,n),eC.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),MS(e,t)}var ES={newInstance:jt.newInstance(VS,"vtkWebGPUHardwareSelectionPass"),extend:VS};const{SelectionContent:DS,SelectionField:LS}=sf,{FieldAssociations:BS}=gl,{vtkErrorMacro:NS}=jt;function kS(e){return`${e.propID} ${e.compositeID}`}function FS(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function _S(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=FS(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let a=FS(t[0],t[1],e,1);if((a<0||a>16777215)&&(a=0),o.compositeID=a,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const a=[t[0],t[1]],i=[0,0];let s=_S(e,t,0,r);if(s)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=_S(e,i,0,r),s))return s;if(i[0]=a[0]+t,s=_S(e,i,0,r),s)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=_S(e,i,0,r),s))return s;if(i[1]=a[1]+t,s=_S(e,i,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function GS(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return NS("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),a=t._selectionPass.getColorTexture(),i=t._selectionPass.getDepthTexture(),s={area:[0,0,a.getWidth()-1,a.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:a.getWidth(),height:a.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=zh.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const c=t._WebGPURenderWindow.getCommandEncoder();let u;c.copyTextureToBuffer({texture:a.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),u=zh.newInstance({label:"hardwareSelectDepthBuffer"}),u.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,u.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),c.copyTextureToBuffer({texture:i.getHandle(),aspect:"depth-only"},{buffer:u.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(c);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=u.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(u.getMappedRange().slice()),u.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=_S(e,[n,t],0,u);if(r){const t=kS(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const i=sf.newInstance();switch(i.setContentType(DS.INDICES),e){case BS.FIELD_ASSOCIATION_CELLS:i.setFieldType(LS.CELL);break;case BS.FIELD_ASSOCIATION_POINTS:i.setFieldType(LS.POINT);break;default:NS("Unknown field association")}i.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);i.getProperties().prop=s.getRenderable(),i.getProperties().compositeID=t.info.compositeID,i.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(i.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],i.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),i.setSelectionList(t.attributeIDs),r[o]=i,o++})),r}(e.fieldAssociation,c,e)}(s,e,t,n,r),s}}const US={};function WS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,US,n),Qp.extend(e,t,n),t._selectionPass=ES.newInstance(),jt.setGet(e,t,["_WebGPURenderWindow"]),jt.moveToProtected(e,t,["WebGPURenderWindow"]),GS(e,t)}var zS={newInstance:jt.newInstance(WS,"vtkWebGPUHardwareSelector"),extend:WS};const{vtkErrorMacro:HS}=jt,jS={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function KS(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void HS("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&HS("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=OS.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=eC.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=jS,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const a=await e.getPixelsAsync(),i=new ImageData(a.colorValues,a.width,a.height);o.putImageData(i,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=zh.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const a=t.device.createCommandEncoder();a.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(a);const i=o.mapAsync(GPUMapMode.READ);await i,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=zS.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=jt.chain(e.delete,e.setViewStream)}const $S={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const qS=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$S,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",wC.extend(e,t,n),t.myFactory=jm.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",qS),t.renderPasses[0]=yS.newInstance(),t.selector||(t.selector=zS.newInstance(),t.selector.setWebGPURenderWindow(e)),jt.event(e,t,"imageReady"),jt.event(e,t,"initialized"),jt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),jt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),KS(e,t)}),"vtkWebGPURenderWindow");aT("WebGPU",qS);const XS=YT(),YS={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},ZS={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function QS(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function JS(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),QS(t.container,t.containerStyle||YS),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=uT.newInstance(),t.renderer=rT.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(XS.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=OT.newInstance(),t.interactor.setInteractorStyle($T.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),QS(t.controlContainer,t.controlPanelStyle||ZS),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=jt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const eA={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function tA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eA,n),jt.obj(e,t),jt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),JS(e,t)}var nA={newInstance:jt.newInstance(tA),extend:tA};function rA(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>iA({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const oA={name:"",numberOfComponents:1,size:0,dataType:"string"};function aA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,oA,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),jt.obj(e,t),jt.set(e,t,["name"]),rA(e,t)}const iA=jt.newInstance(aA,"vtkStringArray");var sA={newInstance:iA,extend:aA};const{vtkErrorMacro:lA,vtkDebugMacro:cA}=jt,uA=()=>(lA("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let dA=0;function pA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const fA={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?uA():n.ref&&!n.ref.pending?new Promise(((o,a)=>{const i=pA("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);i.onreadystatechange=t=>{1===i.readyState&&(n.ref.pending=!0,1==++dA&&e?.invokeBusy&&e.invokeBusy(!0)),4===i.readyState&&(n.ref.pending=!1,200===i.status||0===i.status?(n.buffer=i.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Yb!==n.ref.encode&&Yb&&(cA(`Swap bytes of ${n.name}`),Zb(n.buffer,Is[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&lA(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:i,e:t}))},i.responseType="string"!==n.dataType?"arraybuffer":"text",i.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?uA():new Promise(((r,o)=>{const a=pA("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++dA&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?uA():new Promise(((r,o)=>{const a=pA("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++dA&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(a.responseText):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=pA("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Jb("http")||ex("http",(e=>fA));const gA=["pointData","cellData","fieldData"],mA={vtkDataArray:Us,vtkStringArray:sA},hA={},vA={vtkPolyData(e){const t=[];return t.push(e.points),["verts","lines","polys","strips"].forEach((n=>{e[n]&&t.push(e[n])})),t},vtkImageData:e=>[],vtkUnstructuredGrid(e){const t=[];return t.push(e.points),t.push(e.cells),t.push(e.cellTypes),t},vtkRectilinearGrid(e){const t=[];return t.push(e.xCoordinates),t.push(e.yCoordinates),t.push(e.zCoordinates),t}};function yA(e,t){function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=`${n.ref.id}|${n.vtkClass}`;return hA[o]?Promise.resolve(hA[o]).then((e=>{n!==e&&(Object.assign(n,e),delete n.ref)})):hA[o]=t.dataAccessHelper.fetchArray(e,t.baseURL,n,r).then((e=>(hA[o]=e,e))),Promise.resolve(hA[o])}t.classHierarchy.push("vtkHttpDataSetReader"),t.output[0]=ze({vtkClass:"vtkPolyData"}),t.dataAccessHelper||(t.dataAccessHelper=tx("http")),e.updateMetadata=function(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"zip"===t.compression?new Promise(((r,o)=>{tx("http").fetchBinary(t.url).then((a=>{t.dataAccessHelper=tx("zip",{zipContent:a,callback:a=>{t.baseURL="",t.dataAccessHelper.fetchJSON(e,"index.json").then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}})}),(e=>{o(e)}))})):new Promise(((r,o)=>{t.dataAccessHelper.fetchJSON(e,t.url).then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}))},e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf("index.json")||r.fullpath){t.url=n;const e=n.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=n,t.url=`${n}/index.json`;return t.compression=r.compression,e.updateMetadata(!!r.loadData)},e.parseObject=(r,o)=>{let{loadData:a,baseUrl:i,deepCopy:s=!0}=o;i&&(t.baseURL=i);const l=s?structuredClone(r):r;return new Promise(((r,o)=>{!function(e,t,n,r,o,a,i){const s=t.enableArray;t.arrays=[],gA.forEach((e=>{n[e]&&(n[e].arrays.map((e=>e.data)).forEach((n=>{t.arrays.push({name:n.name,enable:s,location:e,array:n,registration:n.ref.registration||"addArray"})})),n[e].arrays=[])}));const l=[],{progressCallback:c}=t,u=t.fetchGzip?"gz":null;function d(){t.dataset=ze(n),i?e.loadData().then((()=>{t.output[0]=t.dataset,o(e,t.output[0])})):(t.output[0]=t.dataset,o(e,t.output[0]))}vA[n.vtkClass](n).forEach((e=>{l.push(r(e,{compression:u,progressCallback:c}))})),l.length?Promise.all(l).then(d,(e=>{a(e)})):d()}(e,t,l,n,r,o,a)}))},e.loadData=()=>{const r=t.dataset,o=t.arrays.filter((e=>e.enable)).filter((e=>e.array.ref)).map((e=>e.array));return new Promise(((a,i)=>{const s=e=>{i(e)},l=()=>{if(o.length){const{progressCallback:e}=t,r=t.fetchGzip?"gz":null;n(o.pop(),{compression:r,progressCallback:e}).then(l,s)}else r&&(t.arrays.filter((e=>e.registration&&!e.array.ref)).forEach((e=>{const t=mA[e.array.vtkClass].newInstance(e.array);r[`get${jt.capitalize(e.location)}`]()[e.registration](t),delete e.registration})),r.modified(),a(e,r))};l()}))},e.requestData=(e,t)=>{},e.enableArray=function(e,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.arrays.filter((t=>t.name===n&&t.location===e));1===o.length&&(o[0].enable=r)},e.isBusy=()=>!!t.requestCount}const bA={enableArray:!0,fetchGzip:!1,arrays:[],url:null,baseURL:null,requestCount:0};function xA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bA,n),jt.obj(e,t),jt.get(e,t,["enableArray","fetchGzip","url","baseURL","dataAccessHelper"]),jt.set(e,t,["dataAccessHelper","progressCallback"]),jt.getArray(e,t,["arrays"]),jt.algo(e,t,0,1),jt.event(e,t,"busy"),yA(e,t),void 0===t.progressCallback&&(t.progressCallback=null)}var TA={newInstance:jt.newInstance(xA,"vtkHttpDataSetReader"),extend:xA};function CA(e,t){t.classHierarchy.push("vtkAbstractImageMapper"),e.getIsOpaque=()=>!0,e.getCurrentImage=()=>null,e.getBoundsForSlice=()=>(jt.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),_a())}const SA={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1]};var AA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,SA,n),$s(e,t,n),jt.setGet(e,t,["slice","useCustomExtents"]),jt.setGetArray(e,t,["customDisplayExtent"],6),jt.setGetArray(e,t,["backgroundColor"],4),CA(e,t)};function PA(e,t){t.classHierarchy.push("vtkPolyLine");const n=su.newInstance();n.getPoints().setNumberOfPoints(2),e.getCellDimension=()=>1,e.intersectWithLine=(r,o,a,i,s,l,c)=>{const u={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null},d=e.getNumberOfPoints()-1;let p=Number.MAX_VALUE;for(let e=0;e=r&&f.t<=o){u.intersect=1;const t=n.getParametricDistance(d);(t(n.getPoints().getData().set(t.points.getData().subarray(3*e,3*(e+2))),n.evaluateLocation(r,o,a)),e.evaluateOrientation=(e,r,o,a)=>(t.orientations?n.setOrientations([t.orientations[e],t.orientations[e+1]]):n.setOrientations(null),n.evaluateOrientation(r,o,a)),e.getDistancesToFirstPoint=()=>{const n=t.distancesTime.getMTime();if(n0){const e=new Array(3),a=new Array(3);let i=0;t.distances[0]=i,t.points.getPoint(0,e);for(let s=1;s{const n=e.getDistancesToFirstPoint();if(n.length<2)return-1;let r=0,o=n.length-1;if(tn[o]||0===n[o])return-1;for(;o-r>1;){const e=Math.floor((r+o)/2);n[e]<=t?r=e:o=e}return r}}const IA={orientations:null,distanceFunction:Gn};function wA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IA,n),Rc.extend(e,t,n),jt.setGet(e,t,["orientations","distanceFunction"]),t.distancesTime={},jt.obj(t.distancesTime,{mtime:0}),PA(e,t)}var OA={newInstance:jt.newInstance(wA,"vtkPolyLine"),extend:wA};const{vtkErrorMacro:MA}=jt,{staticOffsetAPI:RA,otherStaticMethods:VA}=Ql;function EA(e,t){t.classHierarchy.push("vtkImageCPRMapper");const n={...e};e.getBounds=()=>[0,e.getWidth(),0,e.getHeight(),0,0],e.getOrientationDataArray=()=>{const n=e.getInputData(1)?.getPointData();return n?null!==t.orientationArrayName?n.getArrayByName(t.orientationArrayName)||null:n.getArrayByName("Orientation")||n.getArrayByName("Direction")||n.getVectors()||n.getTensors()||n.getNormals()||null:null},e.getOrientedCenterline=()=>{const n=e.getInputData(1);if(!n)return t._orientedCenterline;const r=e.getOrientationDataArray(),o=n.getLines(),a=n.getPoints();if(!t.useUniformOrientation&&!r)return MA("Failed to create oriented centerline from polydata: no orientation"),e._resetOrientedCenterline(),t._orientedCenterline;const i=t._orientedCenterline.getMTime();if(i>=e.getMTime()&&i>o.getMTime()&&i>a.getMTime()&&(t.useUniformOrientation||i>r.getMTime()))return t._orientedCenterline;const s=o.getData();if(s.length<=0)return e._resetOrientedCenterline(),t._orientedCenterline;const l=s[0];if(l<=1)return e._resetOrientedCenterline(),t._orientedCenterline;const c=s.subarray(1,1+l),u=new Array(l);let d=()=>null;switch(t.useUniformOrientation?t.uniformOrientation.length:r.getNumberOfComponents()){case 16:d=N;break;case 9:d=(e,t)=>{(function(e,t){var n,r=t[0]+t[4]+t[8];if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var o=0;t[4]>t[0]&&(o=1),t[8]>t[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;n=Math.sqrt(t[3*o+o]-t[3*a+a]-t[3*i+i]+1),e[o]=.5*n,n=.5/n,e[3]=(t[3*a+i]-t[3*i+a])*n,e[a]=(t[3*a+o]+t[3*o+a])*n,e[i]=(t[3*i+o]+t[3*o+i])*n}})(e,t),Qi(e,e)};break;case 4:d=Zi;break;case 3:d=(e,n)=>Ji(e,t.tangentDirection,n);break;default:return MA("Orientation doesnt match mat4, mat3, quat or vec3"),e._resetOrientedCenterline(),t._orientedCenterline}let p=()=>null;if(t.useUniformOrientation){const e=new Float64Array(4);d(e,t.uniformOrientation),p=()=>e}else{const e=new Float64Array(16);p=t=>{const n=new Float64Array(4);return r.getTuple(t,e),d(n,e),n}}for(let e=0;et._orientedCenterline!==e&&(t._orientedCenterline=e,!0),e._resetOrientedCenterline=()=>{t._orientedCenterline.initialize(Ic.newInstance()),t._orientedCenterline.setOrientations([])},e.getMTime=()=>{let e=n.getMTime();return t._orientedCenterline?(e=Math.max(e,t._orientedCenterline.getMTime()),e):e},e.getHeight=()=>{const t=e.getOrientedCenterline().getDistancesToFirstPoint();return 0===t.length?0:t[t.length-1]},e.getCenterlinePositionAndOrientation=t=>{const n=e.getOrientedCenterline(),r=n.findPointIdAtDistanceFromFirstPoint(t);if(r<0)return{};const o=n.getDistancesToFirstPoint(),a=[(t-o[r])/(o[r+1]-o[r])],i=new Array(2),s=new Array(3);n.evaluateLocation(r,a,s,i);const l=new Array(4);return n.evaluateOrientation(r,a,l,i)?{position:s,orientation:l}:{position:s}},e.getCenterlineTangentDirections=()=>{const n=e.getOrientedCenterline();if(t._centerlineTangentDirectionsTime.getMTime()Nn(new Array(3),t.tangentDirection,t.uniformOrientation),e.getDirectionMatrix=()=>{const e=t.tangentDirection,n=t.bitangentDirection,r=t.normalDirection;return new Float64Array([e[0],e[1],e[2],n[0],n[1],n[2],r[0],r[1],r[2]])},e.setDirectionMatrix=n=>!re(n,e.getDirectionMatrix())&&(t.tangentDirection=[n[0],n[1],n[2]],t.bitangentDirection=[n[3],n[4],n[5]],t.normalDirection=[n[6],n[7],n[8]],e.modified(),!0),e.preRenderCheck=()=>!!e.getInputData(0)||(MA("No image data input"),!1),e.useStraightenedMode=()=>{e.setCenterPoint(null),e.setUseUniformOrientation(!1),e.getOrientedCenterline().setDistanceFunction(Gn)},e.useStretchedMode=t=>{const n=e.getOrientedCenterline();if(t)e.setCenterPoint(t);else{const t=n.getPoints(),r=t.getNumberOfTuples()>0?t.getPoint(0):[0,0,0];e.setCenterPoint(r)}e.setUseUniformOrientation(!0),n.setDistanceFunction(((t,n)=>{const r=e.getUniformDirection(),o=wn([],t,n),a=function(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}(o),i=En(r,o);return Math.sqrt(a-i*i)}))},e.setCenterlineData=t=>e.setInputData(t,1),e.setCenterlineConnection=t=>e.setInputConnection(t,1),e.setImageData=t=>e.setInputData(t,0),e.setImageConnection=t=>e.setInputConnection(t,0),e.getIsOpaque=()=>!0,t._orientedCenterline=OA.newInstance(),e._resetOrientedCenterline()}const DA={width:10,uniformOrientation:[0,0,0,1],useUniformOrientation:!1,centerPoint:null,preferSizeOverAccuracy:!1,orientationArrayName:null,tangentDirection:[1,0,0],bitangentDirection:[0,1,0],normalDirection:[0,0,1]};function LA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DA,n),AA(e,t,n),jt.algo(e,t,2,0),t._centerlineTangentDirectionsTime={},jt.obj(t._centerlineTangentDirectionsTime,{mtime:0}),jt.setGet(e,t,["width","uniformOrientation","useUniformOrientation","centerPoint","preferSizeOverAccuracy","orientationArrayName","tangentDirection","bitangentDirection","normalDirection"]),Ql.implementCoincidentTopologyMethods(e,t),EA(e,t)}var BA={newInstance:jt.newInstance(LA,"vtkImageCPRMapper"),extend:LA,...RA,...VA};function NA(e,t,n){const r=n.getCurrentImage(),o=r.getExtent(),a=[o[0],o[2],o[4]],{ijkMode:i}=n.getClosestIJKAxis();let s=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();i!==n.getSlicingMode()&&(s=n.getSliceAtPosition(s)),a[i]+=s;const l=[0,0,0];r.indexToWorld(a,l),a[i]+=1;const c=[0,0,0];r.indexToWorld(a,c),c[0]-=l[0],c[1]-=l[1],c[2]-=l[2],Vn(c,c);const u=ri.intersectWithLine(e,t,l,c);if(u.intersection){const e=u.x,t=[0,0,0];return r.worldToIndex(e,t),{t:u.t,absoluteIJK:t}}return null}const{staticOffsetAPI:kA,otherStaticMethods:FA}=Ql,{SlicingMode:_A}=bg;function GA(e,t){function n(){let n;switch(t.slicingMode){case _A.X:n=0;break;case _A.Y:n=1;break;case _A.Z:n=2;break;default:return void(t.closestIJKAxis={ijkMode:t.slicingMode,flip:!1})}const r=Ga(e.getCurrentImage().getDirection());let o=0;for(;o<3&&0===r[n+3*o];++o);const a=r[n+3*o]<0;t.closestIJKAxis={ijkMode:o,flip:a}}t.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=n=>{const r=e.getCurrentImage();let o;if(3===n.length)o=n;else if(Number.isFinite(n)){const e=r.getBounds();switch(t.slicingMode){case _A.X:o=[n,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case _A.Y:o=[(e[1]+e[0])/2,n,(e[5]+e[4])/2];break;case _A.Z:o=[(e[1]+e[0])/2,(e[3]+e[2])/2,n]}}const a=[0,0,0];r.worldToIndex(o,a);const i=r.getExtent(),{ijkMode:s}=e.getClosestIJKAxis();let l=0;switch(s){case _A.I:l=Ea(a[0],i[0],i[1]);break;case _A.J:l=Ea(a[1],i[2],i[3]);break;case _A.K:l=Ea(a[2],i[4],i[5]);break;default:return 0}return l},e.setSliceFromCamera=n=>{const r=n.getFocalPoint();switch(t.slicingMode){case _A.I:case _A.J:case _A.K:{const t=e.getSliceAtPosition(r);e.setSlice(t)}break;case _A.X:e.setSlice(r[0]);break;case _A.Y:e.setSlice(r[1]);break;case _A.Z:e.setSlice(r[2])}},e.setXSlice=t=>{e.setSlicingMode(_A.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(_A.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(_A.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(_A.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(_A.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(_A.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{const n=[0,0,0],r=e.getCurrentImage().getDirection();switch(t.slicingMode){case _A.X:n[0]=1;break;case _A.Y:n[1]=1;break;case _A.Z:n[2]=1;break;case _A.I:aa(r,[1,0,0],n);break;case _A.J:aa(r,[0,1,0],n);break;case _A.K:aa(r,[0,0,1],n)}return n},e.setSlicingMode=r=>{t.slicingMode!==r&&(t.slicingMode=r,e.getCurrentImage()&&n(),e.modified())},e.getClosestIJKAxis=()=>(void 0!==t.closestIJKAxis&&t.closestIJKAxis.ijkMode!==_A.NONE||!e.getCurrentImage()||n(),t.closestIJKAxis),e.getBounds=()=>{const n=e.getCurrentImage();if(!n)return _a();if(!t.useCustomExtents)return n.getBounds();const r=t.customDisplayExtent.slice(),{ijkMode:o}=e.getClosestIJKAxis();let a=t.slice;switch(o!==t.slicingMode&&(a=e.getSliceAtPosition(t.slice)),o){case _A.I:r[0]=a,r[1]=a;break;case _A.J:r[2]=a,r[3]=a;break;case _A.K:r[4]=a,r[5]=a}return n.extentToBounds(r)},e.getBoundsForSlice=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slice,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.getCurrentImage();if(!o)return _a();const a=o.getSpatialExtent(),{ijkMode:i}=e.getClosestIJKAxis();let s=n;switch(i!==t.slicingMode&&(s=e.getSliceAtPosition(n)),i){case _A.I:a[0]=s-r,a[1]=s+r;break;case _A.J:a[2]=s-r,a[3]=s+r;break;case _A.K:a[4]=s-r,a[5]=s+r}return o.extentToBounds(a)},e.intersectWithLineForPointPicking=(t,n)=>function(e,t,n){const r=NA(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return t[0]e[1]||t[1]e[3]||t[2]e[5]?null:{t:r.t,ijk:t}}return null}(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>function(e,t,n){const r=NA(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=r.absoluteIJK,o=[Math.floor(t[0]),Math.floor(t[1]),Math.floor(t[2])];if(o[0]e[1]-1||o[1]e[3]-1||o[2](e[5]?e[5]-1:e[5]))return null;const a=[t[0]-o[0],t[1]-o[1],t[2]-o[2]];return{t:r.t,ijk:o,pCoords:a}}return null}(t,n,e),e.getCurrentImage=()=>e.getInputData()}const UA={slicingMode:_A.NONE,closestIJKAxis:{ijkMode:_A.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function WA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UA,n),AA(e,t,n),jt.get(e,t,["slicingMode"]),jt.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),Ql.implementCoincidentTopologyMethods(e,t),GA(e,t)}var zA={newInstance:jt.newInstance(WA,"vtkImageMapper"),extend:WA,...kA,...FA,...bg};const HA={CLAMP:0,REPEAT:1,MIRROR:2},jA={NEAREST:0,LINEAR:1,CUBIC:2};var KA={ImageBorderMode:HA,InterpolationMode:jA};const $A={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:HA.CLAMP,interpolationMode:jA.LINEAR,extraInfo:null},qA={...$A,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function XA(e){const t=Math.floor(e);return{floored:t,error:e-t}}function YA(e){return Math.round(e)}function ZA(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function QA(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function JA(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let a=e-t;return a=a>=0?a:-a,a%=o,a=a<=r?a:o-a,a}const{ImageBorderMode:eP}=KA;function tP(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,a=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,a)}const i=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*i,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let c=t.componentOffset;c=c>0?c:0,c=c{},e.interpolateXYZ=(n,r,o,a)=>{let i=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=a>0?a:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,a)=>{}}const nP={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:eP.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...$A},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function rP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nP,n),jt.obj(e,t),jt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),jt.get(e,t,["origin","spacing"]),tP(e,t)}var oP={newInstance:jt.newInstance(rP,"vtkAbstractImageInterpolator"),extend:rP,...KA};function aP(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===jA.LINEAR?n=2:t.interpolationMode===jA.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,a=e.numberOfComponents;let i=YA(t[0]),s=YA(t[1]),l=YA(t[2]);switch(e.borderMode){case HA.REPEAT:i=QA(i,r[0],r[1]),s=QA(s,r[2],r[3]),l=QA(l,r[4],r[5]);break;case HA.MIRROR:i=JA(i,r[0],r[1]),s=JA(s,r[2],r[3]),l=JA(l,r[4],r[5]);break;default:i=ZA(i,r[0],r[1]),s=ZA(s,r[2],r[3]),l=ZA(l,r[4],r[5])}const c=i*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,a=e.numberOfComponents,i=XA(t[0]),s=XA(t[1]),l=XA(t[2]);let c=i.floored,u=s.floored,d=l.floored;const p=i.error,f=s.error,g=l.error;let m=c+(0!==p),h=u+(0!==f),v=d+(0!==g);switch(e.borderMode){case HA.REPEAT:c=QA(c,r[0],r[1]),u=QA(u,r[2],r[3]),d=QA(d,r[4],r[5]),m=QA(m,r[0],r[1]),h=QA(h,r[2],r[3]),v=QA(v,r[4],r[5]);break;case HA.MIRROR:c=JA(c,r[0],r[1]),u=JA(u,r[2],r[3]),d=JA(d,r[4],r[5]),m=JA(m,r[0],r[1]),h=JA(h,r[2],r[3]),v=JA(v,r[4],r[5]);break;default:c=ZA(c,r[0],r[1]),u=ZA(u,r[2],r[3]),d=ZA(d,r[4],r[5]),m=ZA(m,r[0],r[1]),h=ZA(h,r[2],r[3]),v=ZA(v,r[4],r[5])}const y=c*o[0],b=m*o[0],x=u*o[1],T=h*o[1],C=d*o[2],S=v*o[2],A=x+C,P=x+S,I=T+C,w=T+S,O=1-p,M=1-f,R=1-g,V=M*R,E=f*R,D=M*g,L=f*g,B=e.pointer;for(let e=0;e{switch(t.interpolationMode){case jA.LINEAR:e.interpolateLinear(n,r,o);break;case jA.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,a)=>{const i=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),c=e.pointer.subarray(s[0]+l[0]),u=e.numberOfComponents;for(let e=0;e{const i=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],c=t*i,u=n*s,d=r*l,p=e.weights[0].subarray(c),f=e.weights[1].subarray(u),g=e.weights[2].subarray(d),m=e.positions[0].subarray(c),h=e.positions[1].subarray(u),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=h.subarray(v[0]);let T=x,C=x,S=x,A=1,P=0,I=1,w=0;2===s&&(C=h[1].subarray(v[0]),S=C,A=f[0],P=f[1]),2===l&&(T=h[0].subarray(v[1]),S=T,I=g[0],w=g[1]),s+l===4&&(S=h[1].subarray(v[1]));const O=A*I,M=A*w,R=P*I,V=P*w;if(1===i)if(0===P&&0===w)for(let e=a;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],i=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],a=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case jA.LINEAR:e.interpolateRowLinear(n,r,o,a,i,s);break;case jA.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,a,i,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const a={...qA.newInstance(),...t.interpolationInfo};a.weightType="Float32Array";const i=a.interpolationMode;let s=!0;for(let l=0;l<3;++l){let c;for(c=0;c<3&&0===n[4*l+c];++c);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const u=a.extent[2*c],d=a.extent[2*c+1],p=t.structuredBounds[2*c],f=t.structuredBounds[2*c+1];let g=1;g=i1)if(i===jA.LINEAR)v[g*t+1-y]=T[1]*S,b[g*t-y]=1-h,b[g*t+1-y]=h;else if(i===jA.CUBIC){const n=e.vtkTricubicInterpWeights(h);if(4===g)for(let e=0;e<4;e++)v[g*t+e-y]=T[e]*S,b[g*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[T[t]-u]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const iP={interpolationMode:jA.NEAREST};function sP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iP,n),oP.extend(e,t,n),jt.setGet(e,t,["interpolationMode"]),aP(e,t)}var lP={newInstance:jt.newInstance(sP,"vtkImageInterpolator"),extend:sP};function cP(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const a=e.getExtent();let i=n;null==i&&(i=a);let s,l,c,u=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(i[e],a[e]),t.extent[e+1]=Math.min(i[e+1],a[e+1]),t.extent[e]>t.extent[e+1]&&(u=!0);if(t.rowIncrement=a[1]-a[0]+1,t.sliceIncrement=t.rowIncrement*(a[3]-a[2]+1),u){s=0,l=0,c=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=a[e],t.extent[e+1]=a[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,c=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-a[0]+(t.extent[2]-a[2])*t.rowIncrement+(t.extent[4]-a[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*c-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const a=t.extent[4]-e[4];a<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=a*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&a>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*c;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let a;for(a=0;ae);++a)n=!n;t.spanIndex=a,t.inStencil=n;let i=t.extent[1]+1;a{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const uP={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function dP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uP,n),jt.obj(e,t),jt.get(e,t,["id","index"]),cP(e,t)}var pP={newInstance:jt.newInstance(dP,"vtkImagePointDataIterator"),extend:dP},fP={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:gP}=fP,{vtkErrorMacro:mP}=jt;function hP(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=g(new Float64Array(16));let o=null;function a(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=g(new Float64Array(16))),ne(t.resliceAxes,n)?null:(d(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,a)=>{const i=n[0];if(!i)return void mP("Invalid or missing input");const s=i.getOrigin(),l=i.getSpacing(),c=i.getDimensions(),u=i.getPointData().getScalars(),d=[0,c[0]-1,0,c[1]-1,0,c[2]-1],p=[0,0,0],f=[1,1,1],m=[0,0,0,0,0,0],v=[0,0,0],y=g(new Float64Array(16));t.resliceAxes&&b(y,y,t.resliceAxes);const x=new Float64Array(16);h(x,y);const T=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let C=null;t.autoCropOutput&&(C=e.getAutoCroppedOutputBounds(i));for(let e=0;e<3;e++){let n=0,r=0,o=0,a=0;if(t.transformInputSampling){let t=0;for(let i=0;i<3;i++){a+=x[4*i+e]*(T[i]-y[12+i]);const s=y[4*e+i]*y[4*e+i];n+=s*Math.abs(l[i]),r+=s*(d[2*i+1]-d[2*i])*Math.abs(l[i]),o+=s*d[2*i],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else a=T[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?f[e]=n:f[e]=t.outputSpacing[e],e>=t.outputDimensionality?(m[2*e]=0,m[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=C[2*e+1]-C[2*e]),m[2*e]=Math.round(o),m[2*e+1]=Math.round(m[2*e]+Math.abs(r/f[e]))):(m[2*e]=t.outputExtent[2*e],m[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=C[2*e]-m[2*e]*f[e]:p[e]=a-.5*(m[2*e]+m[2*e+1])*f[e]:p[e]=t.outputOrigin[e],v[e]=m[2*e+1]-m[2*e]+1}let S=u.getDataType();t.outputScalarType&&(S=t.outputScalarType);const A=i.getPointData().getScalars().getNumberOfComponents(),P=jt.newTypedArray(S,v[0]*v[1]*v[2]*A),I=Us.newInstance({name:"Scalars",values:P,numberOfComponents:A}),w=Sl.newInstance();w.setDimensions(v),w.setOrigin(p),w.setSpacing(f),t.outputDirection&&w.setDirection(t.outputDirection),w.getPointData().setScalars(I),e.getIndexMatrix(i,w);let O=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,m)&&(O=jA.NEAREST)),t.interpolator.setInterpolationMode(O);let M=HA.CLAMP;M=t.wrap?HA.REPEAT:M,M=t.mirror?HA.MIRROR:M,t.interpolator.setBorderMode(M);const R=762939453125e-17;let V=.5*t.border;V=M===HA.CLAMP?V:4294967294,V=V>R?V:R,t.interpolator.setTolerance(V),t.interpolator.initialize(i),e.vtkImageResliceExecute(i,w),t.interpolator.releaseData(),a[0]=w},e.vtkImageResliceExecute=(n,a)=>{const i=n.getPointData().getScalars(),s=a.getPointData().getScalars();let l=s.getData();const c=a.getExtent(),u=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(u);let g=i.getData();const m=i.getDataType(),h=i.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],T=[0,0,0];T[0]=i.getNumberOfComponents(),T[1]=T[0]*b[0],T[2]=T[1]*b[1];const C=b[0]*b[1]*b[2];v>0&&v+hjA.LINEAR||d>1&&t.slabMode===gP.SUM,B=e.getConversionFunc(m,I,t.scalarShift,t.scalarScale,L),N=e.getSetPixelsFunc(I,1,w,l),k=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let F=c[2]-1,_=c[4]-1;const G=[0,0,0,0],U=[0,0,0,0],W=pP.newInstance();W.initialize(a,c,t.stencil,null);const z=W.getScalars(a,0);let H=0;const j=jt.newTypedArray(I,Ui.getDiagonalLength(c)*w*2),K=new Float64Array(h*d),$=new Float64Array(h);for(;!W.isAtEnd();W.nextSpan()){const n=W.spanEndId()-W.getId();if(H=1*W.getId()*w,W.isInStencil()){const r=W.getIndex();r[2]>_&&(_=r[2],G[0]=V[0]+_*R[0],G[1]=V[1]+_*R[1],G[2]=V[2]+_*R[2],G[3]=V[3]+_*R[3],F=c[2]-1),r[1]>F&&(F=r[1],U[0]=G[0]+F*M[0],U[1]=G[1]+F*M[1],U[2]=G[2]+F*M[2],U[3]=G[3]+F*M[3]);const a=r[0],i=a+n-1;if(P){const e=g,t=l,n=1*T[0],r=1*T[1],o=1*T[2],s=x[1]-x[0]+1,c=x[3]-x[2]+1,u=x[5]-x[4]+1;let d=a,p=a-1,f=!1;const m=1*h;for(let t=a;t<=i;t++){const i=[U[0]+t*O[0],U[1]+t*O[1],U[2]+t*O[2]],l=YA(i[0])-x[0],g=YA(i[1])-x[2],h=YA(i[2])-x[4];if(l>=0&&l=0&&g=0&&h1){let e=n-.5*(d-1);e*=p,s[0]=i[0]+e*R[0],s[1]=i[1]+e*R[1],s[2]=i[2]+e*R[2],s[3]=i[3]+e*R[3],g=s}if(f){const e=1/g[3];g[0]*=e,g[1]*=e,g[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),a=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,g,n,a)}if(t.interpolator.checkBoundsIJK(g)){r=1,t.interpolator.interpolateIJK(g,$);for(let e=0;eh&&k(K,h,m/h);for(let e=0;ea?n:r}const g=l-1-(r!==n)-s+1;let m=0;n?(A&&e.rescaleScalars(E,h,i-a+1,t.scalarShift,t.scalarScale),m=B(j,E.subarray(s*h),w,g)):m=N(j,D,w,g);for(let e=0;e{const a=g(new Float64Array(16));return o=null,t.resliceAxes&&d(a,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?b(a,t.resliceTransform.getMatrix(),a):tt("Non homogeneous transform have not yet been ported")),b(a,a,n.getIndexToWorld()),null==o&&b(a,e.getWorldToIndex(),a),d(r,a),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),a=e.getDimensions(),i=[0,a[0]-1,0,a[1]-1,0,a[2]-1],s=new Float64Array(16);t.resliceAxes?h(s,t.resliceAxes):g(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let c=null;za.isIdentity3x3(o)||(c=qf().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const u=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+i[e%2]*r[0],d[1]=n[1]+i[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+i[4+Math.floor(e/4)%2]*r[2],d[3]=1,c&&zi(d,d,c),t.resliceTransform&&l.transformPoint(d,d),zi(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>u[2*e+1]&&(u[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,a)=>{const i=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let i=a;if(n!==ws.FLOAT&&n!==ws.DOUBLE&&!a){const a=e.getDataTypeMinMax(t);let s=(a.min+r)*o,l=(a.max+r)*o;const c=e.getDataTypeMinMax(n),u=c.min,d=c.max;if(s>l){const e=l;l=s,s=e}i=sd}if(i&&n!==ws.FLOAT&&n!==ws.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,a)=>e.clamp(n,r,o,a,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case gP.MIN:n=s;break;case gP.MAX:n=l;break;case gP.MEAN:n=t?u:c;break;case gP.SUM:n=t?f:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,zi(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const a=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],a=e[12+n];t[2*r]===t[2*r+1]&&(a+=o*t[2*n],o=0);const i=XA(o).error,s=XA(a).error;if(0!==i||0!==s)return 0}return 1}}const vP={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:jA.NEAREST,slabMode:gP.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:lP.newInstance(),usePermuteExecute:!1};function yP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vP,n),jt.obj(e,t),jt.algo(e,t,1,1),jt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),jt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),jt.setGetArray(e,t,["outputExtent"],6),jt.setGetArray(e,t,["outputDirection"],9),jt.setGetArray(e,t,["backgroundColor"],4),jt.get(e,t,["resliceAxes"]),jt.algo(e,t,1,1),hP(e,t)}var bP={newInstance:jt.newInstance(yP,"vtkImageReslice"),extend:yP,...fP};const{InterpolationType:xP}=pg,{vtkErrorMacro:TP}=jt;function CP(e,t){t.classHierarchy.push("vtkImageProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].piecewiseFunction&&(e=t.componentData[r].piecewiseFunction.getMTime(),n=n>e?n:e);return n},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].rGBTransferFunction!==a&&(t.componentData[o].rGBTransferFunction=a,e.modified(),!0)},e.getRGBTransferFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].rGBTransferFunction},e.setPiecewiseFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].piecewiseFunction!==a&&(t.componentData[o].piecewiseFunction=a,e.modified(),!0)},e.getPiecewiseFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].piecewiseFunction},e.setScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=t,o=n;return Number.isInteger(t)||(o=t,r=0),e.setPiecewiseFunction(r,o)},e.getScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e.getPiecewiseFunction(t)},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return TP("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(TP("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(xP.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(xP.LINEAR),e.getInterpolationTypeAsString=()=>jt.enumToString(xP,t.interpolationType)}const SP={independentComponents:!1,interpolationType:xP.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function AP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,SP,n),jt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;e++)t.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}jt.setGet(e,t,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity"]),jt.setGetArray(e,t,["labelOutlineThickness"]),CP(e,t)}var PP={newInstance:jt.newInstance(AP,"vtkImageProperty"),extend:AP};const{vtkDebugMacro:IP}=jt;function wP(e,t){t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=PP.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){IP("Recomputing bounds..."),t.mapperBounds=n.map((e=>e)),e.computeMatrix();const r=new Float64Array(16);m(r,t.matrix),Ui.transformBounds(n,r,t.bounds),t.boundsMTime.modified()}var r;return t.bounds},e.getBoundsForSlice=(n,r)=>{const o=t.mapper.getBoundsForSlice(n,r);if(!Ui.isValid(o))return o;e.computeMatrix();const a=new Float64Array(16);return m(a,t.matrix),Ui.transformBounds(o,a)},e.getMinXBound=()=>e.getBounds()[0],e.getMaxXBound=()=>e.getBounds()[1],e.getMinYBound=()=>e.getBounds()[2],e.getMaxYBound=()=>e.getBounds()[3],e.getMinZBound=()=>e.getBounds()[4],e.getMaxZBound=()=>e.getBounds()[5],e.getMTime=()=>{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}if(null!==t.property){let n=t.property.getMTime();e=n>e?n:e,null!==t.property.getRGBTransferFunction()&&(n=t.property.getRGBTransferFunction().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}const OP={mapper:null,property:null,bounds:[...Ui.INIT_BOUNDS]};function MP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OP,n),us.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["mapper"]),jt.getArray(e,t,["bounds"],6),wP(e,t)}var RP={newInstance:jt.newInstance(MP,"vtkImageSlice"),extend:MP};function VP(e,t){t.classHierarchy.push("vtkInteractorStyleImage"),e.superHandleMouseMove=e.handleMouseMove,e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case BT.IS_WINDOW_LEVEL:e.windowLevel(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case BT.IS_SLICE:e.slice(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}e.superHandleMouseMove(n)},e.superHandleLeftButtonPress=e.handleLeftButtonPress,e.handleLeftButtonPress=n=>{const r=n.position;if(n.shiftKey||n.controlKey)"IMAGE3D"===t.interactionMode&&n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startRotate():"IMAGE_SLICING"===t.interactionMode&&n.controlKey?(t.lastSlicePosition=r.y,e.startSlice()):e.superHandleLeftButtonPress(n);else{t.windowLevelStartPosition[0]=r.x,t.windowLevelStartPosition[1]=r.y,e.setCurrentImageNumber(t.currentImageNumber);const n=t.currentImageProperty;n&&(t.windowLevelInitial[0]=n.getColorWindow(),t.windowLevelInitial[1]=n.getColorLevel()),e.startWindowLevel()}},e.superHandleLeftButtonRelease=e.handleLeftButtonRelease,e.handleLeftButtonRelease=()=>{switch(t.state){case BT.IS_WINDOW_LEVEL:e.endWindowLevel();break;case BT.IS_SLICE:e.endSlice();break;default:e.superHandleLeftButtonRelease()}},e.handleStartMouseWheel=()=>{e.startSlice()},e.handleEndMouseWheel=()=>{e.endSlice()},e.handleMouseWheel=e=>{const t=e.pokedRenderer.getActiveCamera();let n=t.getDistance();n+=e.spinY;const r=t.getClippingRange();nr[1]&&(n=r[1]),t.setDistance(n),e.pokedRenderer.getViewProps().filter((e=>e.isA("vtkImageSlice"))).forEach((t=>{if(t.getMapper().isA("vtkImageResliceMapper")){const n=t.getMapper().getSlicePlane();n&&(n.push(e.spinY),n.modified(),t.getMapper().modified())}}))},e.windowLevel=(e,n)=>{t.windowLevelCurrentPosition[0]=n.x,t.windowLevelCurrentPosition[1]=n.y;const r=t._interactor;if(t.currentImageProperty){const n=r.getView().getViewportSize(e),o=t.windowLevelInitial[0],a=t.windowLevelInitial[1];let i=4*(t.windowLevelCurrentPosition[0]-t.windowLevelStartPosition[0])/n[0],s=4*(t.windowLevelStartPosition[1]-t.windowLevelCurrentPosition[1])/n[1];Math.abs(o)>.01?i*=o:i*=o<0?-.01:.01,Math.abs(a)>.01?s*=a:s*=a<0?-.01:.01,o<0&&(i*=-1),a<0&&(s*=-1);let l=i+o;const c=a-s;l<.01&&(l=.01),t.currentImageProperty.setColorWindow(l),t.currentImageProperty.setColorLevel(c)}},e.slice=(e,n)=>{const r=t._interactor,o=n.y-t.lastSlicePosition,a=e.getActiveCamera(),i=a.getClippingRange();let s=a.getDistance(),l=0;if(a.getParallelProjection())l=2*a.getParallelScale();else{const e=Eo(a.getViewAngle());l=2*s*Math.tan(.5*e)}s+=o*l/r.getView().getViewportSize(e)[1],si[1]&&(s=i[1]-.001*l),a.setDistance(s),t.lastSlicePosition=n.y},e.setCurrentImageNumber=n=>{if(null===n)return;const r=t._interactor.getCurrentRenderer();if(!r)return;t.currentImageNumber=n;const o=r.getViewProps().filter((e=>e.isA("vtkImageSlice")));let a=n;n<0&&(a+=o.length);const i=o.find(((e,t)=>function(e,t,n){return e===n&&t.getNestedPickable()}(t,e,a)));i&&e.setCurrentImageProperty(i.getProperty())},e.setCurrentImageProperty=e=>{t.currentImageProperty=e}}const EP={windowLevelStartPosition:[0,0],windowLevelCurrentPosition:[0,0],lastSlicePosition:0,windowLevelInitial:[1,.5],currentImageNumber:-1,interactionMode:"IMAGE2D",xViewRightVector:[0,1,0],xViewUpVector:[0,0,-1],yViewRightVector:[1,0,0],yViewUpVector:[0,0,-1],zViewRightVector:[1,0,0],zViewUpVector:[0,1,0]};function DP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,EP,n),$T.extend(e,t,n),jt.setGet(e,t,["interactionMode"]),jt.get(e,t,["currentImageProperty"]),VP(e,t)}var LP={newInstance:jt.newInstance(DP,"vtkInteractorStyleImage"),extend:DP};function BP(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ri.intersectWithLine(i,s,n,r).x}function NP(e,t){t.classHierarchy.push("vtkPlaneManipulator"),e.handleEvent=(t,n)=>({worldCoords:BP(t.position.x,t.position.y,e.getOrigin(t),e.getNormal(t),t.pokedRenderer,n)})}function kP(e){return{...e}}function FP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Rx.extend(e,t,kP(n)),NP(e,t)}var _P={intersectDisplayWithPlane:BP,extend:FP,newInstance:jt.newInstance(FP,"vtkPlaneManipulator")};function GP(e,t){t.classHierarchy.push("vtkAbstractWidget"),t.actorToRepresentationMap=new WeakMap,e.getBounds=t.widgetState.getBounds,e.getNestedProps=()=>t.representations,e.activateHandle=n=>{let{selectedState:r,representation:o}=n;t.widgetState.activateOnly(r),t.activeState=r,r&&r.updateManipulator&&r.updateManipulator(),e.invokeActivateHandle({selectedState:r,representation:o}),e.updateCursor&&e.updateCursor()},e.deactivateAllHandles=()=>{t.widgetState.deactivate()},e.hasActor=e=>t.actorToRepresentationMap.has(e),e.grabFocus=()=>{t.hasFocus=!0},e.loseFocus=()=>{t.hasFocus=!1},e.hasFocus=()=>t.hasFocus,e.placeWidget=e=>t.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e),e.getRepresentationFromActor=e=>t.actorToRepresentationMap.get(e),e.updateRepresentationForRender=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lx.FRONT_BUFFER;for(let n=0;nt._factory.getViewWidgets(),e.setPriority(.5)}const UP={contextVisibility:!0,handleVisibility:!0,hasFocus:!1};function WP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UP,n),is.extend(e,t,n),LT.extend(e,t,n),jt.setGet(e,t,["contextVisibility","handleVisibility","_widgetManager"]),jt.get(e,t,["representations","widgetState","activeState"]),jt.moveToProtected(e,t,["widgetManager"]),jt.event(e,t,"ActivateHandle"),GP(e,t)}var zP={newInstance:jt.newInstance(WP,"vtkAbstractWidget"),extend:WP};const{ViewTypes:HP,RenderingTypes:jP,CaptureOn:KP}=cx,{vtkErrorMacro:$P}=jt;let qP=1;function XP(e){const t=e.getActiveCamera(),n=e.getRenderWindow(),r=n.getInteractor(),o=r.getView();return{renderer:e,renderWindow:n,interactor:r,apiSpecificRenderWindow:o,camera:t}}function YP(e,t){const{dispHeightFactor:n,cameraPosition:r,cameraDir:o,isParallel:a,rendererPixelDims:i}=t;let s=1;if(a)s=n;else{const t=[...e];za.subtract(t,r,t),s=za.dot(t,o)*n}return s/i[1]}function ZP(e,t){t.viewId||(t.viewId="view-"+qP++),t.classHierarchy.push("vtkWidgetManager");const n=new WeakMap,r=[];function o(e){return e&&(e.isA("vtkAbstractWidget")?e:e.getWidgetForView({viewId:t.viewId}))}function a(){const{_apiSpecificRenderWindow:e,_camera:n,_renderer:r}=t;if(r&&e&&n){const[o,a]=e.getSize(),[i,s,l,c]=r.getViewport(),u=e.getComputedDevicePixelRatio(),d=[o*(l-i)/u,a*(c-s)/u],p=n.getPosition(),f=n.getDirectionOfProjection(),g=n.getParallelProjection(),m=g?2*n.getParallelScale():2*Math.tan(za.radiansFromDegrees(n.getViewAngle())/2);t.widgets.forEach((e=>{e.getNestedProps().forEach((e=>{e.getScaleInPixels()&&e.setDisplayScaleParams({dispHeightFactor:m,cameraPosition:p,cameraDir:f,isParallel:g,rendererPixelDims:d})}))}))}}async function i(n,r,o){const{position:a}=n,{requestCount:i,selectedState:s,representation:l,widget:c}=await e.getSelectedDataForXY(a.x,a.y);if(i||o!==t._currentUpdateSelectionCallID)return;function u(e){r&&t._interactor.invokeLeftButtonRelease(n),e.activateHandle({selectedState:s,representation:l}),r&&t._interactor.invokeLeftButtonPress(n)}t._apiSpecificRenderWindow.setCursor(c?"pointer":"default"),t.activeWidget=null;let d=!1;if(t.widgetInFocus===c&&c.hasFocus())u(c),t.activeWidget=c,d=!0;else for(let e=0;e1&&void 0!==arguments[1]&&arguments[1];if(!t.isAnimating&&t.pickingEnabled&&e.pokedRenderer===t._renderer){const r=Symbol("UpdateSelection");t._currentUpdateSelectionCallID=r,await i(e,n,r)}};function l(e){e.updateRepresentationForRender(t.renderingType)}function c(){t.renderingType=jP.FRONT_BUFFER,t.widgets.forEach(l)}async function u(e,n,r,o){t._captureInProgress?await t._captureInProgress:(t.renderingType=jP.PICKING_BUFFER,t.widgets.forEach(l),t._capturedBuffers=null,t._captureInProgress=t._selector.getSourceDataAsync(t._renderer,e,n,r,o),t._capturedBuffers=await t._captureInProgress,t._captureInProgress=null,t.previousSelectedData=null,c())}function d(e){t._renderer.removeActor(e),e.delete()}function p(){t._renderer.getRenderWindow().getInteractor().render(),e.renderWidgets()}e.enablePicking=()=>{t.pickingEnabled=!0,e.renderWidgets()},e.renderWidgets=()=>{if(t.pickingEnabled&&t.captureOn===KP.MOUSE_RELEASE){const[e,n]=t._apiSpecificRenderWindow.getSize();u(0,0,e,n)}c(),e.modified()},e.disablePicking=()=>{t.pickingEnabled=!1},e.setRenderer=n=>{const o=XP(n);for(Object.assign(t,o),jt.moveToProtected({},t,Object.keys(o));r.length;)r.pop().unsubscribe();t._selector=t._apiSpecificRenderWindow.createSelector(),t._selector.setFieldAssociation(ll.FIELD_ASSOCIATION_POINTS),r.push(t._apiSpecificRenderWindow.onWindowResizeEvent(a)),r.push(t._camera.onModified(a)),a(),r.push(t._interactor.onStartAnimation((()=>{t.isAnimating=!0}))),r.push(t._interactor.onEndAnimation((()=>{t.isAnimating=!1,e.renderWidgets()}))),r.push(t._interactor.onMouseMove((e=>(s(e),jt.VOID)))),r.push(t._interactor.onLeftButtonPress((e=>{const{deviceType:t}=e,n="touch"===t||"pen"===t;return n&&s(e,n),jt.VOID}),.25)),e.modified(),t.pickingEnabled&&e.enablePicking()},e.addWidget=(r,o,i)=>{if(!t._renderer)return $P("Widget manager MUST BE link to a view before registering widgets"),null;const{viewId:s,_renderer:l}=t,c=r.getWidgetForView({viewId:s,renderer:l,viewType:o||HP.DEFAULT,initialValues:i});return null!=c&&-1===t.widgets.indexOf(c)&&(t.widgets.push(c),(u=c).setWidgetManager(e),function(e){const t=e.getRepresentations();for(let r=0;r{t.widgets.forEach(d),t.widgets=[],t.widgetInFocus=null,p()},e.removeWidget=n=>{const r=o(n),a=t.widgets.indexOf(r);-1!==a&&(t.widgets.splice(a,1),t.widgetInFocus===r&&e.releaseFocus(),d(r),p())},e.getSelectedDataForXY=async(n,r)=>{if(t.selections=null,t.pickingEnabled){if(t._capturedBuffers&&t.captureOn!==KP.MOUSE_MOVE){const e=t._capturedBuffers.area;(ne[2]||re[3])&&await u(n,r,n,r)}else await u(n,r,n,r);t.selections=t._capturedBuffers.generateSelection(n,r,n,r)}return e.getSelectedData()},e.getSelectedData=()=>{if(!t.selections||!t.selections.length)return t.previousSelectedData=null,{};const{propID:e,compositeID:r,prop:o}=t.selections[0].getProperties();let{widget:a,representation:i}=t.selections[0].getProperties();if(t.previousSelectedData&&t.previousSelectedData.prop===o&&t.previousSelectedData.widget===a&&t.previousSelectedData.compositeID===r)return t.previousSelectedData.requestCount++,t.previousSelectedData;if(n.has(o)){const e=n.get(o);a=e.widget,i=e.representation}if(a&&i){const n=i.getSelectedState(o,r);return t.previousSelectedData={requestCount:0,propID:e,compositeID:r,prop:o,widget:a,representation:i,selectedState:n},t.previousSelectedData}return t.previousSelectedData=null,{}},e.grabFocus=e=>{const n=o(e);t.widgetInFocus&&t.widgetInFocus!==n&&t.widgetInFocus.loseFocus(),t.widgetInFocus=n,t.widgetInFocus&&t.widgetInFocus.grabFocus()},e.releaseFocus=()=>e.grabFocus(null);const f=e.delete;e.delete=()=>{for(;r.length;)r.pop().unsubscribe();f()}}const QP={viewId:null,widgets:[],activeWidget:null,renderer:null,viewType:HP.DEFAULT,isAnimating:!1,pickingEnabled:!0,selections:null,previousSelectedData:null,widgetInFocus:null,captureOn:KP.MOUSE_MOVE};function JP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,QP,n),jt.obj(e,t),jt.setGet(e,t,["captureOn",{type:"enum",name:"viewType",enum:HP}]),jt.get(e,t,["selections","widgets","viewId","pickingEnabled","activeWidget"]),ZP(e,t)}var eI={newInstance:jt.newInstance(JP,"vtkWidgetManager"),extend:JP,Constants:cx,getPixelWorldHeightAtCoord:YP};function tI(){}function nI(e,t){t.classHierarchy.push("vtkAbstractWidgetFactory");const n={};e.getWidgetForView=r=>{let{viewId:o,renderer:a,viewType:i,initialValues:s}=r;if(!n[o]){if(!a)return null;const{interactor:r,apiSpecificRenderWindow:l,camera:c}=XP(a),u={},d={};jt.obj(d,u),Object.assign(d,{onWidgetChange:e.onWidgetChange}),Object.assign(u,{widgetState:t.widgetState,manipulator:t.manipulator,viewType:i,renderer:a,camera:c,apiSpecificRenderWindow:l,factory:e}),jt.moveToProtected(d,u,["renderer","camera","apiSpecificRenderWindow","factory"]),jt.get(d,u,["viewType"]),jt.safeArrays(u),zP.extend(d,u,s);const p=s;u.representations=e.getRepresentationsForViewType(i).map((e=>{let{builder:t,labels:n,initialValues:r}=e;return t.newInstance({_parentProp:d,labels:n,...r,...p})})),u.representations.forEach((e=>{e.setInputData(u.widgetState),e.getActors().forEach((t=>{u.actorToRepresentationMap.set(t,e)}))})),t.behavior(d,u),["coincidentTopologyParameters",...t.methodsToLink||[]].forEach((e=>{const t=`set${jt.capitalize(e)}`,n=`get${jt.capitalize(e)}`,r={[e]:[],[t]:[],[n]:[]};u.representations.forEach((o=>{o[e]&&r[e].push(o[e]),o[t]&&r[t].push(o[t]),o[n]&&r[n].push(o[n])})),Object.keys(r).forEach((e=>{const t=r[e];1===t.length?d[e]=t[0]:t.length>1&&(d[e]=jt.chain(...t))}))})),d.delete=jt.chain((()=>{delete n[o]}),d.delete),d.setInteractor(r);const f=Object.freeze(d);return n[o]=f,f}return n[o]},e.getViewIds=()=>Object.keys(n),e.getViewWidgets=()=>Object.values(n),e.setVisibility=e=>{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;rt.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e);let r=tI;e.delete=jt.chain(e.delete,(()=>r())),t.widgetState&&(r=t.widgetState.onModified((()=>e.invokeWidgetChange(t.widgetState))).unsubscribe)}function rI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,n),jt.obj(e,t),jt.get(e,t,["widgetState"]),jt.event(e,t,"WidgetChange"),nI(e,t)}var oI={newInstance:jt.newInstance(rI,"vtkAbstractWidget"),extend:rI};const{vtkWarningMacro:aI}=jt;function iI(e,t){t.classHierarchy.push("vtkPlaneSource"),e.requestData=(n,r)=>{if(t.deleted)return;const o=r[0],a=o?o.getPoints().getDataType():t.pointType,i=Pu.newInstance(),s=[],l=[];if(jo(t.point1,t.origin,s),jo(t.point2,t.origin,l),!e.updatePlane(s,l))return void aI("Bad plane definition");const c=t.xResolution,u=t.yResolution,d=(c+1)*(u+1),p=c*u,f=jt.newTypedArray(a,3*d);i.getPoints().setData(f,3);const g=new Uint32Array(5*p);i.getPolys().setData(g,1);const m=new Float32Array(3*d),h=Us.newInstance({numberOfComponents:3,values:m,name:"Normals"});i.getPointData().setNormals(h);const v=new Float32Array(2*d),y=Us.newInstance({numberOfComponents:2,values:v,name:"TextureCoordinates"});i.getPointData().setTCoords(y);const b=new Float32Array(2);let x=0;for(let e=0;e{if(Math.abs(n)<1e-6)return;const o=g(new Float64Array(16)),a=[];var i,s;i=a,s=t.center,i[0]=-s[0],i[1]=-s[1],i[2]=-s[2],x(o,o,t.center),C(o,o,n,r),x(o,o,a),Ln(t.origin,t.origin,o),Ln(t.point1,t.point1,o),Ln(t.point2,t.point2,o),qf().rotate(n,r).apply(t.normal),e.modified()},e.setCenter=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.center)){const r=[];jo(t.point1,t.origin,r);const o=[];jo(t.point2,t.origin,o);for(let e=0;e<3;e++)t.center[e]=n[e],t.origin[e]=t.center[e]-.5*(r[e]+o[e]),t.point1[e]=t.origin[e]+r[e],t.point2[e]=t.origin[e]+o[e];e.modified()}},e.setPoint1=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.point1)){const r=[],o=[];t.point1=[...n],jo(t.point1,t.origin,r),jo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.setPoint2=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.point2)){const r=[],o=[];t.point2=[...n],jo(t.point1,t.origin,r),jo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.updatePlane=(e,n)=>{for(let r=0;r<3;r++)t.center[r]=t.origin[r]+.5*(e[r]+n[r]);return Yo(e,n,t.normal),0!==Qo(t.normal)}}const sI={xResolution:10,yResolution:10,origin:[0,0,0],point1:[1,0,0],point2:[0,1,0],pointType:"Float64Array"};function lI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sI,n),t.normal=[0,0,1],t.center=[0,0,0],jt.obj(e,t),jt.setGet(e,t,["xResolution","yResolution"]),jt.setGetArray(e,t,["origin"],3),jt.getArray(e,t,["point1","point2","normal","center"],3),jt.algo(e,t,0,1),iI(e,t),e.setPoint1(t.point1),e.setPoint2(t.point2)}var cI={newInstance:jt.newInstance(lI,"vtkPlaneSource"),extend:lI};const uI={DIRECTION:0,ROTATION:1,MATRIX:2};var dI={OrientationModes:uI,ScaleModes:{SCALE_BY_CONSTANT:0,SCALE_BY_MAGNITUDE:1,SCALE_BY_COMPONENTS:2}};const{OrientationModes:pI,ScaleModes:fI}=dI,{vtkErrorMacro:gI}=jt;function mI(e,t){t.classHierarchy.push("vtkGlyph3DMapper"),e.getOrientationModeAsString=()=>jt.enumToString(pI,t.orientationMode),e.setOrientationModeToDirection=()=>e.setOrientationMode(pI.DIRECTION),e.setOrientationModeToRotation=()=>e.setOrientationMode(pI.ROTATION),e.setOrientationModeToMatrix=()=>e.setOrientationMode(pI.MATRIX),e.getOrientationArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.orientationArray?n.getPointData().getArray(t.orientationArray):n.getPointData().getVectors():null},e.getScaleModeAsString=()=>jt.enumToString(fI,t.scaleMode),e.setScaleModeToScaleByMagnitude=()=>e.setScaleMode(fI.SCALE_BY_MAGNITUDE),e.setScaleModeToScaleByComponents=()=>e.setScaleMode(fI.SCALE_BY_COMPONENTS),e.setScaleModeToScaleByConstant=()=>e.setScaleMode(fI.SCALE_BY_CONSTANT),e.getScaleArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.scaleArray?n.getPointData().getArray(t.scaleArray):n.getPointData().getScalars():null},e.getBounds=()=>{const n=e.getInputData(0),r=e.getInputData(1);return n&&r?(e.buildArrays(),t.bounds):_a()},e.buildArrays=()=>{const n=e.getInputData(0),r=e.getInputData(1);if(t.buildTime.getMTime()t.bounds[1]&&(t.bounds[1]=u[0]),u[1]>t.bounds[3]&&(t.bounds[3]=u[1]),u[2]>t.bounds[5]&&(t.bounds[5]=u[2]);const r=new Float32Array(y,36*e,9);se(r,n),ge(r,r),fe(r,r)}const O=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),t.colorArray=null;const M=e.getLookupTable();M&&O&&(M.build(),t.colorArray=M.mapScalars(O,t.colorMode,0)),t.buildTime.modified()}},e.getPrimitiveCount=()=>{const t=e.getInputData(1),n=e.getInputData().getPoints().getNumberOfValues()/3;return{points:n*t.getPoints().getNumberOfValues()/3,verts:n*(t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells()),lines:n*(t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells()),triangles:n*(t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells())}},e.setSourceConnection=t=>e.setInputConnection(t,1)}const hI={orient:!0,orientationMode:pI.DIRECTION,orientationArray:null,scaling:!0,scaleFactor:1,scaleMode:fI.SCALE_BY_MAGNITUDE,scaleArray:null,matrixArray:null,normalArray:null,colorArray:null};function vI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hI,n),fc.extend(e,t,n),jt.algo(e,t,2,0),t.buildTime={},jt.obj(t.buildTime,{mtime:0}),t.boundsTime={},jt.obj(t.boundsTime,{mtime:0}),jt.setGet(e,t,["orient","orientationMode","orientationArray","scaleArray","scaleFactor","scaleMode","scaling"]),jt.get(e,t,["colorArray","matrixArray","normalArray","buildTime"]),mI(e,t)}var yI={newInstance:jt.newInstance(vI,"vtkGlyph3DMapper"),extend:vI,...dI};const bI=0,xI=1,{vtkErrorMacro:TI,vtkWarningMacro:CI}=jt;function SI(e,t){e&&e.setResolveCoincidentTopologyToPolygonOffset&&(e.setResolveCoincidentTopologyToPolygonOffset(),Yl.forEach((n=>{if(t[n]){const r=`setRelativeCoincidentTopology${n}OffsetParameters`;if(e[r]){const{factor:o,offset:a}=t[n];e[r](o,a)}}})))}function AI(e,t,n,r,o){let a=e[`get${jt.capitalize(t)}`]?.()||e.getPointData().getArrayByName(t);if(!a||void 0!==r&&a.getDataType()!==r||void 0!==o&&a.getNumberOfComponents()!==o){let i=Us,s=r,l=o;"points"===t?(i=Ic,s=s??"Float32Array",l=o??3):bu.includes(t)?(i=xc,s=s??"Uint16Array",l=o??1):(s=s??"Float32Array",l=o??1),a=i.newInstance({name:t,dataType:s,numberOfComponents:l,size:l*n,empty:0===n}),"points"===t||bu.includes(t)?e[`set${jt.capitalize(t)}`](a):e.getPointData().addArray(a)}else a.getNumberOfTuples()!==n&&a.resize(n);return a}function PI(e,t){t.classHierarchy.push("vtkWidgetRepresentation");const n={mtimes:{},states:[]};t._onCoincidentTopologyParametersChanged=()=>{e.getActors().forEach((e=>{SI(e.getMapper(),t.coincidentTopologyParameters)}))},e.getActors=()=>t.actors,e.getNestedProps=e.getActors,e.setLabels=function(){for(var n=arguments.length,r=new Array(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.mtimes.representation===e.getMTime()&&n.mtimes.input===r.getMTime()||(n.mtimes.representation=e.getMTime(),n.mtimes.input=r.getMTime(),n.states=[],t.labels.forEach((e=>{n.states=n.states.concat(r.getStatesWithLabel(e)||[])}))),n.states},e.getSelectedState=(t,n)=>{const r=e.getRepresentationStates();return n0&&void 0!==arguments[0]?arguments[0]:lx.FRONT_BUFFER,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!0;switch(t.behavior){case bI:o=e===lx.PICKING_BUFFER||r;break;case xI:o=n;break;default:o=!0}const a=o;for(let e=0;ee.addActor(t)))},e.addActor=e=>{SI(e.getMapper(),t.coincidentTopologyParameters),Array.prototype.push.apply(t.actors,[e])},e.setLabels(t.labels)}function II(e){return{activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,actors:[],labels:[],behavior:xI,coincidentTopologyParameters:{Point:{factor:-1,offset:-1},Line:{factor:-1,offset:-1},Polygon:{factor:-1,offset:-1}},scaleInPixels:!1,displayScaleParams:{dispHeightFactor:1,cameraPosition:[0,0,0],cameraDir:[1,0,0],isParallel:!1,rendererPixelDims:[1,1]},_internalArrays:{},...e}}var wI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};is.extend(e,t,II(n)),jt.algo(e,t,1,1),jt.get(e,t,["labels","displayScaleParams","coincidentTopologyParameters"]),jt.set(e,t,[{type:"object",name:"displayScaleParams"},{type:"object",name:"coincidentTopologyParameters"}]),jt.setGet(e,t,["scaleInPixels","activeScaleFactor","activeColor","useActiveColor"]),PI(e,t)},OI=function(e){let t=e.source;e.filter&&(t.isA("vtkDataSet")?e.filter.setInputData(t):e.filter.setInputConnection(t.getOutputPort()),t=e.filter),t&&(t.isA("vtkDataSet")?e.mapper.setInputData(t):e.mapper.setInputConnection(t.getOutputPort())),e.glyph&&e.mapper.setInputConnection(e.glyph.getOutputPort(),1),e.actor.setMapper(e.mapper)};function MI(e,t){t.classHierarchy.push("vtkHandleRepresentation")}const RI={behavior:bI,pickable:!0,dragable:!0,scaleInPixels:!0};var VI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...RI,...n};wI(e,t,r),MI(0,t)};function EI(e,t){t.classHierarchy.push("vtkContextRepresentation")}const DI={behavior:xI,pickable:!1,dragable:!0};var LI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...DI,...n};wI(e,t,r),EI(0,t)};function BI(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,n)=>{if(t.deleted)return;let r=n[0];const o=r?r.getPoints().getDataType():t.pointType;r=Pu.newInstance();let a=0,{thetaResolution:i}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let c=t.startPhit.startPhi?t.endPhi:t.startPhi;u*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++i;const d=(l-s)/t.thetaResolution,p=t.startPhi<=0?1:0,f=t.phiResolution+(t.endPhi>=180?-1:0),g=t.phiResolution*i+2,m=2*t.phiResolution*t.thetaResolution;let h=0,v=jt.newTypedArray(o,3*g),y=new Float32Array(3*g),b=0,x=new Uint32Array(5*m);t.startPhi<=0&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]+t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=1,h++,a++),t.endPhi>=180&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]-t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=-1,h++,a++);const T=t.phiResolution-a,C=(u-c)/(t.phiResolution-1);for(let e=0;e=180){const e=T-1+a;for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,NI,n),jt.obj(e,t),jt.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),jt.setGetArray(e,t,["center"],3),jt.algo(e,t,0,1),BI(e,t)}var FI={newInstance:jt.newInstance(kI,"vtkSphereSource"),extend:kI};function _I(e,t){return(e,n)=>{const r=AI(e,"points",n.length).getData();let o=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=AI(e,"color",n.length,"Uint8Array",4),o=r.getData();let a=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=AI(e,"color",n.length).getData();for(let e=0;e{t._pipeline.mapper.setColorByArrayName(null)}}function zI(e,t){return(n,r)=>{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0),t._pipeline.mapper.setScaleMode(yI.ScaleModes.SCALE_BY_COMPONENTS);const o=AI(n,"scale",r.length,"Float32Array",3).getData();let a=0;for(let n=0;n{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0);const o=AI(n,"scale",r.length).getData();for(let n=0;n{t._pipeline.mapper.setScaleArray(null),t._pipeline.mapper.setScaleFactor(t.defaultScale),t._pipeline.mapper.setScaling(1!==t.defaultScale)}}function KI(e,t){return(e,n)=>{t._pipeline.mapper.setOrientationArray("orientation"),t._pipeline.mapper.setOrientationMode(uI.MATRIX);const r=AI(e,"orientation",n.length,"Float32Array",9).getData();for(let e=0;e{t._pipeline.mapper.setOrientationArray(null)}}function qI(e,t){t.classHierarchy.push("vtkGlyphRepresentation");const n={...e},r=Pu.newInstance({mtime:0});function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rnull!=e[0]?.[`get${jt.capitalize(t)}`]?.()))}e.getRepresentationStates=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.getRepresentationStates(e).filter((e=>e.getOrigin?.()&&(e.isVisible?.()??!0)))},e.getMixins=e=>{const n={};return o(e,"origin")?n.position=t.applyMixin.origin:n.position=t.applyMixin.noPosition,o(e,"color3")?n.color=t.applyMixin.color3:o(e,"color")?n.color=t.applyMixin.color:n.color=t.applyMixin.noColor,o(e,"scale3")?n.scale=t.applyMixin.scale3:o(e,"scale1")?n.scale=t.applyMixin.scale1:n.scale=t.applyMixin.noScale,o(e,"direction")?n.orientation=t.applyMixin.direction:n.orientation=t.applyMixin.noOrientation,n},e.requestData=(t,n)=>{const o=e.getRepresentationStates(t[0]);n[0]=r;const a=e.getMixins(o);Object.values(a).forEach((e=>e(r,o))),r.getPoints().modified(),r.modified()},OI(t._pipeline),e.addActor(t._pipeline.actor)}function XI(e,t,n){return{defaultScale:1,...n,_pipeline:{source:n._pipeline?.source??e,glyph:n._pipeline?.glyph??FI.newInstance({phiResolution:8,thetaResolution:8}),mapper:n._pipeline?.mapper??yI.newInstance({scalarMode:Il.USE_POINT_FIELD_DATA}),actor:n._pipeline?.actor??Ps.newInstance({parentProp:e}),...n._pipeline},applyMixin:{origin:n.applyMixin?.origin??_I(0,t),noPosition:n.applyMixin?.noPosition??((e,t)=>{AI(e,"points",0)}),color3:n.applyMixin?.color3??GI(0,t),color:n.applyMixin?.color??UI(0,t),noColor:n.applyMixin?.noColor??WI(0,t),scale3:n.applyMixin?.scale3??zI(e,t),scale1:n.applyMixin?.scale1??HI(e,t),noScale:n.applyMixin?.noScale??jI(0,t),direction:n.applyMixin?.direction??KI(0,t),noOrientation:n.applyMixin?.noOrientation??$I(0,t),...n.applyMixin}}}function YI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.behavior===xI?LI(e,t,XI(e,t,n)):VI(e,t,XI(e,t,n)),"lighting"in n&&t._pipeline.actor.getProperty().setLighting(n.lighting),jt.setGet(e,t._pipeline,["defaultScale"]),jt.get(e,t._pipeline,["glyph","mapper","actor"]),jt.setGet(e,t.applyMixin,Object.keys(t.applyMixin)),qI(e,t)}var ZI={newInstance:jt.newInstance(YI,"vtkGlyphRepresentation"),extend:YI};function QI(e,t){t.classHierarchy.push("vtkPixelSpaceCallbackMapper"),t.callback||(t.callback=()=>{}),e.invokeCallback=(e,n,r,o,a)=>{if(!t.callback)return;const i=n.getCompositeProjectionMatrix(r,-1,1);m(i,i);const s=e.getPoints(),l=new Float64Array(3),c=o.usize,u=o.vsize,d=c/2,p=u/2,f=[];for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JI,n),fc.extend(e,t,n),jt.setGet(e,t,["callback","useZValues"]),QI(e,t)}var tw={newInstance:jt.newInstance(ew,"vtkPixelSpaceCallbackMapper"),extend:ew};function nw(e,t){t.classHierarchy.push("vtkCylinderSource"),e.requestData=function(e,n){if(t.deleted)return;let r=n[0];const o=2*Math.PI/t.resolution;let a=2*t.resolution,i=5*t.resolution;t.capping&&(a=4*t.resolution,i=7*t.resolution+2);const s=jt.newTypedArray(t.pointType,3*a);let l=0;const c=new Uint32Array(i),u=new Float32Array(3*a),d=Us.newInstance({numberOfComponents:3,values:u,name:"Normals"}),p=new Float32Array(2*a),f=Us.newInstance({numberOfComponents:2,values:p,name:"TCoords"}),g=[0,0,0],m=[0,0,0],h=[0,0,0],v=[0,0,0],y=[0,0],b=[0,0],x=null==t.otherRadius?t.radius:t.otherRadius;for(let e=0;e-1*e))).apply(s),r=Pu.newInstance(),r.getPoints().setData(s,3),r.getPolys().setData(c,1),r.getPointData().setNormals(d),r.getPointData().setTCoords(f),n[0]=r}}const rw={height:1,initAngle:0,radius:1,resolution:6,center:[0,0,0],direction:[0,1,0],capping:!0,pointType:"Float64Array"};function ow(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rw,n),jt.obj(e,t),jt.setGet(e,t,["height","initAngle","otherRadius","radius","resolution","capping"]),jt.setGetArray(e,t,["center","direction"],3),jt.algo(e,t,0,1),nw(e,t)}var aw={newInstance:jt.newInstance(ow,"vtkCylinderSource"),extend:ow};function iw(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;e{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)};const r=e.getScale3();e.setScale3(((e,n)=>{if(r(e,n),t.infiniteLine){const t=AI(e,"scale",n.length,"Float32Array",3).getData();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};ZI.extend(e,t,sw(n)),jt.setGet(e,t,["infiniteLine","glyphResolution"]),iw(e,t)}var cw={newInstance:jt.newInstance(lw,"vtkLineHandleRepresentation"),extend:lw};function uw(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;et._pipeline.glyph.getPhiResolution(),e.setGlyphResolution=e=>t._pipeline.glyph.setPhiResolution(e)||t._pipeline.glyph.setThetaResolution(e),e.setDisplayCallback=e=>{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)}}function dw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ZI.extend(e,t,n),uw(e,t)}var pw={newInstance:jt.newInstance(dw,"vtkSphereHandleRepresentation"),extend:dw};function fw(e,t){t._isDragging=!1;let n,r=!1;jt.setGet(e,t,["keepOrthogonality",{type:"object",name:"cursorStyles"}]),e.setCursorStyles({[mx]:"move",[gx]:"alias",[fx]:"pointer",default:"default"}),e.setEnableTranslation=e=>{t.representations[0].setPickable(e),t.representations[2].setPickable(e)},e.setEnableRotation=e=>{t.representations[1].setPickable(e)},e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("rotation").includes(t.activeState)?gx:t.widgetState.getStatesWithLabel("line").includes(t.activeState)?fx:t.widgetState.getStatesWithLabel("center").includes(t.activeState)?mx:null,e.getActiveLineName=()=>function(e){return Sx(Object.keys(e.getPlanes()).map((e=>yx[e])))}(t.widgetState).find((e=>t.widgetState.getStatesWithLabel(e).includes(t.activeState))),e.getActiveLineHandle=()=>t.widgetState[`getAxis${e.getActiveLineName()}`]?.(),e.getOtherLineHandle=e=>t.widgetState[`getAxis${Ax(t.widgetState,e)}`]?.(),e.getActiveRotationPointName=()=>t.widgetState.getStatesWithLabel("point0").includes(t.activeState)?"point0":t.widgetState.getStatesWithLabel("point1").includes(t.activeState)?"point1":null,e.startScrolling=t=>{t&&(n=t),r=!0,e.startInteraction()},e.endScrolling=()=>{r=!1,e.endInteraction()},e.updateCursor=()=>{const n=e.getCursorStyles();if(n)switch(e.getActiveInteraction()){case mx:t._apiSpecificRenderWindow.setCursor(n.translateCenter);break;case gx:t._apiSpecificRenderWindow.setCursor(n.rotateLine);break;case fx:t._apiSpecificRenderWindow.setCursor(n.translateAxis);break;default:t._apiSpecificRenderWindow.setCursor(n.default)}},e.handleLeftButtonPress=r=>{if(t.activeState&&t.activeState.getActive()){t._isDragging=!0;const o=t.viewType,a=t.widgetState.getPlanes()[o].normal,i=t.activeState?.getManipulator?.()??t.manipulator;i.setWidgetOrigin(t.widgetState.getCenter()),i.setWidgetNormal(a);const{worldCoords:s}=i.handleEvent(r,t._apiSpecificRenderWindow);n=s,e.startInteraction()}else{if(t.widgetState.getScrollingMethod()!==dx)return jt.VOID;e.startScrolling(r.position)}return jt.EVENT_ABORT},e.handleMouseMove=o=>{if(t._isDragging)return e.handleEvent(o);if(r&&n.y!==o.position.y){const t=n.y-o.position.y;e.translateCenterOnPlaneDirection(t),n=o.position,e.invokeInternalInteractionEvent()}return jt.VOID},e.handleLeftButtonRelease=()=>{(t._isDragging||r)&&e.endScrolling(),t._isDragging=!1,t.widgetState.deactivate()},e.handleRightButtonPress=n=>{t.widgetState.getScrollingMethod()===px&&e.startScrolling(n.position)},e.handleRightButtonRelease=()=>{t.widgetState.getScrollingMethod()===px&&e.endScrolling()},e.handleStartMouseWheel=()=>{e.startInteraction()},e.handleMouseWheel=t=>{const n=t.spinY;return r=!0,e.translateCenterOnPlaneDirection(n),e.invokeInternalInteractionEvent(),r=!1,jt.EVENT_ABORT},e.handleEndMouseWheel=()=>{e.endScrolling()},e.handleMiddleButtonPress=n=>{t.widgetState.getScrollingMethod()===ux&&e.startScrolling(n.position)},e.handleMiddleButtonRelease=()=>{t.widgetState.getScrollingMethod()===ux&&e.endScrolling()},e.handleEvent=n=>t.activeState.getActive()?(e[e.getActiveInteraction()](n),e.invokeInternalInteractionEvent(),jt.EVENT_ABORT):jt.VOID,e.invokeInternalInteractionEvent=()=>{const t=e.getActiveInteraction(),n=t!==gx,r=t===gx;e.invokeInteractionEvent({computeFocalPointOffset:n,canUpdateFocalPoint:r})},e.startInteraction=()=>{e.invokeStartInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().requestAnimation(e)}))},e.endInteraction=()=>{e.invokeEndInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().cancelAnimation(e)}))},e.translateCenterOnPlaneDirection=n=>{const r=t.widgetState.getPlanes()[t.viewType].normal,o=t.widgetState.getCenter(),a=t.widgetState.getImage().getSpacing(),i=r.map((e=>Math.abs(e))),s=i.indexOf(Math.max(...i)),l=n*a[s]/Math.abs(r[s]);let c=[o[0]+l*r[0],o[1]+l*r[1],o[2]+l*r[2]];c=e.getBoundedCenter(c),t.widgetState.setCenter(c),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[fx]=r=>{const o=e.getActiveLineHandle(),a=e.getActiveLineName(),i=Ho(o.getOrigin(),o.getDirection(),[]),s=o.getDirection();Qo(s);const l=e.getOtherLineHandle(a),c=t.widgetState.getCenter(),u=t.activeState?.getManipulator?.()??t.manipulator;let d=null,p=[];if(t.activeState?.getManipulator?.())d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Ho(c,jo(d,n,[]),p);else if(l){const e=l.getDirection();Qo(e);const n=e,a=Xo(s,e);1!==a&&-1!==a||Yo(s,u.getWidgetNormal(),n);const f=[];d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,su.distanceToLine(d,o.getOrigin(),i,f),p=qo(c,n,Xo(jo(d,f,[]),n),p)}p=e.getBoundedCenter(p),t.widgetState.setCenter(p),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition()),n=d},e.getBoundedCenter=e=>{const n=t.widgetState.getCenter(),r=t.widgetState.getImage().getBounds();return Ui.containsPoint(r,...e)?e:function(e,t,n){const r=[0,0,0];jo(t,e,r);const o=[0,0,0];return Ui.intersectBox(n,e,r,o,[0,0,0]),o}(e,n,r)},e[mx]=r=>{const o=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:a}=o.handleEvent(r,t._apiSpecificRenderWindow),i=jo(a,n,[]);n=a;let s=Ho(t.widgetState.getCenter(),i,[]);s=e.getBoundedCenter(s),t.widgetState.setCenter(s),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[gx]=n=>{const r=e.getActiveLineHandle(),o=t.activeState?.getManipulator?.()??t.manipulator,a=o.getWidgetNormal(),{worldCoords:i}=o.handleEvent(n,t._apiSpecificRenderWindow);if(!i||!i.length)return;const s=[0,0,0];jo(i,t.widgetState.getCenter(),s),Qo(s);const l=r.getDirection();Qo(l);const c=e.getActiveRotationPointName();("point1"===c||!c&&Xo(s,l)<0)&&Ko(l,-1);const u=ta(l,s,a);e.rotateLineInView(e.getActiveLineName(),u)},e.rotateLineInView=(n,r)=>{const o=bx[Tx(n)],a=bx[Cx(n)],i=t.widgetState.getPlanes()[a].normal;if(e.rotatePlane(o,r,i),e.getKeepOrthogonality()){const o=Tx(Ax(t.widgetState,n));e.rotatePlane(bx[o],r,i)}Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.rotatePlane=(e,n,r)=>{const{normal:o,viewUp:a}=t.widgetState.getPlanes()[e],i=xx(o,r,n),s=xx(a,r,n);t.widgetState.getPlanes()[e]={normal:i,viewUp:s}}}const gw="default";function mw(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function hw(e,t){t.classHierarchy.push("vtkWidgetState");const n=[];t.labels={},t.nestedStates=[],e.bindState=function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[gw];if(t.nestedStates.push(r),n.push(r.onModified(e.modified)),Array.isArray(o)&&o.length)for(let e=0;e{for(;n.length;)n.pop().unsubscribe();mw(t.nestedStates,r);for(let r=0;r{mw(t.labels[e],r)}))},e.unbindAll=()=>{for(;n.length;)n.pop().unsubscribe();t.nestedStates=[]},e.activate=()=>e.setActive(!0),e.deactivate=n=>{n!==e&&e.setActive(!1);for(let e=0;e{t&&t.setActive(!0),e.deactivate(t)},e.getStatesWithLabel=e=>t.labels[e],e.getAllNestedStates=()=>t.nestedStates,e.delete=jt.chain(e.unbindAll,e.delete)}const vw={active:!1};var yw=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vw,n),jt.obj(e,t),jt.setGet(e,t,["active"]),hw(e,t)};function bw(e,t){const n=[],r=[...Ui.INIT_BOUNDS];e.containsPoint=(e,t,n)=>Array.isArray(e)?Ui.containsPoint(r,e[0],e[1],e[2]):Ui.containsPoint(r,e,t,n),e.placeWidget=o=>{t.bounds=[];const a=[(o[0]+o[1])/2,(o[2]+o[3])/2,(o[4]+o[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];n[e]=o[e],t.bounds[e]=(o[e]-r)*t.placeFactor+r}Ui.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()},e.setPlaceFactor=o=>{if(t.placeFactor!==o){t.placeFactor=o,t.bounds=[];const a=[(n[0]+n[1])/2,(n[2]+n[3])/2,(n[4]+n[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];t.bounds[e]=(n[e]-r)*t.placeFactor+r}Ui.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()}}}const xw={bounds:[-1,1,-1,1,-1,1],placeFactor:1};var Tw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xw,n),jt.setGetArray(e,t,["bounds"],6),jt.get(e,t,["placeFactor"]),jt.event(e,t,"BoundsChange"),t.bounds=t.bounds.slice(),bw(e,t)}};const Cw={color:.5};var Sw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cw,n),jt.setGet(e,t,["color"])}};const Aw={color3:[255,255,255],opacity:255};var Pw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Aw,n),jt.setGetArray(e,t,["color3"],3,255),jt.setGet(e,t,["opacity"])}};function Iw(e,t){e.translate=(t,n,r)=>{const[o,a,i]=e.getCornerByReference();e.setCorner(o+t,a+n,i+r)}}const ww={corner:[0,0,0]};var Ow={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ww,n),jt.setGetArray(e,t,["corner"],3),Iw(e)}};function Mw(e,t){const n="degree"===t.angleUnit?$f():qf();e.rotateFromDirections=(r,o)=>{n.identity().rotateFromDirections(r,o).apply(t.direction),e.modified()},e.rotate=(e,r)=>{n.identity().rotate(e,r).apply(t.direction)},e.rotateX=e=>{n.identity().rotateX(e).apply(t.direction)},e.rotateY=e=>{n.identity().rotateY(e).apply(t.direction)},e.rotateZ=e=>{n.identity().rotateZ(e).apply(t.direction)}}const Rw={direction:[1,0,0]};var Vw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rw,n),jt.setGetArray(e,t,["direction"],3),Mw(e,t)}};function Ew(e,t){e.updateManipulator=()=>{if(t.manipulator){const{origin:e,normal:n,direction:r}=t,{setHandleOrigin:o,setHandleCenter:a,setHandleNormal:i,setHandleDirection:s}=t.manipulator;e&&o?o(e):e&&a&&a(e),r&&s?s(r):r&&!n&&i?i(r):n&&s&&s(n)}}}const Dw={manipulator:null};var Lw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dw,n),jt.setGet(e,t,["manipulator"]),Ew(e,t)}};const Bw={name:""};var Nw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bw,n),jt.setGet(e,t,["name"])}};function kw(e,t){return 3===e.length&&3===t.length&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Fw(e,t){const n={o:[],p1:[],p2:[]};e.normalize=()=>{Qo(t.up),Qo(t.right),Qo(t.direction),e.modified()},e.updateFromOriginRightUp=(r,o,a)=>{(function(e,t,n,r){return kw(e,r.o)&&kw(t,r.p1)&&kw(n,r.p2)})(r,o,a,n)||(n.o=r.slice(),n.p1=o.slice(),n.p2=a.slice(),t.up=[a[0]-r[0],a[1]-r[1],a[2]-r[2]],t.right=[o[0]-r[0],o[1]-r[1],o[2]-r[2]],Yo(t.up,t.right,t.direction),Yo(t.direction,t.up,t.right),e.normalize(),e.modified())}}const _w={up:[0,1,0],right:[1,0,0],direction:[0,0,1]};var Gw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_w,n),jt.setGetArray(e,t,["up","right","direction"],3),Fw(e,t)}};function Uw(e,t){const n={...e};e.translate=(t,n,r)=>{const[o,a,i]=e.getOriginByReference();e.setOrigin(o+t,a+n,i+r)},e.getOrigin=e=>{const r=n.getOrigin();if(!t.offset)return r;if(!e)return za.add(r,t.offset,r);const o=YP(r,e),{rendererPixelDims:a}=e,i=Math.min(a[0],a[1]);return za.multiplyAccumulate(r,t.offset,i*o,r)}}const Ww={origin:null,offset:null};var zw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ww,n),jt.setGetArray(e,t,["origin","offset"],3),Uw(e,t)}};const Hw={scale1:.5};var jw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hw,n),jt.setGet(e,t,["scale1"])}};const Kw={scale3:[1,1,1]};var $w={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kw,n),jt.setGetArray(e,t,["scale3"],3)}};const qw={text:"DefaultText"};var Xw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qw,n),jt.setGet(e,t,["text"])}};const Yw={visible:!0};var Zw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yw,n),jt.setGet(e,t,["visible"]),e.isVisible=e.getVisible}};const Qw={shape:""};var Jw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qw,n),jt.setGet(e,t,["shape"])}};const{vtkErrorMacro:eO}=jt,tO={bounds:Tw,color:Sw,color3:Pw,corner:Ow,direction:Vw,manipulator:Lw,name:Nw,orientation:Gw,origin:zw,scale1:jw,scale3:$w,text:Xw,visible:Zw,shape:Jw};function nO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];o||yw(n,r,t);for(let o=0;o{const r=nO(n,{...o,...e});return this.publicAPI.bindState(r,t),this.model[a].push(r),this.publicAPI.modified(),r},this.publicAPI[`remove${jt.capitalize(r)}`]=e=>{let t=this.model[a].indexOf(e);-1===t&&ethis.model[a].slice(),this.publicAPI[`clear${jt.capitalize(r)}List`]=()=>{for(;this.model[a].length;){const e=this.model[a].pop();e&&this.publicAPI.unbindState(e)}this.publicAPI.modified()},this}addStateFromMixin(e){let{labels:t,mixins:n,name:r,initialValues:o}=e;const a=nO(n,o);return this.model[r]=a,this.publicAPI.bindState(a,t),jt.setGet(this.publicAPI,this.model,[r]),this}addStateFromInstance(e){let{labels:t,name:n,instance:r}=e;return this.model[n]=r,this.publicAPI.bindState(r,t),jt.setGet(this.publicAPI,this.model,[n]),this}addField(e){let{name:t,initialValue:n}=e;return Array.isArray(n)?jt.setGetArray(this.publicAPI,this.model,[t],n.length):jt.setGet(this.publicAPI,this.model,[t]),this.model[t]=n,this}build(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:vx;const t=oO().addField({name:"center",initialValue:[0,0,0]}).addField({name:"image",initialValue:null}).addField({name:"activeViewType",initialValue:null}).addField({name:"planes",initialValue:e.reduce(((e,t)=>({...e,[bx[t]]:{normal:aO[t].normal,viewUp:aO[t].viewUp}})),{})}).addField({name:"scrollingMethod",initialValue:ux}).addField({name:"cameraOffsets",initialValue:{}}).addField({name:"viewUpFromViewType",initialValue:{}}).addStateFromMixin({labels:["handles","sphere","center"],mixins:["origin","color3","scale1","visible","manipulator"],name:"centerHandle",initialValues:{scale1:30,color3:[255,255,255]}});return e.reduce(((t,n)=>e.filter((e=>e!==n)).reduce(((e,t)=>{e.addStateFromMixin({labels:["handles","line",`lineIn${n}`,`${t}in${n}`],mixins:["origin","color3","scale3","orientation","visible","manipulator"],name:`axis${t}in${n}`,initialValues:{scale3:[4,4,4],color3:iO[t]}});for(let r=0;r<2;++r)e.addStateFromMixin({labels:["handles","sphere","rotation",`rotationIn${n}`,`${t}in${n}`,`point${r}`],mixins:["origin","color3","scale1","visible","manipulator"],name:`rotationHandle${t}in${n}${r}`,initialValues:{scale1:30,color3:iO[t]}});return e}),t)),t),t.build()}const{vtkErrorMacro:lO}=jt;function cO(e,t){t.classHierarchy.push("vtkResliceCursorWidget"),t.methodsToLink=["scaleInPixels"],e.getRepresentationsForViewType=e=>{switch(e){case sx.XY_PLANE:case sx.XZ_PLANE:case sx.YZ_PLANE:return[{builder:cw,labels:[`lineIn${yx[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels}},{builder:pw,labels:[`rotationIn${yx[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}},{builder:pw,labels:["center"],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}}];case sx.DEFAULT:case sx.GEOMETRY:case sx.SLICE:case sx.VOLUME:default:return[]}},e.setImage=e=>{t.widgetState.setImage(e);const n=e.getCenter();t.widgetState.setCenter(n),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)},e.setCenter=n=>{t.widgetState.setCenter(n),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition),e.modified()},e.updateCameraPoints=(n,r,o,a,i)=>{e.resetCamera(n,r,o,a),i&&function(e,n){const r=n.getActiveCamera().getFocalPoint(),o=t.widgetState.getCenter(),a=n.getRenderWindow().getViews()[0].getViewportSize(n),i=a[0]/a[1],s=jo(n.worldToNormalizedDisplay(...r,i),n.worldToNormalizedDisplay(...o,i),[0,0,0]),l=t.widgetState.getCameraOffsets();l[e]=s,t.widgetState.setCameraOffsets(l)}(r,n)},e.resetCamera=(n,r,o,a)=>{const i=t.widgetState.getImage().getCenter(),s=n.getActiveCamera().getFocalPoint(),l=n.getActiveCamera().getPosition(),c=Math.sqrt(ea(l,s)),u=e.getPlaneNormalFromViewType(r),d=o?i:s,p=qo(d,u,c,[0,0,0]);n.getActiveCamera().setFocalPoint(...d),n.getActiveCamera().setPosition(...p),n.getActiveCamera().setViewUp(t.widgetState.getPlanes()[r].viewUp),function(e,n,r,o,a){const i=e.getActiveCamera().getFocalPoint(),s=e.getActiveCamera().getDistance(),l=qo(i,n,s,[0,0,0]);let c=i;if(o&&(c=ri.intersectWithLine(i,l,t.widgetState.getCenter(),n).x),a){const o=t.widgetState.getCenter(),a=e.getRenderWindow().getViews()[0].getViewportSize(e),i=a[0]/a[1],s=Ho(e.worldToNormalizedDisplay(...o,i),t.widgetState.getCameraOffsets()[r],[0,0,0]),u=e.normalizedDisplayToWorld(...s,i),d=ri.intersectWithLine(u,l,o,n);c[0]=d.x[0],c[1]=d.x[1],c[2]=d.x[2]}e.getActiveCamera().setFocalPoint(c[0],c[1],c[2]);const u=qo(c,n,s,[0,0,0]);e.getActiveCamera().setPosition(u[0],u[1],u[2]);const d=t.widgetState.getImage().getBounds();o&&e.resetCamera(d),e.resetCameraClippingRange(d)}(n,u,r,o,a)},e.getPlaneSource=n=>{const r=function(n){const r=t.widgetState.getImage().getBounds(),o=e.getWidgetState().getCenter(),a=t.widgetState.getImage().getCenter(),i=[];for(let e=0;e<3;e++)i[e]=-Math.abs(o[e]-a[e]),i[e]*=2;const s=cI.newInstance();return n===sx.XZ_PLANE?(s.setOrigin(r[0]+i[0],o[1],r[4]+i[2]),s.setPoint1(r[1]-i[0],o[1],r[4]+i[2]),s.setPoint2(r[0]+i[0],o[1],r[5]-i[2])):n===sx.XY_PLANE?(s.setOrigin(r[0]+i[0],r[2]+i[1],o[2]),s.setPoint1(r[1]-i[0],r[2]+i[1],o[2]),s.setPoint2(r[0]+i[0],r[3]-i[1],o[2])):n===sx.YZ_PLANE&&(s.setOrigin(o[0],r[2]+i[1],r[4]+i[2]),s.setPoint1(o[0],r[3]-i[1],r[4]+i[2]),s.setPoint2(o[0],r[2]+i[1],r[5]-i[2])),s}(n),{normal:o,viewUp:a}=t.widgetState.getPlanes()[n];!function(e,t,n,r){e.setNormal(n);const o=ta(jo(e.getPoint2(),e.getOrigin(),[]),r,n);e.rotate(o,n),e.setCenter(t)}(r,t.widgetState.getCenter(),o,a);const i=[...r.getOrigin()],s=[...r.getPoint1()],l=[...r.getPoint2()];return function(e,t,n,r){const o=[];jo(n,t,o),Qo(o);const a=[];jo(r,t,a),Qo(a);const i=[0,0,1];Yo(o,a,i),Qo(i);const s=[...e],l=[...i];Ko(l,1e-6),Ui.addBounds(s,e[0]+l[0],e[1]+l[0],e[2]+l[1],e[3]+l[1],e[4]+l[2],e[5]+l[2]),Ui.addBounds(s,e[0]-l[0],e[1]-l[0],e[2]-l[1],e[3]-l[1],e[4]-l[2],e[5]-l[2]);const c=ri.newInstance();c.setOrigin(...t),c.setNormal(...i);const u=eg.newInstance();u.setBounds(s);const d=zf.newInstance();d.setCutFunction(c),d.setInputConnection(u.getOutputPort());const p=d.getOutputData();if(0===p.getNumberOfPoints())return!1;const f=_i.computeLocalBounds(p.getPoints(),o,a,i);for(let e=0;e<3;e+=1)t[e]=f[0]*o[e]+f[2]*a[e]+f[4]*i[e],n[e]=f[1]*o[e]+f[2]*a[e]+f[4]*i[e],r[e]=f[0]*o[e]+f[3]*a[e]+f[4]*i[e]}(t.widgetState.getImage().getBounds(),i,s,l),r.setOrigin(...i),r.setPoint1(...s),r.setPoint2(...l),r},e.getResliceAxes=n=>{const r=e.getPlaneSource(n),{normal:o}=t.widgetState.getPlanes()[n],a=r.getOrigin(),i=[];jo(r.getPoint1(),a,i),Qo(i);const s=[];jo(r.getPoint2(),a,s),Qo(s);const l=g(new Float64Array(16));for(let e=0;e<3;e++)l[e]=i[e],l[4+e]=s[e],l[8+e]=o[e],l[12+e]=a[e];return l},e.updateReslicePlane=(n,r)=>{const o=t.widgetState.getImage().getSpacing(),a=e.getPlaneSource(r),i=e.getResliceAxes(r),s=a.getOrigin(),l=jo(a.getPoint1(),s,[]),c=Qo(l),u=jo(a.getPoint2(),s,[]),d=Qo(u),p=Math.abs(l[0]*o[0])+Math.abs(l[1]*o[1])+Math.abs(l[2]*o[2]),f=Math.abs(u[0]*o[0])+Math.abs(u[1]*o[1])+Math.abs(u[2]*o[2]);let g=0,m=0;const h=0===p?Number.MAX_SAFE_INTEGER:c/p,v=1073741823;if(h>v)lO("Invalid X extent: ",h," on view type : ",r),g=0;else for(g=1;gv)lO("Invalid Y extent:",y," on view type : ",r),m=0;else for(m=1;m{const n=cI.newInstance(),r=e.getWidgetState().getCenter(),o=e.getPlaneNormalFromViewType(t);return n.setNormal(o),n.setOrigin(r),n},e.getPlaneNormalFromViewType=t=>e.getWidgetState().getPlanes()[t].normal,e.getOtherPlaneNormals=t=>[sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE].filter((e=>e!==t)).map((t=>e.getPlaneNormalFromViewType(t))),e.getResliceMatrix=()=>{const t=g(new Float64Array(16));for(let n=0;n<3;n++)t[4*n+0]=e.getPlaneNormalFromViewType(sx.YZ_PLANE)[n],t[4*n+1]=e.getPlaneNormalFromViewType(sx.XZ_PLANE)[n],t[4*n+2]=e.getPlaneNormalFromViewType(sx.XY_PLANE)[n];const n=e.getWidgetState().getCenter();return qf().translate(...n).multiply(t).translate(...Ko([...n],-1)).getMatrix()},e.getDisplayScaleParams=()=>[sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE].reduce(((t,n)=>(t[n]=function(t){const n=function(t){return e.getViewIds().map((t=>e.getWidgetForView({viewId:t}))).find((e=>e.getViewType()===t))}(t);return n?n.getRepresentations():[]}(n)[0]?.getDisplayScaleParams?.(),t)),{}),e.setScaleInPixels=jt.chain(e.setScaleInPixels,(n=>{e.getViewWidgets().forEach((e=>e.setScaleInPixels(n))),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)}))}const uO=e=>({behavior:fw,widgetState:sO(e.planes),rotationHandlePosition:.5,scaleInPixels:!0,manipulator:_P.newInstance(),...e});function dO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uO(n)),oI.extend(e,t,n),jt.setGet(e,t,["scaleInPixels","rotationHandlePosition","manipulator"]),cO(e,t)}var pO={newInstance:jt.newInstance(dO,"vtkResliceCursorWidget"),extend:dO};const fO={Aorta:JSON.parse('{"position":[176.85899353027344,215.45899963378906,145,165.48199462890625,217.89700317382812,130,163.85699462890625,217.0850067138672,115,165.48199462890625,209.77099609375,102.5,167.28799438476562,201.093994140625,98.57510375976562,174.79299926757812,191.25,88.81770324707031,178.03799438476562,181.38800048828125,82.13870239257812,184.55099487304688,171.56199645996094,79.0604019165039,184.55099487304688,150.468994140625,82.81320190429688,186.052001953125,143.43699645996094,90.31880187988281,187.42300415039062,133.38299560546875,107.5,187.42300415039062,129.31900024414062,127.5,189.0489959716797,127.69400024414062,135,189.0489959716797,128.5070037841797,147.5,189.7259979248047,133.00799560546875,165.4510040283203,190.6739959716797,145.57200622558594,195,191.48599243164062,155.32400512695312,215,194.73699951171875,166.7010040283203,240,197.1750030517578,175.63999938964844,257.5,197.98800659179688,187.01699829101562,282.5,200.42599487304688,192.7050018310547,302.5,197.1750030517578,200.0189971923828,330],"orientation":[1,0,0,0,0,0.9870474934577942,0.16042834520339966,0,0,0.16042834520339966,-0.9870474934577942,0,0,0,0,1,1,0,0,0,0,0.9985343813896179,0.05412080138921738,0,0,0.05412080138921738,-0.9985343813896179,0,0,0,0,1,1,0,0,0,0,0.9590081572532654,-0.2833784520626068,0,0,-0.2833784520626068,-0.9590081572532654,0,0,0,0,1,1,0,0,0,0,0.7165071368217468,-0.6975797414779663,0,0,-0.6975797414779663,-0.7165071368217468,0,0,0,0,1,1,0,0,0,0,0.5941906571388245,-0.804324209690094,0,0,-0.804324209690094,-0.5941906571388245,0,0,0,0,1,1,0,0,0,0,0.6405233144760132,-0.7679387331008911,0,0,-0.7679387331008911,-0.6405233144760132,0,0,0,0,1,1,0,0,0,0,0.4440542161464691,-0.8959999084472656,0,0,-0.8959999084472656,-0.4440542161464691,0,0,0,0,1,1,0,0,0,0,-0.021809855476021767,-0.9997621178627014,0,0,-0.9997621178627014,0.021809855476021767,0,0,0,0,1,1,0,0,0,0,-0.3716296851634979,-0.9283810257911682,0,0,-0.9283810257911682,0.3716296851634979,0,0,0,0,1,1,0,0,0,0,-0.8222679495811462,-0.5691004991531372,0,0,-0.5691004991531372,0.8222679495811462,0,0,0,0,1,1,0,0,0,0,-0.9348742365837097,-0.35497915744781494,0,0,-0.35497915744781494,0.9348742365837097,0,0,0,0,1,1,0,0,0,0,-0.9792650938034058,-0.20258307456970215,0,0,-0.20258307456970215,0.9792650938034058,0,0,0,0,1,1,0,0,0,0,-0.9991768598556519,-0.04056640341877937,0,0,-0.04056640341877937,0.9991768598556519,0,0,0,0,1,1,0,0,0,0,-0.9851123690605164,0.17191165685653687,0,0,0.17191165685653687,0.9851123690605164,0,0,0,0,1,1,0,0,0,0,-0.9411081671714783,0.33810555934906006,0,0,0.33810555934906006,0.9411081671714783,0,0,0,0,1,1,0,0,0,0,-0.9117909073829651,0.41065481305122375,0,0,0.41065481305122375,0.9117909073829651,0,0,0,0,1,1,0,0,0,0,-0.9051862955093384,0.42501509189605713,0,0,0.42501509189605713,0.9051862955093384,0,0,0,0,1,1,0,0,0,0,-0.9022176265716553,0.43128111958503723,0,0,0.43128111958503723,0.9022176265716553,0,0,0,0,1,1,0,0,0,0,-0.9022176265716553,0.43128111958503723,0,0,0.43128111958503723,0.9022176265716553,0,0,0,0,1,1,0,0,0,0,-0.9350248575210571,0.3545822501182556,0,0,0.3545822501182556,0.9350248575210571,0,0,0,0,1,1,0,0,0,0,-0.9645187854766846,0.2640141546726227,0,0,0.2640141546726227,0.9645187854766846,0,0,0,0,1,1,0,0,0,0,-0.9664039015769958,0.25702813267707825,0,0,0.25702813267707825,0.9664039015769958,0,0,0,0,1]}'),Spine:JSON.parse('{"position":[160.4759162404053,183.8086909344981,2.5000000000000564,159.36266071728213,177.68578555732046,15.000000000000057,161.03254400196693,165.99660256452688,27.500000000000057,163.81568280977493,151.52428076392528,42.50000000000006,166.04219385602133,139.83509777113167,57.50000000000006,167.71207714070613,128.14591477833807,72.50000000000006,166.59882161758293,119.79649835491408,90.00000000000006,166.04219385602133,112.00370969305168,112.50000000000006,166.59882161758293,109.77719864680527,132.50000000000006,166.04219385602133,109.77719864680527,150.00000000000006,167.71207714070613,113.67359297773648,172.50000000000006,172.16509923319893,118.68324283179088,195.00000000000006,173.83498251788373,122.57963716272208,207.50000000000006,177.7313768488149,124.80614820896851,217.50000000000006,180.5145156566229,133.7121923939541,240.00000000000006,189.4205598416085,146.5146309098709,267.50000000000006,191.0904431262933,159.31706942578768,297.50000000000006,187.7506765569237,170.44962465701968,330.00000000000006],"orientation":[1,0,0,0,0,-0.8951910891649871,-0.43849362667598396,0,0.07972611394108559,0.43849362667598396,-0.8951910891649871,0,0,0,0,1,1,0,0,0,0,-0.8142932282848118,-0.5801705176511281,0,-0.01813032867659868,0.5801705176511281,-0.8142932282848118,0,0,0,0,1,1,0,0,0,0,-0.7195837665033622,-0.6845597875137116,0,-0.11652081489595105,0.6845597875137116,-0.7195837665033622,0,0,0,0,1,1,0,0,0,0,-0.7477784430289229,-0.6521003107232924,0,-0.12487027226616237,0.6521003107232924,-0.7477784430289229,0,0,0,0,1,1,0,0,0,0,-0.7846711616302167,-0.6114776531642354,0,-0.10191294219403924,0.6114776531642354,-0.7846711616302167,0,0,0,0,1,1,0,0,0,0,-0.8511163169270675,-0.5247747363540923,0,-0.01457707600983591,0.5247747363540923,-0.8511163169270675,0,0,0,0,1,1,0,0,0,0,-0.9266413781634073,-0.3739508791706536,0,0.03868457370730903,0.3739508791706536,-0.9266413781634073,0,0,0,0,1,1,0,0,0,0,-0.9733185352162832,-0.22945812037151517,0,0,0.22945812037151517,-0.9733185352162832,0,0,0,0,1,1,0,0,0,0,-0.9982420327181917,-0.05926925100465373,0,0,0.05926925100465373,-0.9982420327181917,0,0,0,0,1,1,0,0,0,0,-0.9949075323347023,0.09691380171974212,0,-0.027689657634212037,-0.09691380171974212,-0.9949075323347023,0,0,0,0,1,1,0,0,0,0,-0.9723492573007179,0.19243967663906952,0,-0.13230227768936031,-0.19243967663906952,-0.9723492573007179,0,0,0,0,1,1,0,0,0,0,-0.9554829059915173,0.24313065653596855,0,-0.16715232636847838,-0.24313065653596855,-0.9554829059915173,0,0,0,0,1,1,0,0,0,0,-0.9385406161572778,0.25540423934973344,0,-0.23218567213611907,-0.25540423934973344,-0.9385406161572778,0,0,0,0,1,1,0,0,0,0,-0.9286472589653068,0.3180989815619539,0,-0.19085938893717125,-0.3180989815619539,-0.9286472589653068,0,0,0,0,1,1,0,0,0,0,-0.8968851226076998,0.3894003033765195,0,-0.20967708643351063,-0.3894003033765195,-0.8968851226076998,0,0,0,0,1,1,0,0,0,0,-0.9008921273230787,0.4011692545922503,0,-0.16570034428810357,-0.4011692545922503,-0.9008921273230787,0,0,0,0,1,1,0,0,0,0,-0.9335720675686494,0.35752066559629414,0,0.02494330225090427,-0.35752066559629414,-0.9335720675686494,0,0,0,0,1,1,0,0,0,0,-0.941598797565795,0.32253540367885714,0,0.09676062110365714,-0.32253540367885714,-0.941598797565795,0,0,0,0,1]}')},gO=Object.keys(fO),mO=nA.newInstance(),hO=mO.getRenderer(),vO=mO.getRenderWindow();mO.addController('
    ');const yO=document.getElementById("angle"),bO=document.getElementById("centerline"),xO=document.getElementById("mode"),TO=vO.getInteractor();TO.setInteractorStyle(LP.newInstance()),TO.setDesiredUpdateRate(15);const CO=pO.newInstance({planes:["Y","Z"],behavior:function(e,t){fw(e,t),e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("lineInY").includes(t.activeState)?hx:t.widgetState.getStatesWithLabel("lineInZ").includes(t.activeState)||t.widgetState.getStatesWithLabel("rotationInZ").includes(t.activeState)?gx:null,e[hx]=n=>{const r=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:o,worldDirection:a}=r.handleEvent(n,t._apiSpecificRenderWindow);e.updateCenterAndPlanes(o,a)},e.updateCenterAndPlanes=(n,r)=>{const o=e.getBoundedCenter(n);if(t.widgetState.setCenter(o),r){const e=e=>Vn([],r.slice(3*e,3*e+3)),n=t.widgetState.getPlanes();Object.keys(n).forEach((t=>{switch(Number.parseInt(t,10)){case sx.YZ_PLANE:n[t]={normal:e(0),viewUp:e(2)};break;case sx.XZ_PLANE:n[t]={normal:e(1),viewUp:e(2)};break;case sx.XY_PLANE:n[t]={normal:e(2),viewUp:e(1)}}}))}Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.translateCenterOnPlaneDirection=n=>{const r=t._factory.getManipulator()?.handleScroll;if(r){const{worldCoords:t,worldDirection:o}=r(n);e.updateCenterAndPlanes(t,o)}}}}),SO=eI.newInstance();SO.setRenderer(hO);const AO=sx.XZ_PLANE,PO=sx.XY_PLANE,IO=SO.addWidget(CO,AO),wO=CO.getWidgetState();wO.getStatesWithLabel("sphere").forEach((e=>e.setScale1(20))),wO.getCenterHandle().setVisible(!1),wO.getStatesWithLabel("rotationInY").forEach((e=>e.setVisible(!1)));const OO=rT.newInstance();OO.setViewport(.7,0,1,.3),vO.addRenderer(OO),vO.setNumberOfLayers(2),OO.setLayer(1);const MO=eI.newInstance();MO.setRenderer(OO);const RO=MO.addWidget(CO,PO),VO=bP.newInstance();VO.setTransformInputSampling(!1),VO.setAutoCropOutput(!0),VO.setOutputDimensionality(2);const EO=zA.newInstance();EO.setBackgroundColor(0,0,0,0),EO.setInputConnection(VO.getOutputPort());const DO=RP.newInstance();DO.setMapper(EO);const LO=TA.newInstance({fetchGzip:!0}),BO=Pu.newInstance(),NO=RP.newInstance(),kO=BA.newInstance();kO.setBackgroundColor(0,0,0,0),NO.setMapper(kO),kO.setInputConnection(LO.getOutputPort(),0),kO.setInputData(BO,1),kO.setWidth(400);const FO=Bx.newInstance({cprActor:NO}),_O=_P.newInstance();function GO(){const e=wO.getPlanes(),t=e[AO].normal,n=e[AO].viewUp;e[PO].normal=n,e[PO].viewUp=t;const r=Dn([],t,n);Vn(r,r);const o=wO.getCenter(),a=FO.getCurrentDistance(),{orientation:i}=kO.getCenterlinePositionAndOrientation(a),s=Pe([],i),l=ge([],s),c=ue(...r,...t,...n),u=Ne([],l,c);kO.setDirectionMatrix(u),CO.updateReslicePlane(VO,PO),DO.setUserMatrix(VO.getResliceAxes()),CO.updateCameraPoints(OO,PO,!1,!0,!1),OO.getActiveCamera().setViewUp(s[3],s[4],s[5]),_O.setUserOrigin(o),_O.setUserNormal(n);const d=180*Math.atan2(u[1],u[0])/Math.PI,f=d>0?d:360+d;yO.value=f,Ix(wO,CO.getScaleInPixels(),CO.getRotationHandlePosition());const g=kO.getWidth(),m=kO.getHeight(),h=Mn([],o,r,-.5*g);Mn(h,h,n,a-m);const v=p(...r,0,...n,0,...On([],t,-1),0,...h,1);NO.setUserMatrix(v);const y=hO.getActiveCamera(),b=.5*m/Math.tan(Eo(.5*y.getViewAngle()));y.setParallelScale(.5*m),y.setParallelProjection(!0);const x=Mn([],o,n,a-.5*m),T=Mn([],x,t,-b);y.setPosition(...T),y.setFocalPoint(...x),y.setViewUp(...n),hO.resetCameraClippingRange(),TO.render(),vO.render()}let UO,WO=gO[0],zO=null;function HO(e){WO=e;const t=fO[e];if(!zO)return;const n=Float32Array.from(t.position),r=n.length/3;BO.getPoints().setData(n,3);const o=new Uint16Array(1+r);o[0]=r;for(let e=0;eHO(bO.value))),LO.setUrl("/vtk-js/data/volume/LIDC2.vti").then((()=>{LO.loadData().then((()=>{const e=LO.getOutputData();CO.setImage(e);const t=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}([],e.getDimensions(),e.getSpacing());kO.setWidth(2*Un(t)),NO.setUserMatrix(CO.getResliceAxes(AO)),hO.addVolume(NO),CO.updateCameraPoints(hO,AO,!0,!1,!0),VO.setInputData(e),OO.addActor(DO),CO.updateReslicePlane(VO,PO),DO.setUserMatrix(VO.getResliceAxes()),CO.updateCameraPoints(OO,PO,!0,!1,!0),zO=e,HO(WO),n.g.imageData=e}))})),yO.addEventListener("input",(()=>function(e){const t=[0,1,0];var n,r,o,a,i,s;n=t,a=e,s=[],(i=[])[0]=(r=t)[0]-(o=[0,0,0])[0],i[1]=r[1]-o[1],i[2]=r[2]-o[2],s[0]=i[0]*Math.cos(a)-i[1]*Math.sin(a),s[1]=i[0]*Math.sin(a)+i[1]*Math.cos(a),s[2]=i[2],n[0]=s[0]+o[0],n[1]=s[1]+o[1],n[2]=s[2]+o[2];const l=FO.getCurrentDistance(),{orientation:c}=kO.getCenterlinePositionAndOrientation(l),u=Pe([],c),d=Bn([],t,u),p=Bn([],[0,0,1],u),f=wO.getPlanes();f[AO].normal=d,f[AO].viewUp=p,f[PO].normal=p,f[PO].viewUp=d,wO.setPlanes(f),GO()}(Eo(Number.parseFloat(yO.value,10)))));const jO=document.createElement("option");jO.innerText="Stretched Mode",jO.value="stretched",xO.appendChild(jO);const KO=document.createElement("option");KO.innerText="Straightened Mode",KO.value="straightened",xO.appendChild(KO),xO.addEventListener("input",(()=>function(e){UO=e,"stretched"===UO?(kO.useStretchedMode(),GO()):(kO.useStraightenedMode(),GO())}(xO.value))),xO.value="straightened",IO.onInteractionEvent(GO),RO.onInteractionEvent(GO),n.g.source=LO,n.g.mapper=kO,n.g.actor=NO,n.g.renderer=hO,n.g.renderWindow=vO,n.g.centerline=BO,n.g.centerlines=fO},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),a=Object.prototype.toString,i=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),c=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===a.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},a=r(t);o&&(a=i.call(a,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var h=0;h=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),a=n(965),i=n(332),s=n(65),l=n(182),c=n(293);c.alea=r,c.xor128=o,c.xorwow=a,c.xorshift7=i,c.xor4096=s,c.tychei=l,e.exports=c},64:function(e,t,n){var r;!function(e,o,a){function i(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new i(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,a=t.i;return t.w=r=r+1640531527|0,n=o[a+34&127],e=o[a=a+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[a]=n^e,t.i=a,n+(r^r>>>16)|0},function(e,t){var n,r,o,a,i,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,a=-32;a>>15,r^=r<<4,r^=r>>>13,a>=0&&(i=i+1640531527|0,o=0==(n=s[127&a]^=r+i)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,a=512;a>0;--a)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=i,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,a,i){var s,l=256,c=i.pow(l,6),u=i.pow(2,52),d=2*u,p=255;function f(e,t,n){var r=[],p=v(h((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(a)]}}():e,3),r),f=new g(r),b=function(){for(var e=f.g(6),t=c,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),a),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(i.random=e,t):e})(b,p,"global"in t?t.global:this==i,t.state)}function g(e){var t,n=e.length,r=this,o=0,a=r.i=r.j=0,i=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|a>>>20)+n|0)&n|~a&r)+t[2]+606105819|0)<<17|o>>>15)+a|0)&a|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|a>>>20)+n|0)&n|~a&r)+t[6]-1473231341|0)<<17|o>>>15)+a|0)&a|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|a>>>20)+n|0)&n|~a&r)+t[10]-42063|0)<<17|o>>>15)+a|0)&a|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|a>>>20)+n|0)&n|~a&r)+t[14]-1502002290|0)<<17|o>>>15)+a|0)&a|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|a>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+a|0)&n|a&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|a>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+a|0)&n|a&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|a>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+a|0)&n|a&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|a>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+a|0)&n|a&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|a>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+a|0)^a^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|a>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+a|0)^a^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|a>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+a|0)^a^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|a>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+a|0)^a^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[14]-1416354905|0)<<15|o>>>17)+a|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[10]-1051523|0)<<15|o>>>17)+a|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[6]-1560198380|0)<<15|o>>>17)+a|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[2]+718787259|0)<<15|o>>>17)+a|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function a(e){var t,o,a,i,s,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}function i(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tc?new ArrayBuffer(0):(r=c-l,o=new ArrayBuffer(r),a=new Uint8Array(o),i=new Uint8Array(this,l,r),a.set(i),o)}}(),u.prototype.append=function(e){return this.appendBinary(l(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},u.prototype.end=function(e){var t,n,r=this._buff,o=r.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,t){var r,o,a,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(n(this._hash,e),i=0;i<16;i+=1)e[i]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),a=parseInt(r[1],16)||0,e[14]=o,e[15]=a,n(this._hash,e)},u.hash=function(e,t){return u.hashBinary(l(e),t)},u.hashBinary=function(e,t){var n=s(a(e));return t?c(n):n},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var t,r,a,i,s,l=(r=this._buff.buffer,a=e,i=!0,(s=new Uint8Array(r.byteLength+a.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(a),r.byteLength),i?s:s.buffer),c=l.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),a=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}(new Uint8Array(e)));return t?c(r):r},u}()},963:function(e,t,n){var r=n(702),o=n(903);void 0===o.ImageCPRMapper&&(o.ImageCPRMapper=r),e.exports=r},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n(963)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},702:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return Q},adjoint:function(){return v},clone:function(){return u},copy:function(){return d},create:function(){return c},determinant:function(){return y},equals:function(){return re},exactEquals:function(){return ne},frob:function(){return Z},fromQuat:function(){return _},fromQuat2:function(){return D},fromRotation:function(){return O},fromRotationTranslation:function(){return E},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return F},fromScaling:function(){return w},fromTranslation:function(){return I},fromValues:function(){return p},fromXRotation:function(){return M},fromYRotation:function(){return R},fromZRotation:function(){return V},frustum:function(){return G},getRotation:function(){return N},getScaling:function(){return B},getTranslation:function(){return L},identity:function(){return g},invert:function(){return h},lookAt:function(){return q},mul:function(){return oe},multiply:function(){return b},multiplyScalar:function(){return ee},multiplyScalarAndAdd:function(){return te},ortho:function(){return K},orthoNO:function(){return j},orthoZO:function(){return $},perspective:function(){return W},perspectiveFromFieldOfView:function(){return H},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return C},rotateX:function(){return S},rotateY:function(){return A},rotateZ:function(){return P},scale:function(){return T},set:function(){return f},str:function(){return Y},sub:function(){return ae},subtract:function(){return J},targetTo:function(){return X},translate:function(){return x},transpose:function(){return m}});var o={};n.r(o),n.d(o,{add:function(){return Re},adjoint:function(){return me},clone:function(){return le},copy:function(){return ce},create:function(){return ie},determinant:function(){return he},equals:function(){return Be},exactEquals:function(){return Le},frob:function(){return Me},fromMat2d:function(){return Ae},fromMat4:function(){return se},fromQuat:function(){return Pe},fromRotation:function(){return Ce},fromScaling:function(){return Se},fromTranslation:function(){return Te},fromValues:function(){return ue},identity:function(){return pe},invert:function(){return ge},mul:function(){return Ne},multiply:function(){return ve},multiplyScalar:function(){return Ee},multiplyScalarAndAdd:function(){return De},normalFromMat4:function(){return Ie},projection:function(){return we},rotate:function(){return be},scale:function(){return xe},set:function(){return de},str:function(){return Oe},sub:function(){return ke},subtract:function(){return Ve},translate:function(){return ye},transpose:function(){return fe}}),n(334);var a=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var s=Math.PI/180;function l(e){return e*s}function c(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function p(e,t,n,r,o,a,s,l,c,u,d,p,f,g,m,h){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=d,v[11]=p,v[12]=f,v[13]=g,v[14]=m,v[15]=h,v}function f(e,t,n,r,o,a,i,s,l,c,u,d,p,f,g,m,h){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=g,e[14]=m,e[15]=h,e}function g(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function m(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],a=t[6],i=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=o,e[13]=i,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function h(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,A=u*m-d*g,P=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*P+S*A;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(o*O-r*M-a*w)*R,e[2]=(m*S-h*C+v*T)*R,e[3]=(p*C-d*S-f*T)*R,e[4]=(l*I-i*M-c*P)*R,e[5]=(n*M-o*I+a*P)*R,e[6]=(h*x-g*S-v*b)*R,e[7]=(u*S-p*x+f*b)*R,e[8]=(i*O-s*I+c*A)*R,e[9]=(r*I-n*O-a*A)*R,e[10]=(g*C-m*x+v*y)*R,e[11]=(d*x-u*C-f*y)*R,e[12]=(s*P-i*w-l*A)*R,e[13]=(n*w-r*P+o*A)*R,e[14]=(m*b-g*T-h*y)*R,e[15]=(u*T-d*b+p*y)*R,e):null}function v(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15];return e[0]=s*(p*v-f*h)-d*(l*v-c*h)+m*(l*f-c*p),e[1]=-(r*(p*v-f*h)-d*(o*v-a*h)+m*(o*f-a*p)),e[2]=r*(l*v-c*h)-s*(o*v-a*h)+m*(o*c-a*l),e[3]=-(r*(l*f-c*p)-s*(o*f-a*p)+d*(o*c-a*l)),e[4]=-(i*(p*v-f*h)-u*(l*v-c*h)+g*(l*f-c*p)),e[5]=n*(p*v-f*h)-u*(o*v-a*h)+g*(o*f-a*p),e[6]=-(n*(l*v-c*h)-i*(o*v-a*h)+g*(o*c-a*l)),e[7]=n*(l*f-c*p)-i*(o*f-a*p)+u*(o*c-a*l),e[8]=i*(d*v-f*m)-u*(s*v-c*m)+g*(s*f-c*d),e[9]=-(n*(d*v-f*m)-u*(r*v-a*m)+g*(r*f-a*d)),e[10]=n*(s*v-c*m)-i*(r*v-a*m)+g*(r*c-a*s),e[11]=-(n*(s*f-c*d)-i*(r*f-a*d)+u*(r*c-a*s)),e[12]=-(i*(d*h-p*m)-u*(s*h-l*m)+g*(s*p-l*d)),e[13]=n*(d*h-p*m)-u*(r*h-o*m)+g*(r*p-o*d),e[14]=-(n*(s*h-l*m)-i*(r*h-o*m)+g*(r*l-o*s)),e[15]=n*(s*p-l*d)-i*(r*p-o*d)+u*(r*l-o*s),e}function y(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],h=e[15];return(t*i-n*a)*(d*h-p*m)-(t*s-r*a)*(u*h-p*g)+(t*l-o*a)*(u*m-d*g)+(n*s-r*i)*(c*h-p*f)-(n*l-o*i)*(c*m-d*f)+(r*l-o*s)*(c*g-u*f)}function b(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],m=t[12],h=t[13],v=t[14],y=t[15],b=n[0],x=n[1],T=n[2],C=n[3];return e[0]=b*r+x*s+T*d+C*m,e[1]=b*o+x*l+T*p+C*h,e[2]=b*a+x*c+T*f+C*v,e[3]=b*i+x*u+T*g+C*y,b=n[4],x=n[5],T=n[6],C=n[7],e[4]=b*r+x*s+T*d+C*m,e[5]=b*o+x*l+T*p+C*h,e[6]=b*a+x*c+T*f+C*v,e[7]=b*i+x*u+T*g+C*y,b=n[8],x=n[9],T=n[10],C=n[11],e[8]=b*r+x*s+T*d+C*m,e[9]=b*o+x*l+T*p+C*h,e[10]=b*a+x*c+T*f+C*v,e[11]=b*i+x*u+T*g+C*y,b=n[12],x=n[13],T=n[14],C=n[15],e[12]=b*r+x*s+T*d+C*m,e[13]=b*o+x*l+T*p+C*h,e[14]=b*a+x*c+T*f+C*v,e[15]=b*i+x*u+T*g+C*y,e}function x(e,t,n){var r,o,a,i,s,l,c,u,d,p,f,g,m=n[0],h=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*h+t[8]*v+t[12],e[13]=t[1]*m+t[5]*h+t[9]*v+t[13],e[14]=t[2]*m+t[6]*h+t[10]*v+t[14],e[15]=t[3]*m+t[7]*h+t[11]*v+t[15]):(r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=f,e[11]=g,e[12]=r*m+s*h+d*v+t[12],e[13]=o*m+l*h+p*v+t[13],e[14]=a*m+c*h+f*v+t[14],e[15]=i*m+u*h+g*v+t[15]),e}function T(e,t,n){var r=n[0],o=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function C(e,t,n,r){var o,i,s,l,c,u,d,p,f,g,m,h,v,y,b,x,T,C,S,A,P,I,w,O,M=r[0],R=r[1],V=r[2],E=Math.hypot(M,R,V);return E0?(n[0]=2*(l*s+d*r+c*a-u*o)/p,n[1]=2*(c*s+d*o+u*r-l*a)/p,n[2]=2*(u*s+d*a+l*o-c*r)/p):(n[0]=2*(l*s+d*r+c*a-u*o),n[1]=2*(c*s+d*o+u*r-l*a),n[2]=2*(u*s+d*a+l*o-c*r)),E(e,t,n),e}function L(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function B(e,t){var n=t[0],r=t[1],o=t[2],a=t[4],i=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(a,i,s),e[2]=Math.hypot(l,c,u),e}function N(e,t){var n=new i(3);B(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,c=t[2]*a,u=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,g=t[9]*o,m=t[10]*a,h=s+d+m,v=0;return h>0?(v=2*Math.sqrt(h+1),e[3]=.25*v,e[0]=(p-g)/v,e[1]=(f-c)/v,e[2]=(l-u)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-g)/v,e[0]=.25*v,e[1]=(l+u)/v,e[2]=(f+c)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-c)/v,e[0]=(l+u)/v,e[1]=.25*v,e[2]=(p+g)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-u)/v,e[0]=(f+c)/v,e[1]=(p+g)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],a=t[1],i=t[2],s=t[3],l=o+o,c=a+a,u=i+i,d=o*l,p=o*c,f=o*u,g=a*c,m=a*u,h=i*u,v=s*l,y=s*c,b=s*u,x=r[0],T=r[1],C=r[2];return e[0]=(1-(g+h))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*T,e[5]=(1-(d+h))*T,e[6]=(m+v)*T,e[7]=0,e[8]=(f+y)*C,e[9]=(m-v)*C,e[10]=(1-(d+g))*C,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function F(e,t,n,r,o){var a=t[0],i=t[1],s=t[2],l=t[3],c=a+a,u=i+i,d=s+s,p=a*c,f=a*u,g=a*d,m=i*u,h=i*d,v=s*d,y=l*c,b=l*u,x=l*d,T=r[0],C=r[1],S=r[2],A=o[0],P=o[1],I=o[2],w=(1-(m+v))*T,O=(f+x)*T,M=(g-b)*T,R=(f-x)*C,V=(1-(p+v))*C,E=(h+y)*C,D=(g+b)*S,L=(h-y)*S,B=(1-(p+m))*S;return e[0]=w,e[1]=O,e[2]=M,e[3]=0,e[4]=R,e[5]=V,e[6]=E,e[7]=0,e[8]=D,e[9]=L,e[10]=B,e[11]=0,e[12]=n[0]+A-(w*A+R*P+D*I),e[13]=n[1]+P-(O*A+V*P+L*I),e[14]=n[2]+I-(M*A+E*P+B*I),e[15]=1,e}function _(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[1]=u+v,e[2]=p-h,e[3]=0,e[4]=u-v,e[5]=1-c-g,e[6]=f+m,e[7]=0,e[8]=p+h,e[9]=f-m,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function G(e,t,n,r,o,a,i){var s=1/(n-t),l=1/(o-r),c=1/(a-i);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(i+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*a*2*c,e[15]=0,e}function U(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=(o+r)*a,e[14]=2*o*r*a):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var W=U;function z(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=o*a,e[14]=o*r*a):(e[10]=-1,e[14]=-r),e}function H(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(i+s),c=2/(o+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(i-s)*l*.5,e[9]=(o-a)*c*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function j(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(i+a)*c,e[15]=1,e}var K=j;function $(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=a*c,e[15]=1,e}function q(e,t,n,r){var o,i,s,l,c,u,d,p,f,m,h=t[0],v=t[1],y=t[2],b=r[0],x=r[1],T=r[2],C=n[0],S=n[1],A=n[2];return Math.abs(h-C)0&&(u*=f=1/Math.sqrt(f),d*=f,p*=f);var g=l*p-c*d,m=c*u-s*p,h=s*d-l*u;return(f=g*g+m*m+h*h)>0&&(g*=f=1/Math.sqrt(f),m*=f,h*=f),e[0]=g,e[1]=m,e[2]=h,e[3]=0,e[4]=d*h-p*m,e[5]=p*g-u*h,e[6]=u*m-d*g,e[7]=0,e[8]=u,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=a,e[14]=i,e[15]=1,e}function Y(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Z(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Q(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function J(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function te(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function re(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=e[9],f=e[10],g=e[11],m=e[12],h=e[13],v=e[14],y=e[15],b=t[0],x=t[1],T=t[2],C=t[3],S=t[4],A=t[5],P=t[6],I=t[7],w=t[8],O=t[9],M=t[10],R=t[11],V=t[12],E=t[13],D=t[14],L=t[15];return Math.abs(n-b)<=a*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=a*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-T)<=a*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-C)<=a*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(s-S)<=a*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-A)<=a*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(c-P)<=a*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(u-I)<=a*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-w)<=a*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-O)<=a*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(f-M)<=a*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(g-R)<=a*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(m-V)<=a*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(h-E)<=a*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(v-D)<=a*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-L)<=a*Math.max(1,Math.abs(y),Math.abs(L))}var oe=b,ae=J;function ie(){var e=new i(9);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function se(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function le(e){var t=new i(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ue(e,t,n,r,o,a,s,l,c){var u=new i(9);return u[0]=e,u[1]=t,u[2]=n,u[3]=r,u[4]=o,u[5]=a,u[6]=s,u[7]=l,u[8]=c,u}function de(e,t,n,r,o,a,i,s,l,c){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e}function pe(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function fe(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function ge(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*i-s*c,p=-u*a+s*l,f=c*a-i*l,g=n*d+r*p+o*f;return g?(g=1/g,e[0]=d*g,e[1]=(-u*r+o*c)*g,e[2]=(s*r-o*i)*g,e[3]=p*g,e[4]=(u*n-o*l)*g,e[5]=(-s*n+o*a)*g,e[6]=f*g,e[7]=(-c*n+r*l)*g,e[8]=(i*n-r*a)*g,e):null}function me(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=i*u-s*c,e[1]=o*c-r*u,e[2]=r*s-o*i,e[3]=s*l-a*u,e[4]=n*u-o*l,e[5]=o*a-n*s,e[6]=a*c-i*l,e[7]=r*l-n*c,e[8]=n*i-r*a,e}function he(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8];return t*(c*a-i*l)+n*(-c*o+i*s)+r*(l*o-a*s)}function ve(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1],g=n[2],m=n[3],h=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*i+g*c,e[1]=p*o+f*s+g*u,e[2]=p*a+f*l+g*d,e[3]=m*r+h*i+v*c,e[4]=m*o+h*s+v*u,e[5]=m*a+h*l+v*d,e[6]=y*r+b*i+x*c,e[7]=y*o+b*s+x*u,e[8]=y*a+b*l+x*d,e}function ye(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1];return e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=p*r+f*i+c,e[7]=p*o+f*s+u,e[8]=p*a+f*l+d,e}function be(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=Math.sin(n),f=Math.cos(n);return e[0]=f*r+p*i,e[1]=f*o+p*s,e[2]=f*a+p*l,e[3]=f*i-p*r,e[4]=f*s-p*o,e[5]=f*l-p*a,e[6]=c,e[7]=u,e[8]=d,e}function xe(e,t,n){var r=n[0],o=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Te(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Ce(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Se(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ae(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Pe(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[3]=u-v,e[6]=p+h,e[1]=u+v,e[4]=1-c-g,e[7]=f-m,e[2]=p-h,e[5]=f+m,e[8]=1-c-d,e}function Ie(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,A=u*m-d*g,P=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*P+S*A;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(l*I-i*M-c*P)*R,e[2]=(i*O-s*I+c*A)*R,e[3]=(o*O-r*M-a*w)*R,e[4]=(n*M-o*I+a*P)*R,e[5]=(r*I-n*O-a*A)*R,e[6]=(m*S-h*C+v*T)*R,e[7]=(h*x-g*S-v*b)*R,e[8]=(g*C-m*x+v*y)*R,e):null}function we(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Oe(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Me(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Re(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}function Ve(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}function Ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}function De(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e}function Le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Be(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=t[0],f=t[1],g=t[2],m=t[3],h=t[4],v=t[5],y=t[6],b=t[7],x=t[8];return Math.abs(n-p)<=a*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(r-f)<=a*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-g)<=a*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(i-m)<=a*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-h)<=a*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(l-v)<=a*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=a*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=a*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(d-x)<=a*Math.max(1,Math.abs(d),Math.abs(x))}var Ne=ve,ke=Ve,Fe=n(152),_e=n.n(Fe),Ge=n(177);const Ue=n.n(Ge)()(),We={vtkObject:()=>null};function ze(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return Ue.console&&Ue.console.error&&Ue.console.error("Invalid VTK object"),null;const t=We[e.vtkClass];if(!t)return Ue.console&&Ue.console.error&&Ue.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=ze(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}ze.register=function(e,t){We[e]=t};class He extends Array{push(){for(let e=0;e{$e[e]=qe})),Ue.console=console.hasOwnProperty("log")?console:$e;const Xe={debug:qe,error:Ue.console.error||qe,info:Ue.console.info||qe,log:Ue.console.log||qe,warn:Ue.console.warn||qe};function Ye(e,t){Xe[e]&&(Xe[e]=t||qe)}function Ze(){Xe.log(...arguments)}function Qe(){Xe.info(...arguments)}function Je(){Xe.debug(...arguments)}function et(){Xe.error(...arguments)}function tt(){Xe.warn(...arguments)}const nt={};function rt(e){nt[e]||(Xe.error(e),nt[e]=!0)}const ot=Object.create(null);ot.Float32Array=Float32Array,ot.Float64Array=Float64Array,ot.Uint8Array=Uint8Array,ot.Int8Array=Int8Array,ot.Uint16Array=Uint16Array,ot.Int16Array=Int16Array,ot.Uint32Array=Uint32Array,ot.Int32Array=Int32Array,ot.Uint8ClampedArray=Uint8ClampedArray;try{ot.BigInt64Array=BigInt64Array,ot.BigUint64Array=BigUint64Array}catch{}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),a="B";for(;o>n;)o/=n,a=r.pop();return`${o.toFixed(t)} ${a}`}function dt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function pt(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function ft(e){return Object.values(ot).some((t=>e instanceof t))}function gt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function yt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++je),"classHierarchy"in t){if(!(t.classHierarchy instanceof He)){const e=new He;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?et("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return et("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!1;return Object.keys(n).forEach((i=>{const s=o?null:e[`set${st(i)}`];s&&Array.isArray(n[i])&&s.length>1?a=s(...n[i])||a:s?a=s(n[i])||a:(-1!==["mtime"].indexOf(i)||r||tt(`Warning: Set value to model directly ${i}, ${n[i]}`),a=t[i]!==n[i]||a,t[i]=n[i])})),a},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(mt):ft(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),a=Object.keys(t).sort(),i=Object.keys(o).sort();i.forEach((e=>{const n=a.indexOf(e);-1===n?r&&Je(`add ${e} in shallowCopy`):a.splice(n,1),t[e]=o[e]})),a.length&&r&&Je(`Untouched keys: ${a.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const bt={object:(e,t,n)=>function(){return{...t[n.name]}}};function xt(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=bt[n.type];e[`get${lt(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${lt(n)}`]=()=>t[n]}))}const Tt={enum(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw et(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}throw et(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw et(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if(!_e()(t[n.name],o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}return!1}}};function Ct(e){if("object"==typeof e){const t=Tt[e.type];if(t)return(n,r)=>t(n,r,e);throw et(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${lt(e)}Changed`;return function(o){if(n.deleted)return et("instance deleted - cannot call any method"),!1;if(n[e]!==o){const a=n[e.name];return n[e]=o,n[r]?.(t,n,o,a),t.modified(),!0}return!1}}}function St(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${lt(n.name)}`]=Ct(n)(e,t):e[`set${lt(n)}`]=Ct(n)(e,t)}))}function At(e,t,n){xt(e,t,n),St(e,t,n)}function Pt(e,t,n){n.forEach((n=>{e[`get${lt(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${lt(n)}ByReference`]=()=>t[n]}))}function It(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const a=`_on${lt(n)}Changed`;e[`set${lt(n)}`]=function(){if(t.deleted)return et("instance deleted - cannot call any method"),!1;for(var i=arguments.length,s=new Array(i),l=0;l=0)&&(u=u[0],d=!0),null==u)c=t[n]!==u;else{if(r&&u.length!==r){if(!(u.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function wt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Pt(e,t,n),It(e,t,n,r,o)}function Ot(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?et("instance deleted - cannot call any method"):r>=t.numberOfInputs?et(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function a(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)et("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void et(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function i(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(et("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(ze):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(ze):t.inputConnection=[],t.output?t.output=t.output.map(ze):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(ze):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,a=r;for(;a--;){if(!t.output[a]||t.output[a].isDeleted())return!0;const e=t.output[a].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=a,e.addInputData=function(e){t.deleted?et("instance deleted - cannot call any method"):o(e,i())},e.addInputConnection=function(e){t.deleted?et("instance deleted - cannot call any method"):a(e,i())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===Rt)break}},e[`on${lt(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return et("instance deleted - cannot call any method"),null;const i=a++;return r.push([i,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(i)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return i(t)}))}}function Et(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&ze.register(t,n),n}function Dt(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function Lt(e){return e&&e.isA&&e.isA("vtkObject")}function Bt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(Lt(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const a=e.get();Object.keys(a).forEach((e=>{const o=a[e];Array.isArray(o)?o.forEach((e=>{Bt(e,t,n,r)})):Bt(o,t,n,r)}))}return n}function Nt(e,t,n){var r=this;let o;const a=function(){for(var a=arguments.length,i=new Array(a),s=0;s{o=null,n||e.apply(l,i)},u=n&&!o;clearTimeout(o),o=setTimeout(c,t),u&&e.apply(l,i)};return a.cancel=()=>clearTimeout(o),a}function kt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(a(...r),r=null)}function a(){for(var a=arguments.length,i=new Array(a),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let _t=1;const Gt="__root__";function Ut(e,t){Ft(e,t);const n=e.delete;t.proxyId=""+_t++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),xt(e,t,["proxyId","proxyGroup","proxyName"]),At(e,t,["proxyManager"]);const r={},o={};function a(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:Gt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gt;const r=[],o=t.proxyId,a=i(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),a(t.ui,Gt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${lt(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let a=0,i=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i)return null;const l=[];let c=null;for(a=o.length;a--;){const e=o[a];e.instance===n?c=e:l.push(e)}if(!c)return null;const u=c.instance[`get${lt(c.propertyName)}`]();if(!gt(u,r)||s){for(r=u,i=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}i=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=u),u}function l(e,t){const n=[];for(a=o.length;a--;){const r=o[a];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(a))}for(;n.length;)o.splice(n.pop(),1)}function c(n,r){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=n.onModified(s),c=o[0];return o.push({instance:n,propertyName:r,subscription:i}),a&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):c&&s(c.instance,!0)),{unsubscribe:()=>l(n,r)}}function u(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:c,unbind:l,unsubscribe:u,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,ht((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function zt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const a=Object.keys(r);let i=a.length;for(;i--;){const s=a[i];t[s]=r[s];const l=n[s];e[`set${lt(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}a.length&&xt(e,t,a)}function Ht(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var jt={algo:Mt,capitalize:st,chain:Dt,debounce:Nt,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:Vt,EVENT_ABORT:Rt,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,get:xt,getArray:Pt,getCurrentGlobalMTime:function(){return je},getStateArrayMapFunc:mt,isVtkObject:Lt,keystore:Ft,measurePromiseExecution:vt,moveToProtected:Ot,newInstance:Et,newTypedArray:at,newTypedArrayFrom:it,normalizeWheel:Ht,obj:yt,proxy:Ut,proxyPropertyMapping:Wt,proxyPropertyState:zt,safeArrays:pt,set:St,setArray:It,setGet:At,setGetArray:wt,setImmediate:ht,setLoggerFunction:Ye,throttle:kt,traverseInstanceTree:Bt,TYPED_ARRAYS:ot,uncapitalize:ct,VOID:Ke,vtkDebugMacro:Je,vtkErrorMacro:et,vtkInfoMacro:Qe,vtkLogMacro:Ze,vtkOnceErrorMacro:rt,vtkWarningMacro:tt},Kt=Object.freeze({__proto__:null,VOID:Ke,setLoggerFunction:Ye,vtkLogMacro:Ze,vtkInfoMacro:Qe,vtkDebugMacro:Je,vtkErrorMacro:et,vtkWarningMacro:tt,vtkOnceErrorMacro:rt,TYPED_ARRAYS:ot,newTypedArray:at,newTypedArrayFrom:it,capitalize:st,_capitalize:lt,uncapitalize:ct,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,setImmediateVTK:ht,measurePromiseExecution:vt,obj:yt,get:xt,set:St,setGet:At,getArray:Pt,setArray:It,setGetArray:wt,moveToProtected:Ot,algo:Mt,EVENT_ABORT:Rt,event:Vt,newInstance:Et,chain:Dt,isVtkObject:Lt,traverseInstanceTree:Bt,debounce:Nt,throttle:kt,keystore:Ft,proxy:Ut,proxyPropertyMapping:Wt,proxyPropertyState:zt,normalizeWheel:Ht,default:jt});const{vtkErrorMacro:$t}=jt;function qt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return $t("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xt,n),jt.obj(e,t),jt.event(e,t,"event"),t._renderableChildMap=new Map,jt.get(e,t,["visited"]),jt.setGet(e,t,["_parent","renderable","myFactory"]),jt.getArray(e,t,["children"]),jt.moveToProtected(e,t,["parent"]),qt(e,t)}var Zt={newInstance:jt.newInstance(Yt,"vtkViewNode"),extend:Yt,PASS_TYPES:["Build","Render"]};function Qt(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),a=!1;const i=Object.keys(t.overrides);for(;o&&!a;)-1!==i.indexOf(o)?a=!0:o=n.getClassName(r++);if(!a)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const Jt={};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jt,n),jt.obj(e,t),Qt(e,t)}var tn={newInstance:jt.newInstance(en,"vtkViewNodeFactory"),extend:en};const nn=Object.create(null);function rn(e,t){nn[e]=t}function on(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const an={};function sn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,an,n),t.overrides=nn,tn.extend(e,t,n),on(0,t)}var ln={newInstance:jt.newInstance(sn,"vtkOpenGLViewNodeFactory"),extend:sn};function cn(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){d(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),se(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();d(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),m(t.keyMatrices.vcpc,t.keyMatrices.vcpc),b(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const un={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const dn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,un,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},At(e,t,["context","keyMatrixTime"]),cn(e,t)}));rn("vtkCamera",dn);const{vtkDebugMacro:pn}=Kt;function fn(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(pn("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const gn={context:null,_openGLRenderWindow:null,selector:null};const mn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gn,n),Zt.extend(e,t,n),xt(e,t,["shaderCache"]),At(e,t,["selector"]),Ot(0,t,["openGLRenderWindow"]),fn(e,t)}),"vtkOpenGLRenderer");function hn(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=n=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(n,r)=>{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?pe(t.keyMatrices.normalMatrix):(se(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),fe(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkRenderer",mn);const vn={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};const yn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vn,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},At(e,t,["context"]),xt(e,t,["activeTextures"]),hn(e,t)}));function bn(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=n=>{if(n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOverlayActorCount()}},e.traverseOpaquePass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&!t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOverlayPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable)&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xn,n),Zt.extend(e,t,n),At(e,t,["context"]),xt(e,t,["activeTextures"]),bn(e,t)}));function Cn(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sn(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function An(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function Pn(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function In(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function wn(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function On(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Mn(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function Rn(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Vn(e,t){var n=t[0],r=t[1],o=t[2],a=n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function En(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dn(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[0],s=n[1],l=n[2];return e[0]=o*l-a*s,e[1]=a*i-r*l,e[2]=r*s-o*i,e}function Ln(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[3]*r+n[7]*o+n[11]*a+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*o+n[8]*a+n[12])/i,e[1]=(n[1]*r+n[5]*o+n[9]*a+n[13])/i,e[2]=(n[2]*r+n[6]*o+n[10]*a+n[14])/i,e}function Bn(e,t,n){var r=t[0],o=t[1],a=t[2];return e[0]=r*n[0]+o*n[3]+a*n[6],e[1]=r*n[1]+o*n[4]+a*n[7],e[2]=r*n[2]+o*n[5]+a*n[8],e}function Nn(e,t,n){var r=n[0],o=n[1],a=n[2],i=n[3],s=t[0],l=t[1],c=t[2],u=o*c-a*l,d=a*s-r*c,p=r*l-o*s,f=o*p-a*d,g=a*u-r*p,m=r*d-o*u,h=2*i;return u*=h,d*=h,p*=h,f*=2,g*=2,m*=2,e[0]=s+u+f,e[1]=l+d+g,e[2]=c+p+m,e}function kn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Fn(e,t){var n=e[0],r=e[1],o=e[2],i=t[0],s=t[1],l=t[2];return Math.abs(n-i)<=a*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-s)<=a*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-l)<=a*Math.max(1,Math.abs(o),Math.abs(l))}rn("vtkActor2D",Tn);var _n=wn,Gn=function(e,t){var n=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2];return Math.hypot(n,r,o)},Un=Sn,Wn=(Cn(),Math.sqrt(50)),zn=Math.sqrt(10),Hn=Math.sqrt(2);function jn(e,t,n){var r=(t-e)/Math.max(0,n),o=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,o);return o>=0?(a>=Wn?10:a>=zn?5:a>=Hn?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(a>=Wn?10:a>=zn?5:a>=Hn?2:1)}function Kn(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function $n(e){let t=e,n=e,r=e;function o(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<0?o=n+1:a=n}while(oe(t)-n,n=Kn,r=(t,n)=>Kn(e(t),n)),{left:o,center:function(e,n,r=0,a=e.length){const i=o(e,n,r,a-1);return i>r&&t(e[i-1],n)>-t(e[i],n)?i-1:i},right:function(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<=0?o=n+1:a=n}while(o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?vr(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?vr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ir.exec(e))?new xr(t[1],t[2],t[3],1):(t=sr.exec(e))?new xr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=lr.exec(e))?vr(t[1],t[2],t[3],t[4]):(t=cr.exec(e))?vr(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=ur.exec(e))?Ir(t[1],t[2]/100,t[3]/100,1):(t=dr.exec(e))?Ir(t[1],t[2]/100,t[3]/100,t[4]):pr.hasOwnProperty(e)?hr(pr[e]):"transparent"===e?new xr(NaN,NaN,NaN,0):null}function hr(e){return new xr(e>>16&255,e>>8&255,255&e,1)}function vr(e,t,n,r){return r<=0&&(e=t=n=NaN),new xr(e,t,n,r)}function yr(e){return e instanceof Jn||(e=mr(e)),e?new xr((e=e.rgb()).r,e.g,e.b,e.opacity):new xr}function br(e,t,n,r){return 1===arguments.length?yr(e):new xr(e,t,n,null==r?1:r)}function xr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Tr(){return`#${Pr(this.r)}${Pr(this.g)}${Pr(this.b)}`}function Cr(){const e=Sr(this.opacity);return`${1===e?"rgb(":"rgba("}${Ar(this.r)}, ${Ar(this.g)}, ${Ar(this.b)}${1===e?")":`, ${e})`}`}function Sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ar(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pr(e){return((e=Ar(e))<16?"0":"")+e.toString(16)}function Ir(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Or(e,t,n,r)}function wr(e){if(e instanceof Or)return new Or(e.h,e.s,e.l,e.opacity);if(e instanceof Jn||(e=mr(e)),!e)return new Or;if(e instanceof Or)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),i=NaN,s=a-o,l=(a+o)/2;return s?(i=t===a?(n-r)/s+6*(n0&&l<1?0:i,new Or(i,s,l,e.opacity)}function Or(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Mr(e){return(e=(e||0)%360)<0?e+360:e}function Rr(e){return Math.max(0,Math.min(1,e||0))}function Vr(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Er(e,t,n,r,o){var a=e*e,i=a*e;return((1-3*e+3*a-i)*t+(4-6*a+3*i)*n+(1+3*e+3*a-3*i)*r+i*o)/6}Zn(Jn,mr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:fr,formatHex:fr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return wr(this).formatHsl()},formatRgb:gr,toString:gr}),Zn(xr,br,Qn(Jn,{brighter(e){return e=null==e?tr:Math.pow(tr,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?er:Math.pow(er,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xr(Ar(this.r),Ar(this.g),Ar(this.b),Sr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tr,formatHex:Tr,formatHex8:function(){return`#${Pr(this.r)}${Pr(this.g)}${Pr(this.b)}${Pr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Cr,toString:Cr})),Zn(Or,(function(e,t,n,r){return 1===arguments.length?wr(e):new Or(e,t,n,null==r?1:r)}),Qn(Jn,{brighter(e){return e=null==e?tr:Math.pow(tr,e),new Or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?er:Math.pow(er,e),new Or(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new xr(Vr(e>=240?e-240:e+120,o,r),Vr(e,o,r),Vr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Or(Mr(this.h),Rr(this.s),Rr(this.l),Sr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Sr(this.opacity);return`${1===e?"hsl(":"hsla("}${Mr(this.h)}, ${100*Rr(this.s)}%, ${100*Rr(this.l)}%${1===e?")":`, ${e})`}`}}));var Dr=e=>()=>e;function Lr(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Dr(isNaN(e)?t:e)}var Br=function e(t){var n=function(e){return 1==(e=+e)?Lr:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Dr(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=br(e)).r,(t=br(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),i=Lr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=a(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function Nr(e){return function(t){var n,r,o=t.length,a=new Array(o),i=new Array(o),s=new Array(o);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),o=e[r],a=e[r+1],i=r>0?e[r-1]:2*o-a,s=ra&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:_r(n,r)})),a=Wr.lastIndex;return at&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Qr:Zr,o=a=null,d}function d(t){return null==t||isNaN(t=+t)?n:(o||(o=r(i.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,i.map(e),_r)))(n)))},d.domain=function(e){return arguments.length?(i=Array.from(e,$r),u()):i.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Kr,u()},d.clamp=function(e){return arguments.length?(c=!!e||Xr,u()):c!==Xr},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}()(Xr,Xr)}function to(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}var no,ro=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function oo(e){if(!(t=ro.exec(e)))throw new Error("invalid format: "+e);var t;return new ao({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ao(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function io(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function so(e){return(e=io(Math.abs(e)))?e[1]:NaN}function lo(e,t){var n=io(e,t);if(!n)return e+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}oo.prototype=ao.prototype,ao.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var co={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>lo(100*e,t),r:lo,s:function(e,t){var n=io(e,t);if(!n)return e+"";var r=n[0],o=n[1],a=o-(no=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+io(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uo(e){return e}var po,fo,go,mo=Array.prototype.map,ho=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vo(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){var r,o,a,i,s=-1;if(n=+n,(e=+e)==(t=+t)&&n>0)return[e];if((r=t0){let n=Math.round(e/i),r=Math.round(t/i);for(n*it&&--r,a=new Array(o=r-n+1);++st&&--r,a=new Array(o=r-n+1);++s=Wn?o*=10:a>=zn?o*=5:a>=Hn&&(o*=2),t0;){if((o=jn(l,c,n))===r)return a[i]=l,a[s]=c,t(a);if(o>0)l=Math.floor(l/o)*o,c=Math.ceil(c/o)*o;else{if(!(o<0))break;l=Math.ceil(l*o)/o,c=Math.floor(c*o)/o}r=o}return e},e}function yo(){var e=eo();return e.copy=function(){return Jr(e,yo())},to.apply(e,arguments),vo(e)}po=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?uo:(t=mo.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var o=e.length,a=[],i=0,s=t[0],l=0;o>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(o-=s,o+s)),!((l+=s+1)>r));)s=t[i=(i+1)%t.length];return a.reverse().join(n)}),o=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?uo:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(mo.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=oo(e)).fill,n=e.align,d=e.sign,p=e.symbol,f=e.zero,g=e.width,m=e.comma,h=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):co[y]||(void 0===h&&(h=12),v=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===p?o:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===p?a:/[%p]/.test(y)?l:"",T=co[y],C=/[defgprs%]/.test(y);function S(e){var o,a,l,p=b,S=x;if("c"===y)S=T(e)+S,e="";else{var A=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:T(Math.abs(e),h),v&&(e=function(e){e:for(var t,n=e.length,r=1,o=-1;r0&&(o=0)}return o>0?e.slice(0,o)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),p=(A?"("===d?d:c:"-"===d||"("===d?"":d)+p,S=("s"===y?ho[8+no/3]:"")+S+(A&&"("===d?")":""),C)for(o=-1,a=e.length;++o(l=e.charCodeAt(o))||l>57){S=(46===l?i+e.slice(o+1):e.slice(o))+S,e=e.slice(0,o);break}}m&&!f&&(e=r(e,1/0));var P=p.length+e.length+S.length,I=P>1)+p+e+S+I.slice(P);break;default:e=I+p+e+S}return s(e)}return h=void 0===h?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h)),S.toString=function(){return e+""},S}return{format:d,formatPrefix:function(e,t){var n=d(((e=oo(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(so(t)/3))),o=Math.pow(10,-r),a=ho[8+r/3];return function(e){return n(o*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),fo=po.format,go=po.formatPrefix;var bo=n(640),xo=n.n(bo);const To=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Co=[1,0,0,0,1,0,0,0,1],So=1e-6,Ao=1e-12,{vtkErrorMacro:Po,vtkWarningMacro:Io}=jt;let wo=0;function Oo(e){return()=>Po(`vtkMath::${e} - NOT IMPLEMENTED`)}function Mo(e,t,n,r){let o;for(let a=0;a0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r=0?o:-o}function na(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ra(e){const t=na(e);return 0!==t&&(e[0]/=t,e[1]/=t),t}function oa(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:So;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const ua=ca;function da(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function pa(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function ma(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=ga(e[0],n),t[1]=ga(e[1],n),t[2]=ga(e[2],n),t}function ha(e,t,n,r){let o,a,i,s,l,c,u,d,p,f,g,m,h,v,y,b;const x=Vo(t),T=Vo(t),C=(e,t,n)=>{v=e[t],h=e[n],e[t]=v-m*(h+v*f),e[n]=h+m*(v-h*f)};for(pa(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>u){for(h=n[s]-n[l],Math.abs(h)+v===Math.abs(h)?p=e[l*t+s]/h:(d=.5*h/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),h=p*e[l*t+s],T[l]-=h,T[s]+=h,n[l]-=h,n[s]+=h,e[l*t+s]=0,a=0;a<=l-1;a++)C(e,a*t+l,a*t+s);for(a=l+1;a<=s-1;a++)C(e,l*t+a,a*t+s);for(a=s+1;a=20)return Io("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a=b||Math.abs(n[o]-b)>1)+(1&t);for(c=0,o=0;o=0&&c++;if(cr?a:r,o=i>o?i:o,n[e]=1,0!==o&&(n[e]/=o)}const a=Math.abs(t[0])*n[0],i=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=a,i>=o&&(o=i,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(Ro(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],c=Math.abs(t[7])*n[2];r[1]=1,o=l,c>=o&&(r[1]=2,Ro(t,3,1,2)),r[2]=2;let u=0;if(la(t)<0){u=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=Vo(4);if(va(t,d),fa(d,t),u)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&Ro(t,3,r[1],1),0!==r[0]&&Ro(t,3,r[0],0)}function ba(e,t,n){let r,o,a,i,s,l;if(ha([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(sa(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),i=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,i=o);i!==r&&(s=t[i],t[i]=t[r],t[r]=s,Mo(n,3,r,i)),n[3*i+i]<0&&(n[3*i]=-n[3*i],n[3*i+1]=-n[3*i+1],n[3*i+2]=-n[3*i+2]),o=(i+1)%3,a=(i+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Yo([n[3*i],n[3*i+1],n[3*i+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Qo(e);const c=Yo(e,[n[3*i],n[3*i+1],n[3*i+2]],[]);for(let t=0;t<3;t++)n[3*a+t]=e[t],n[3*o+t]=c[t];return void sa(n,n)}for(l=Math.abs(n[0]),i=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,i=r);if(0!==i){const e=t[i];t[i]=t[0],t[0]=e,Mo(n,3,i,0)}if(Math.abs(n[4])i&&(i=c);if(0===i)return Io("Unable to factor linear system"),0;d[r]=1/i}for(o=0;o=i&&(i=l,u=r)}if(o!==u){for(a=0;a=0)for(a=i;a<=o-1;a++)l-=e[o*r+a]*n[a];else 0!==l&&(i=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],a=o+1;a3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=r||Vo(n),i=o||Vo(n);if(0===xa(e,a,n))return null;for(let r=0;ri&&n<=a?(u=1,c=(a-n)/i,d=0):n>a&&n<=.5?(u=1,d=(n-a)/i,c=0):n>.5&&n<=s?(d=1,u=(s-n)/i,c=0):n>s&&n<=l?(d=1,c=(n-s)/i,u=0):n>l&&n<=1?(c=1,d=(1-n)/i,u=0):(c=1,u=n/i,d=0),c=r*c+(1-r),u=r*u+(1-r),d=r*d+(1-r),c*=o,u*=o,d*=o,t[0]=c,t[1]=u,t[2]=d}function Ia(e,t){const[n,r,o]=e;let a=(n+16)/116,i=r/500+a,s=a-o/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,i**3>.008856?i**=3:i=(i-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*i,t[1]=1*a,t[2]=1.089*s}function wa(e,t){const[n,r,o]=e;let a=n/.9505,i=r/1,s=o/1.089;a>.008856?a**=1/3:a=7.787*a+16/116,i>.008856?i**=1/3:i=7.787*i+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*i-16,t[1]=500*(a-i),t[2]=200*(i-s)}function Oa(e,t){const[n,r,o]=e;let a=3.2406*n+-1.5372*r+-.4986*o,i=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=a;l1&&(a/=l,i/=l,s/=l),a<0&&(a=0),i<0&&(i=0),s<0&&(s=0),t[0]=a,t[1]=i,t[2]=s}function Ma(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function Ra(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function Va(e){return!(e[1]-e[0]<0)}function Ea(e,t,n){return en?n:e}function Da(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=Ea(e[0],t[0],n[0]),r[1]=Ea(e[1],t[1],n[1]),r[2]=Ea(e[2],t[2],n[2]),r}const La=Oo("GetScalarTypeFittingRange"),Ba=Oo("GetAdjustedScalarRange");const{isFinite:Na,isNaN:ka}=Number,Fa=ka;function _a(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ga(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let a=-1/0,i=0,s=0;for(let l=0;l<=o;++l){const c=n[l];for(let n=0;n<=o;++n){const o=r[n],u=Math.abs(e[c+t*o]);u>a&&(a=u,i=l,s=n)}}[n[o],n[i]]=[n[i],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let a=0;a15?t.toString(16):`0${t.toString(16)}`}function Wa(e){return Math.round(255*e)}var za={Pi:()=>Math.PI,radiansFromDegrees:Eo,degreesFromRadians:Do,round:Lo,floor:Bo,ceil:No,ceilLog2:_o,min:ko,max:Fo,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let a=t,i=e.length;a=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:zo,add:Ho,subtract:jo,multiplyScalar:Ko,multiplyScalar2D:$o,multiplyAccumulate:qo,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Xo,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Yo,norm:Zo,normalize:Qo,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],a=e[1]*e[1],i=e[2]*e[2],s=Math.sqrt(o+a+i);let l,c,u;o>a&&o>i?(l=0,c=1,u=2):a>i?(l=1,c=2,u=0):(l=2,c=0,u=1);const d=e[l]/s,p=e[c]/s,f=e[u]/s,g=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/g,t[c]=e*g,t[u]=(-d*o-p*f*e)/g),n&&(n[l]=(-f*e-d*p*o)/g,n[c]=o*g,n[u]=(d*e-p*f*o)/g)}else t&&(t[l]=f/g,t[c]=0,t[u]=-d/g),n&&(n[l]=-d*p/g,n[c]=g,n[u]=-p*f/g)},projectVector:function(e,t,n){const r=Xo(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Xo(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Ko(n,o),!0},projectVector2D:function(e,t,n){const r=Jo(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Jo(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return $o(n,o),!0},distance2BetweenPoints:ea,angleBetweenVectors:function(e,t){const n=[0,0,0];return Yo(e,t,n),Math.atan2(Zo(n),Xo(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Jo,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:na,normalize2D:ra,determinant2x2:oa,LUFactor3x3:function(e,t){let n,r,o;const a=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),a[t]=1/o;o=a[0]*Math.abs(e[0]),n=0,(r=a[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=a[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(Mo(e,3,n,0),a[n]=a[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=a[1]*Math.abs(e[4]),n=1,(r=a[2]*Math.abs(e[7]))>=o&&(n=2,Mo(e,3,1,2),a[2]=a[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],a=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=+oa(s,u,l,d),f=-oa(i,c,l,d),g=+oa(i,c,s,u),m=-oa(o,u,a,d),h=+oa(r,c,a,d),v=-oa(r,c,o,u),y=+oa(o,s,a,l),b=-oa(r,i,a,l),x=+oa(r,i,o,s),T=r*p+o*f+a*g,C=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+h*t[1]+b*t[2],A=g*t[0]+v*t[1]+x*t[2];n[0]=C/T,n[1]=S/T,n[2]=A/T},multiply3x3_vect3:aa,multiply3x3_mat3:ia,multiplyMatrix:function(e,t,n,r,o,a,i){r!==o&&Po("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:So;return ua(e,To,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:So;return ua(e,Co,t)},determinant3x3:la,quaternionToMatrix3x3:fa,areEquals:ca,areMatricesEqual:ua,roundNumber:ga,roundVector:ma,matrix3x3ToQuaternion:va,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],a=e[0]*t[2],i=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],c=e[1]*t[2],u=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],g=e[2]*t[3],m=e[3]*t[0],h=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+g-v,n[2]=a-u+d+h,n[3]=i+c-p+m},orthogonalize3x3:ya,diagonalize3x3:ba,singularValueDecomposition3x3:function(e,t,n,r){let o;const a=[...e],i=la(a);if(i<0)for(o=0;o<9;o++)a[o]=-a[o];ya(a,t),sa(a,a),ia(a,t,r),ba(r,n,r),ia(t,r,t),sa(r,r),i<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:Ca,invertMatrix:Sa,luFactorLinearSystem:xa,luSolveLinearSystem:Ta,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(eAo&&(p=0,s[u]=0);if(p&&1===o)return Io("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),Aa(e,t,n,a);if(p)g=1;else for(u=0;u1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:function(e,t){let n,r;const[o,a,i]=e,s=1/6;let l=o,c=o;a>l?l=a:al?l=i:i0?(l-c)/l:0,r>0?(n=o===l?s*(a-i)/(l-c):a===l?.3333333333333333+s*(i-o)/(l-c):.6666666666666666+s*(o-a)/(l-c),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=u},hsv2rgb:Pa,lab2xyz:Ia,xyz2lab:wa,xyz2rgb:Oa,rgb2xyz:Ma,rgb2lab:function(e,t){const n=[0,0,0];Ma(e,n),wa(n,t)},lab2rgb:function(e,t){const n=[0,0,0];Ia(e,n),Oa(n,t)},uninitializeBounds:Ra,areBoundsInitialized:Va,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:Ea,clampVector:Da,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:La,getAdjustedScalarRange:Ba,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=Vo(3),a=Vo(3),i=Vo(3),s=Vo(3),l=Vo(3),c=Vo(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],a[r]=t[r]-n[r],i[r]=n[r]-e[r],s[r]=-o[r],l[r]=-a[r],c[r]=-i[r];const u=Zo(s),d=Zo(l),p=Zo(i),f=Vo(3);Yo(o,a,f);const g=Zo(f),m=u*d*p/(2*g),h=2*g*g,v=d*d*Xo(o,c)/h,y=p*p*Xo(s,a)/h,b=u*u*Xo(i,l)/h;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:e=>!Number.isFinite(e),isNan:ka,isNaN:ka,isFinite:Na,createUninitializedBounds:_a,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:Ga,floatToHex2:Ua,floatRGB2HexCode:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ua).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Wa).join(", ")})`:`rgba(${Wa(e[0]||0)}, ${Wa(e[1]||0)}, ${Wa(e[2]||0)}, ${e[3]||0})`}};const Ha=1e-6,ja="coincide",Ka="disjoint";function $a(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function qa(e,t,n,r){const o=[];jo(e,t,o);const a=Xo(n,o);r[0]=e[0]-a*n[0],r[1]=e[1]-a*n[1],r[2]=e[2]-a*n[2]}function Xa(e,t,n){const r=Xo(e,t);let o=Xo(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ya(e,t,n,r){const o=[];jo(e,t,o);const a=Xo(n,o),i=Xo(n,n);0!==i?(r[0]=e[0]-a*n[0]/i,r[1]=e[1]-a*n[1]/i,r[2]=e[2]-a*n[2]/i):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Za(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},a=[],i=[];jo(t,e,a),jo(n,e,i);const s=Xo(r,i),l=Xo(r,a);let c,u;return c=l<0?-l:l,u=s<0?-s*Ha:s*Ha,c<=u||(o.t=s/l,o.x[0]=e[0]+o.t*a[0],o.x[1]=e[1]+o.t*a[1],o.x[2]=e[2]+o.t*a[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function Qa(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},a=[];Yo(t,r,a);const i=a.map((e=>Math.abs(e)));if(i[0]+i[1]+i[2]i[1]&&i[0]>i[2]?"x":i[1]>i[2]?"y":"z";const l=[],c=-Xo(t,e),u=-Xo(r,n);switch(s){case"x":l[0]=0,l[1]=(u*t[2]-c*r[2])/a[0],l[2]=(c*r[1]-u*t[1])/a[0];break;case"y":l[0]=(c*r[2]-u*t[2])/a[1],l[1]=0,l[2]=(u*t[0]-c*r[0])/a[1];break;case"z":l[0]=(u*t[1]-c*r[1])/a[2],l[1]=(c*r[0]-u*t[0])/a[2],l[2]=0}return o.l0=l,Ho(l,a,o.l1),o.intersection=!0,o}const Ja={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:$a,projectPoint:qa,projectVector:Xa,generalizedProjectPoint:Ya,intersectWithLine:Za,intersectWithPlane:Qa,DISJOINT:Ka,COINCIDE:ja};function ei(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>$a(e,t.origin,t.normal),e.projectPoint=(e,n)=>{qa(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>Xa(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ya(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Za(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>Qa(e,n,t.origin,t.normal)}const ti={normal:[0,0,1],origin:[0,0,0]};function ni(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ti,n),jt.obj(e,t),jt.setGetArray(e,t,["normal","origin"],3),ei(e,t)}var ri={newInstance:jt.newInstance(ni,"vtkPlane"),extend:ni,...Ja};const oi=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function ai(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function ii(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function si(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function li(e){return si(e,oi)}function ci(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=ot?a:t,e[2]=in?s:n,e[4]=lr?c:r,e}function ui(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;na?t:a,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>c?r:c,o!==t||i!==n||l!==r}function fi(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function hi(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function vi(e,t){return e[2*t+1]-e[2*t]}function yi(e){return[vi(e,0),vi(e,1),vi(e,2)]}function bi(e){return e.slice(0,2)}function xi(e){return e.slice(2,4)}function Ti(e){return e.slice(4,6)}function Ci(e){const t=yi(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function Si(e){if(ii(e)){const t=yi(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function Ai(e){return[e[0],e[2],e[4]]}function Pi(e){return[e[1],e[3],e[5]]}function Ii(e,t){return e<=0&&t>=0||e>=0&&t<=0}function wi(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let a=4;a<6;a++)t[n++]=[e[r],e[o],e[a]];return t}function Oi(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function Mi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=wi(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function Vi(e,t,n,r){const o=[].concat(oi),a=e.getData();for(let e=0;ee[2*n+1]?(i[n]=0,c[n]=e[2*n+1],a=!1):i[n]=2;if(a)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==i[e]&&0!==n[e]?l[e]=(c[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=c[o];return 1}function Di(e,t,n){const r=[];let o=0,a=1,i=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=ri.evaluate(n,t,r),i&&(a=o>=0?1:-1,i=0),0===o||a>0&&o<0||a<0&&o>0)return 1}}return 0}function Li(e,t){if(!ii(e)||!ii(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function Bi(e,t){if(!ii(e)||!ii(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function Ni(e,t,n,r){return!(te[1]||ne[3]||re[5])}function ki(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let a=0;for(let r=0;r<2;r++)for(let i=2;i<4;i++)for(let s=4;s<6;s++){const l=[e[r],e[i],e[s]];o[a++]=ri.evaluate(n,t,l)}let i=2;for(;i--&&!(Ii(o[r[i][0]],o[r[i][4]])&&Ii(o[r[i][1]],o[r[i][5]])&&Ii(o[r[i][2]],o[r[i][6]])&&Ii(o[r[i][3]],o[r[i][7]])););if(i<0)return!1;const s=Math.sign(n[i]),l=Math.abs((e[2*i+1]-e[2*i])*n[i]);let c=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[i][e]])/l;s>0&&tc&&(c=t)}const u=(1-c)*e[2*i]+c*e[2*i+1];return s>0?e[2*i]=u:e[2*i+1]=u,!0}class Fi{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(oi))}getBounds(){return this.bounds}equals(e){return ai(this.bounds,e)}isValid(){return ii(this.bounds)}setBounds(e){return si(this.bounds,e)}reset(){return li(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return Mi(this.bounds,e,t)}computeScale3(e){return Ri(this.bounds,e)}cutWithPlane(e,t){return ki(this.bounds,e,t)}intersectBox(e,t,n,r){return Ei(this.bounds,e,t,n,r)}intersectPlane(e,t){return Di(this.bounds,e,t)}intersect(e){return Li(this.bounds,e)}intersects(e){return Bi(this.bounds,e)}containsPoint(e,t,n){return Ni(this.bounds,e,t,n)}contains(e){return Bi(this.bounds,e)}}const _i={equals:ai,isValid:ii,setBounds:si,reset:li,addPoint:ci,addPoints:ui,addBounds:di,setMinPoint:pi,setMaxPoint:fi,inflate:gi,scale:mi,scaleAboutCenter:function(e,t,n,r){if(!ii(e))return!1;const o=hi(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],mi(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:hi,getLength:vi,getLengths:yi,getMaxLength:Ci,getDiagonalLength:Si,getMinPoint:Ai,getMaxPoint:Pi,getXRange:bi,getYRange:xi,getZRange:Ti,getCorners:wi,computeCornerPoints:Oi,computeLocalBounds:Vi,transformBounds:Mi,computeScale3:Ri,cutWithPlane:ki,intersectBox:Ei,intersectPlane:Di,intersect:Li,intersects:Bi,containsPoint:Ni,contains:function(e,t){return!!Bi(e,t)&&!!Ni(e,...Ai(t))&&!!Ni(e,...Pi(t))},INIT_BOUNDS:oi};var Gi,Ui={newInstance:function(e){const t=e&&e.bounds;return new Fi(t)},..._i};function Wi(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function zi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*a+n[12]*i,e[1]=n[1]*r+n[5]*o+n[9]*a+n[13]*i,e[2]=n[2]*r+n[6]*o+n[10]*a+n[14]*i,e[3]=n[3]*r+n[7]*o+n[11]*a+n[15]*i,e}function Hi(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ji(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Ki(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=r*u+i*s+o*c-a*l,e[1]=o*u+i*l+a*s-r*c,e[2]=a*u+i*c+r*l-o*s,e[3]=i*u-r*s-o*l-a*c,e}Gi=new i(4),i!=Float32Array&&(Gi[0]=0,Gi[1]=0,Gi[2]=0,Gi[3]=0);var $i,qi,Xi,Yi=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o},Zi=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},Qi=function(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n*n+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=o*i,e[3]=a*i,e},Ji=($i=Cn(),qi=An(1,0,0),Xi=An(0,1,0),function(e,t,n){var r=En(t,n);return r<-.999999?(Dn($i,qi,t),Un($i)<1e-6&&Dn($i,Xi,t),Vn($i,$i),ji(e,$i,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Dn($i,t,n),e[0]=$i[0],e[1]=$i[1],e[2]=$i[2],e[3]=1+r,Qi(e,e))});Hi(),Hi(),ie();var es={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:ts}=es;function ns(e){return()=>jt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function rs(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=ns("pick"),e.hasKey=ns("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(ts.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(ts.DISPLAY)}const os={allocatedRenderTime:10,coordinateSystem:ts.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function as(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,os,n),jt.obj(e,t),jt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),jt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),jt.moveToProtected(e,t,["parentProp"]),rs(e,t)}var is={newInstance:jt.newInstance(as,"vtkProp"),extend:as,...es};function ss(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Hi();N(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>a?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[Do(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(S(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateY=n=>{0!==n&&(A(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateZ=n=>{0!==n&&(P(t.rotation,t.rotation,Eo(n)),e.modified())},e.rotateWXYZ=(n,r,o,a)=>{if(0===n||0===r&&0===o&&0===a)return;const i=Eo(n),s=Hi();ji(s,[r,o,a],i);const l=new Float64Array(16);_(l,s),b(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],g(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!ua(t.userMatrix,n)&&(d(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){g(t.matrix),t.userMatrix&&b(t.matrix,t.matrix,t.userMatrix),x(t.matrix,t.matrix,t.origin),x(t.matrix,t.matrix,t.position),b(t.matrix,t.matrix,t.rotation),T(t.matrix,t.matrix,t.scale),x(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),m(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>Ui.getCenter(t.bounds),e.getLength=()=>Ui.getLength(t.bounds),e.getXRange=()=>Ui.getXRange(t.bounds),e.getYRange=()=>Ui.getYRange(t.bounds),e.getZRange=()=>Ui.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const ls={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function cs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ls,n),is.extend(e,t,n),t.matrixMTime={},jt.obj(t.matrixMTime),jt.get(e,t,["bounds","isIdentity"]),jt.getArray(e,t,["orientation"]),jt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=g(new Float64Array(16)),t.rotation=g(new Float64Array(16)),t.userMatrix=g(new Float64Array(16)),t.transform=null,ss(e,t)}var us={newInstance:jt.newInstance(cs,"vtkProp3D"),extend:cs};const ds={FLAT:0,GOURAUD:1,PHONG:2},ps={POINTS:0,WIREFRAME:1,SURFACE:2};var fs={Shading:ds,Representation:ps,Interpolation:ds};const{Representation:gs,Interpolation:ms}=fs;function hs(e){return()=>jt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function vs(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=hs("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=hs("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(ms.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(ms.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(ms.PHONG),e.getInterpolationAsString=()=>jt.enumToString(ms,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(gs.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(gs.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(gs.POINTS),e.getRepresentationAsString=()=>jt.enumToString(gs,t.representation)}const ys={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:ms.GOURAUD,representation:gs.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function bs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ys,n),jt.obj(e,t),jt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),jt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),vs(e,t)}var xs={newInstance:jt.newInstance(bs,"vtkProperty"),extend:bs,...fs};const{vtkDebugMacro:Ts}=jt;function Cs(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=xs.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ts("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];Ui.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);m(o,t.matrix),r.forEach((e=>Ln(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Ss={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function As(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ss,n),us.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Cs(e,t)}var Ps={newInstance:jt.newInstance(As,"vtkActor"),extend:As};const Is={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ws={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var Os={DefaultDataType:ws.FLOAT,DataTypeByteSize:Is,VtkDataTypes:ws};const{vtkErrorMacro:Ms}=Kt,{DefaultDataType:Rs}=Os,Vs=1e-6;function Es(e,t,n){const r=e.length;let o,a,i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(a=t;as&&(s=o);return{min:i,max:s}}function Ds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,a=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Bs(e){return Object.prototype.toString.call(e).slice(8,-1)}const Ns={computeRange:Ds,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Es,getDataType:Bs,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=a)}return n}};function ks(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=at(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,a=n%t.numberOfComponents;e.setComponent(o,a,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Ls(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=Ds(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Ls(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const a=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vs;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,a=(r??e.getNumberOfTuples())*t.numberOfComponents,i=e.getData().subarray(o,a);return i.length>0?i:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Gs({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Bs(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,a,i,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===a.getNumberOfComponents()||Ms("numberOfComponents must match");const c=r.getTuple(o),u=a.getTuple(i),d=[];switch(d.length=l,l){case 4:d[3]=c[3]+(u[3]-c[3])*s;case 3:d[2]=c[2]+(u[2]-c[2])*s;case 2:d[1]=c[1]+(u[1]-c[1])*s;case 1:d[0]=c[0]+(u[0]-c[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Fs,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=it(t.dataType,t.values)):t.values=at(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Bs(t.values)),yt(e,t),St(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");ks(e,t)}const Gs=Et(_s,"vtkDataArray");var Us={newInstance:Gs,extend:_s,...Ns,...Os};function Ws(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,a=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),jt.obj(e,t),jt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Ws(e,t)};function js(e,t){e.getBounds=()=>(jt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),_a()),e.getCenter=()=>{const n=e.getBounds();return t.center=Ui.isValid(n)?Ui.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return Ui.getDiagonalLength(t)}}const Ks=e=>({bounds:[...Ui.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var $s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ks(n)),Hs(e,t,n),jt.setGet(e,t,["viewSpecificProperties"]),js(e,t)};const{vtkErrorMacro:qs,vtkWarningMacro:Xs}=jt;function Ys(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:ze(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:a}=e.getArrayWithIndex(r);return null!=o?(t.arrays[a]={data:n},a):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((a=>{const i=e.getFlag(a.getName());if(!1!==i&&(!t.doCopyAllOff||!0===i)&&a){let t=e.getArrayByName(a.getName());if(t)if(a.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,a.getTuple(r))}else t.insertTuples(0,a.getTuples());else qs("Unhandled case in passData");else if(r<0||r>a.getNumberOfTuples())e.addArray(a),n.getAttributes(a).forEach((t=>{e.setAttribute(a,t)}));else{const i=a.getNumberOfComponents();let s=a.getNumberOfValues();const l=o>-1?o:r;s<=l*i&&(s=(l+1)*i),t=Us.newInstance({name:a.getName(),dataType:a.getDataType(),numberOfComponents:i,values:jt.newTypedArray(a.getDataType(),s),size:0}),t.insertTuple(l,a.getTuple(r)),e.addArray(t),n.getAttributes(a).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?a:r;t.interpolateTuple(e,s,r,s,o,i),Xs("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else qs("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let c=s.getNumberOfValues();const u=a>-1?a:r;c<=u*l&&(c=(u+1)*l),t=Us.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:jt.newTypedArray(s.getDataType(),c),size:0}),t.interpolateTuple(u,s,r,s,o,i),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Zs={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zs,n),jt.obj(e,t),Ys(e,t)}var Js={newInstance:jt.newInstance(Qs,"vtkFieldData"),extend:Qs},el={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:tl,AttributeCopyOperations:nl}=el,{vtkWarningMacro:rl}=jt;function ol(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>tl[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const a=r(o);if(n&&"PEDIGREEIDS"===a.toUpperCase()&&!n.isA("vtkDataArray"))return rl(`Cannot set attribute ${a}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,a))return rl(`Cannot set attribute ${a}. Incorrect number of components.`),-1;let i=t[`active${a}`];if(i>=0&&in.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const a=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[nl.PASSDATA][tl[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[nl.PASSDATA][tl[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(nl).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[nl[e]]=Object.keys(tl).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[tl[t]]=!0,e)),[])})),t.copyAttributeFlags[nl.COPYTUPLE][tl.GLOBALIDS]=!1,t.copyAttributeFlags[nl.INTERPOLATE][tl.GLOBALIDS]=!1,t.copyAttributeFlags[nl.COPYTUPLE][tl.PEDIGREEIDS]=!1},e.initialize=jt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Us.newInstance(t.dataArrays[n]))}));const a=e.shallowCopy;e.shallowCopy=(e,n)=>{a(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const al={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function il(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,al,n),Js.extend(e,t,n),jt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ol(e,t)}var sl={newInstance:jt.newInstance(il,"vtkDataSetAttributes"),extend:il,...el};const ll={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};var cl={FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:ll};const ul=["pointData","cellData","fieldData"];function dl(e,t){t.classHierarchy.push("vtkDataSet"),ul.forEach((e=>{t[e]?t[e]=ze(t[e]):t[e]=sl.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),ul.forEach((n=>{t[n]=sl.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const pl={};function fl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pl,n),jt.obj(e,t),jt.setGet(e,t,ul),dl(e,t)}var gl={newInstance:jt.newInstance(fl,"vtkDataSet"),extend:fl,...cl};const ml={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var hl={StructuredType:ml};const{StructuredType:vl}=hl;var yl={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?vl.EMPTY:3===t?vl.XYZ_GRID:2===t?e[0]===e[1]?vl.YZ_PLANE:e[2]===e[3]?vl.XZ_PLANE:vl.XY_PLANE:1===t?e[0]e!==a[t]));return i&&(t.extent=a.slice(),t.dataDescription=yl.getDataDescriptionFromExtent(t.extent),e.modified()),i},e.setDimensions=function(){let n,r,o;if(t.deleted)bl("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void bl("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return bl("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case ml.EMPTY:return null;case ml.SINGLE_POINT:break;case ml.X_LINE:o[0]=n;break;case ml.Y_LINE:o[1]=n;break;case ml.Z_LINE:o[2]=n;break;case ml.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case ml.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case ml.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case ml.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:bl("Invalid dataDescription")}const a=[0,0,0];return e.indexToWorld(o,a),a},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>Ui.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>Ui.inflate([...t.extent],.5),e.computeTransforms=()=>{I(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],T(t.indexToWorld,t.indexToWorld,t.spacing),h(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ln(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ln(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ui.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Ui.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>Ui.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],a=[0,0,0];Ui.computeCornerPoints(r,o,a),ma(o,o),ma(a,a);const i=e.getDimensions();Da(o,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],o),Da(a,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],a);const s=i[0],l=i[0]*i[1],c=e.getPointData().getScalars().getData();let u=-1/0,d=1/0,p=0,f=0,g=0;for(let e=o[2];e<=a[2];e++)for(let t=o[1];t<=a[1];t++){let i=o[0]+t*s+e*l;for(let s=o[0];s<=a[0];s++){if(!n||n([s,t,e],r)){const e=c[i];e>u&&(u=e),e0?f/g:0,h=g?Math.abs(p/g-m*m):0,v=Math.sqrt(h);return{minimum:d,maximum:u,average:m,variance:h,sigma:v,count:g}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const a=e.getExtent(),i=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(a,i);return Math.floor((Math.round(n)-a[0])*s[0]+(Math.round(r)-a[2])*s[1]+(Math.round(o)-a[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return bl(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return bl(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Tl={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:ml.EMPTY};function Cl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),gl.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=pe(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),jt.get(e,t,["indexToWorld","worldToIndex"]),jt.setGetArray(e,t,["origin","spacing"],3),jt.setGetArray(e,t,["direction"],9),jt.getArray(e,t,["extent"],6),xl(e,t)}var Sl={newInstance:jt.newInstance(Cl,"vtkImageData"),extend:Cl};const Al={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Pl={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:Al};const Il={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5};var wl={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:Il};const{ScalarMappingTarget:Ol,VectorMode:Ml}=Pl,{VtkDataTypes:Rl}=Us,{ColorMode:Vl}=wl,{vtkErrorMacro:El}=jt;function Dl(e){return e}function Ll(e){return Math.floor(255*e+.5)}function Bl(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Ml.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Ml.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Ml.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)El("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),a=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,a=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,a=!0),a&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let a=null;if(n===Vl.DEFAULT&&t.getDataType()===Rl.UNSIGNED_CHAR||n===Vl.DIRECT_SCALARS&&t)a=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:Rl.UNSIGNED_CHAR},i=jt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=i,n.size=i.length,a=Us.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,a,Ol.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,a,Ol.RGBA,s))}return a},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),a=t.getData(),i=e.getData();for(let e=0;e{let i=e.getVectorMode(),s=a,l=o;const c=t.getNumberOfComponents();i===Ml.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=c&&(l=c-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=c):(l<0&&(l=0),l>=c&&(l=c-1),l+s>c&&(s=c-l)),i!==Ml.MAGNITUDE||1!==c&&1!==s||(i=Ml.COMPONENT));let u=0;switch(l>0&&(u=l),i){case Ml.COMPONENT:e.mapScalarsThroughTable(t,n,r,u);break;case Ml.RGBCOLORS:break;case Ml.MAGNITUDE:default:{const o=Us.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{const o=Ll(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{let{alpha:a}=t;if(4===r&&a>=1&&n.getDataType()===Rl.UNSIGNED_CHAR)return n;const i=Us.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:Rl.UNSIGNED_CHAR});if(o<=0)return i;a=a>0?a:0,a=a<1?a:1;let s=Dl;switch(n.getDataType()!==Rl.FLOAT&&n.getDataType()!==Rl.DOUBLE||(s=Ll),r){case 1:e.luminanceToRGBA(i,n,a,s);break;case 2:e.luminanceAlphaToRGBA(i,n,s);break;case 3:e.rGBToRGBA(i,n,a,s);break;case 4:e.rGBAToRGBA(i,n,a,s);break;default:return El("Cannot convert colors"),null}return i},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const a=n.getNumberOfComponents();return(r!==Vl.DEFAULT||n.getDataType()!==Rl.UNSIGNED_CHAR)&&r!==Vl.DIRECT_SCALARS||(3===a||1===a?t.alpha>=1:255===n.getRange(a-1)[0])}}const Nl={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Ml.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function kl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nl,n),jt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],jt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),jt.setArray(e,t,["mappingRange"],2),jt.getArray(e,t,["mappingRange"]),Bl(e,t)}var Fl={newInstance:jt.newInstance(kl,"vtkScalarsToColors"),extend:kl,...Pl};const{vtkErrorMacro:_l}=jt;function Gl(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Fa(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const a=4*o;return n.slice(a,a+4)},e.indexedLookupFunction=(n,r,o)=>{let a=e.getAnnotatedValueIndexInternal(n);-1===a&&(a=t.numberOfColors+2);const i=4*a;return[r[i],r[i+1],r[i+2],r[i+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,a)=>{let i=e.linearLookup;t.indexedLookup&&(i=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const c=e.getAlpha(),u=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(c>=1){if(o===Al.RGBA)for(let e=0;e{let n=0,r=0,o=0,a=0;const i=t.numberOfColors-1;i&&(n=(t.hueRange[1]-t.hueRange[0])/i,r=(t.saturationRange[1]-t.saturationRange[0])/i,o=(t.valueRange[1]-t.valueRange[0])/i,a=(t.alphaRange[1]-t.alphaRange[0])/i),t.table.length=4*i+16;const s=[],l=[];for(let e=0;e<=i;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,Pa(s,l),l[3]=t.alphaRange[0]+e*a,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let a=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Ul={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Wl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ul,n),Fl.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},jt.obj(t.buildTime),t.opaqueFlagBuildTime={},jt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},jt.obj(t.insertTime,{mtime:0}),jt.get(e,t,["buildTime"]),jt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),jt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),jt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),jt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Gl(e,t)}var zl={newInstance:jt.newInstance(Wl,"vtkLookupTable"),extend:Wl};let Hl=1,jl=0;const Kl=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function $l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;jl=e}var ql={getResolveCoincidentTopologyAsString:function(){return Kl[jl]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return Hl},getResolveCoincidentTopology:function(){return jl},setResolveCoincidentTopology:$l,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){Hl=e},setResolveCoincidentTopologyToDefault:function(){$l(0)},setResolveCoincidentTopologyToOff:function(){$l(0)},setResolveCoincidentTopologyToPolygonOffset:function(){$l(1)}};function Xl(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const Yl=["Polygon","Line","Point"],Zl={};Xl(Zl,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},Yl.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var Ql={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),jt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(ql).forEach((t=>{e[t]=ql[t]})),Object.keys(Zl).forEach((t=>{e[t]=Zl[t]})),Xl(e,t.topologyOffset,Yl.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=Zl.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=Zl.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=Zl.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:Zl,otherStaticMethods:ql,CATEGORIES:Yl};const Jl={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var ec={PassTypes:Jl};const{FieldAssociations:tc}=gl,{staticOffsetAPI:nc,otherStaticMethods:rc}=Ql,{ColorMode:oc,ScalarMode:ac,GetArray:ic}=wl,{VectorMode:sc}=Pl,{VtkDataTypes:lc}=Us;function cc(e){return()=>jt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function uc(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=_a(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=zl.newInstance()},e.getColorModeAsString=()=>jt.enumToString(oc,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(ac,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===ac.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===ac.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===ac.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===ac.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ac.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ac.USE_FIELD_DATA){const t=e.getFieldData();i=r===ic.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==a){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Fa(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,a,i,s,l,c)=>{const u=(i[1]-i[0])/l,d=[];d[0]=i[0]-u,d[1]=i[1]+u;const p=1/(d[1]-d[0]),f=n.getData(),g=t.getData();let m=0,h=0;if(a<0||a>=o)for(let t=0;t{const o=t.lookupTable.getRange(),a=t.lookupTable.usingLogScale();a&&zl.getLogRange(o,o);const i=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),i=n.getNumberOfTuples();t.colorCoordinates=Us.newInstance({numberOfComponents:2,values:new Float32Array(2*i)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===sc.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,i,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,a)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===oc.DEFAULT&&o.getDataType()===lc.UNSIGNED_CHAR||t.colorMode===oc.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=cc("AcquireInvertibleLookupTable"),e.valueToColor=cc("ValueToColor"),e.colorToValue=cc("ColorToValue"),e.useInvertibleColorFor=cc("UseInvertibleColorFor"),e.clearInvertibleColor=cc("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(Jl.ID_LOW24),o=e.getRawPixelBuffer(Jl.ID_HIGH24),a=e.getCurrentPass(),i=e.getFieldAssociation();let s=null;i===tc.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:i===tc.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(a===Jl.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const a=s[n],i=e.getPixelBuffer(Jl.ID_LOW24);i[t]=255&a,i[t+1]=(65280&a)>>8,i[t+2]=(16711680&a)>>16}else if(a===Jl.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const a=s[n];e.getPixelBuffer(Jl.ID_HIGH24)[t]=(4278190080&a)>>24}}))}}const dc={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dc,n),$s(e,t,n),jt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),jt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),Ql.implementCoincidentTopologyMethods(e,t),uc(e,t)}var fc={newInstance:jt.newInstance(pc,"vtkMapper"),extend:pc,...nc,...rc,...wl};function gc(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function mc(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=mc(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=gc(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const a=e.getNumberOfTuples();a{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function yc(e){return{empty:!0,numberOfComponents:1,dataType:ws.UNSIGNED_INT,...e}}function bc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Us.extend(e,t,yc(n)),vc(e,t)}var xc={newInstance:jt.newInstance(bc,"vtkCellArray"),extend:bc,...hc};const{vtkErrorMacro:Tc}=jt,Cc=[1,-1,1,-1,1,-1];function Sc(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=jt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Tc(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Cc;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const Ac={empty:!0,numberOfComponents:3,dataType:ws.FLOAT,bounds:[1,-1,1,-1,1,-1]};function Pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),Us.extend(e,t,n),Sc(e,t)}var Ic={newInstance:jt.newInstance(Pc,"vtkPoints"),extend:Pc};function wc(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=jt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,a=3*t;r[a]=o[n],r[++a]=o[++n],r[++a]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else Ra(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,a,i)=>{},e.evaluatePosition=(e,t,n,r,o,a)=>{jt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const Oc={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function Mc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Oc,n),jt.obj(e,t),t.points||(t.points=Ic.newInstance()),jt.get(e,t,["points","pointsIds"]),wc(e,t)}var Rc={newInstance:jt.newInstance(Mc,"vtkCell"),extend:Mc};function Vc(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const Ec={array:null,maxId:0,extend:0};function Dc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ec,n),jt.obj(e,t),Vc(e,t)}var Lc={newInstance:jt.newInstance(Dc,"vtkCellLinks"),extend:Dc};const Bc=0,Nc=1,kc=2,Fc=3,_c=4,Gc=5,Uc=6,Wc=7,zc=9,Hc=21,jc=41,Kc=42,$c=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],qc={getClassNameFromTypeId:function(e){return e<$c.length?$c[e]:"UnknownClass"},getTypeIdFromClassName:function(e){return $c.findIndex(e)},isLinear:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=Bc},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Yc={size:0,maxId:-1,extend:1e3};function Zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yc,n),jt.obj(e,t),jt.get(e,t,["size","maxId","extend"]),jt.getArray(e,t,["typeArray","locationArray"]),Xc(e,t)}var Qc={newInstance:jt.newInstance(Zc,"vtkCellTypes"),extend:Zc,...qc},Jc={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};const{IntersectionState:eu}=Jc;function tu(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},a=[];let i;a[0]=n[0]-t[0],a[1]=n[1]-t[1],a[2]=n[2]-t[2];const s=a[0]*(e[0]-t[0])+a[1]*(e[1]-t[1])+a[2]*(e[2]-t[2]),l=Xo(a,a);let c=1e-5*s;return 0!==l&&(o.t=s/l),c<0&&(c=-c),-c1?i=n:(i=a,a[0]=t[0]+o.t*a[0],a[1]=t[1]+o.t*a[1],a[2]=t[2]+o.t*a[2]),r&&(r[0]=i[0],r[1]=i[1],r[2]=i[2]),o.distance=ea(i,e),o}function nu(e,t,n,r,o,a){const i=[],s=[],l=[];o[0]=0,a[0]=0,jo(t,e,i),jo(r,n,s),jo(n,e,l);const c=[Xo(i,i),-Xo(i,s),-Xo(i,s),Xo(s,s)],u=[];if(u[0]=Xo(i,l),u[1]=-Xo(s,l),0===Ca(c,u,2)){let i=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],c=[r,r,t,t];let u;a[0],a[0],o[0],o[0],o[0],o[0],a[0],a[0];for(let e=0;e<4;e++)u=tu(s[e],l[e],c[e]),u.distance=0&&o[0]<=1&&a[0]>=0&&a[0]<=1?eu.YES_INTERSECTION:eu.NO_INTERSECTION}const ru={distanceToLine:tu,intersection:nu};function ou(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,a)=>{const i={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};a[1]=0,a[2]=0;const s=[],l=[],c=[];t.points.getPoint(0,l),t.points.getPoint(1,c);const u=[],d=[],p=nu(e,n,l,c,u,d);var f;if(i.t=u[0],i.betweenPoints=(f=i.t)>=0&&f<=1,a[0]=d[0],p===eu.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+a[0]*(c[t]-l[t]),s[t]=e[t]+i.t*(n[t]-e[t]);if(ea(o,s)<=r*r)return i.intersect=1,i}else{let t;if(i.t<0)return t=tu(e,l,c,o),t.distance<=r*r?(i.t=0,i.intersect=1,i.betweenPoints=!0,i):i;if(i.t>1)return t=tu(n,l,c,o),t.distance<=r*r?(i.t=1,i.intersect=1,i.betweenPoints=!0,i):i;if(a[0]<0)return a[0]=0,t=tu(l,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i;if(a[0]>1)return a[0]=1,t=tu(c,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i}return i},e.evaluateLocation=(e,n,r)=>{const o=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,a);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(a[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var o,i,s,l,c,u=t[0],d=t[1],p=t[2],f=t[3],g=n[0],m=n[1],h=n[2],v=n[3];(i=u*g+d*m+p*h+f*v)<0&&(i=-i,g=-g,m=-m,h=-h,v=-v),1-i>a?(o=Math.acos(i),s=Math.sin(o),l=Math.sin((1-r)*o)/s,c=Math.sin(r*o)/s):(l=1-r,c=r),e[0]=l*u+c*g,e[1]=l*d+c*m,e[2]=l*p+c*h,e[3]=l*f+c*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const au={orientations:null};function iu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,au,n),Rc.extend(e,t,n),jt.setGet(e,t,["orientations"]),ou(e,t)}var su={newInstance:jt.newInstance(iu,"vtkLine"),extend:iu,...ru,...Jc};function lu(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=ze(t.points):t.points=Ic.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=Ic.newInstance(),t.points.shallowCopy(e.getPoints())}}const cu={};function uu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cu,n),gl.extend(e,t,n),jt.setGet(e,t,["points"]),lu(e,t)}var du={newInstance:jt.newInstance(uu,"vtkPointSet"),extend:uu};function pu(e,t,n,r){const o=n[0]-t[0],a=n[1]-t[1],i=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],c=e[2]-t[2];r[0]=a*c-i*l,r[1]=i*s-o*c,r[2]=o*l-a*s}function fu(e,t,n,r){pu(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const gu={computeNormalDirection:pu,computeNormal:fu,intersectWithTriangle:function(e,t,n,r,o,a){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],c=[],u=[],d=[],p=[];fu(e,t,n,d),fu(r,o,a,p);const f=-Xo(d,e),g=-Xo(p,r),m=[Xo(p,e)+g,Xo(p,t)+g,Xo(p,n)+g];if(m[0]*m[1]>i&&m[0]*m[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const h=[Xo(d,r)+f,Xo(d,o)+f,Xo(d,a)+f];if(h[0]*h[1]>i&&h[0]*h[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-g)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const v=[e,t,n],y=[r,o,a],b=Xo(d,p),x=(f-g*b)/(b*b-1),T=(g-f*b)/(b*b-1),C=[x*d[0]+T*p[0],x*d[1]+T*p[1],x*d[2]+T*p[2]],S=Yo(d,p,[]);Qo(S);let A=0,P=0;const I=[],w=[];let O,M,R=50,V=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,a=ri.intersectWithLine(v[n],v[o],r,p);a.intersection&&a.t>0-i&&a.t<1+i&&(a.t<1+i&&a.t>1-i&&(R=A),I[A++]=Xo(a.x,S)-Xo(C,S));const s=ri.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-i&&s.t<1+i&&(s.t<1+i&&s.t>1-i&&(V=P),w[P++]=Xo(s.x,S)-Xo(C,S))}if(A>2){A--;const e=I[2];I[2]=I[R],I[R]=e}if(P>2){P--;const e=w[2];w[2]=w[V],w[V]=e}if(2!==A||2!==P)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Number.isNaN(I[0])||Number.isNaN(I[1])||Number.isNaN(w[0])||Number.isNaN(w[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(I[0]>I[1]){const e=I[1];I[1]=I[0],I[0]=e}if(w[0]>w[1]){const e=w[1];w[1]=w[0],w[0]=e}return I[1]2,e.intersectWithLine=(n,r,o,a,i)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};i[2]=0;const l=[],c=o*o,u=[],d=[],p=[];t.points.getPoint(0,u),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],g=[];if(fu(u,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=ri.intersectWithLine(n,r,u,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,a[0]=t.x[0],a[1]=t.x[1],a[2]=t.x[2],!t.intersection)return i[0]=0,i[1]=0,s.intersect=0,s;const o=e.evaluatePosition(a,l,i,g);if(o.evaluation>=0)return o.dist2<=c?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=ea(u,d),h=ea(d,p),v=ea(p,u);t.line||(t.line=su.newInstance()),m>h&&m>v?(t.line.getPoints().setPoint(0,u),t.line.getPoints().setPoint(1,d)):h>v&&h>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,u));const y=t.line.intersectWithLine(n,r,o,a,i);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=u[r]-p[r],t[r]=d[r]-p[r],n[r]=a[r]-p[r];return i[0]=Xo(n,e)/v,i[1]=Xo(n,t)/h,s.intersect=1,s}return i[0]=0,i[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const a={subId:0,dist2:0,evaluation:-1};let i,s;const l=[],c=[],u=[],d=[];let p;const f=[],g=[],m=[];let h=0,v=0;const y=[];let b,x,T,C=[];const S=[],A=[],P=[];a.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,c),t.points.getPoint(0,u),pu(l,c,u,d),ri.generalizedProjectPoint(e,l,d,P);let I=0;for(i=0;i<3;i++)p=d[i]<0?-d[i]:d[i],p>I&&(I=p,v=i);for(s=0,i=0;i<3;i++)i!==v&&(y[s++]=i);for(i=0;i<2;i++)f[i]=P[y[i]]-u[y[i]],g[i]=l[y[i]]-u[y[i]],m[i]=c[y[i]]-u[y[i]];if(h=oa(g,m),0===h)return r[0]=0,r[1]=0,a.evaluation=-1,a;if(r[0]=oa(f,m)/h,r[1]=oa(g,f)/h,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(a.dist2=ea(P,e),n[0]=P[0],n[1]=P[1],n[2]=P[2]),a.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=ea(e,u),x=su.distanceToLine(e,l,u,t,S),T=su.distanceToLine(e,u,c,t,A),b{const o=[],a=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,a),t.points.getPoint(2,i);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+a[t]*e[0]+i[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const hu={};function vu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hu,n),Rc.extend(e,t,n),mu(e,t)}var yu={newInstance:jt.newInstance(vu,"vtkTriangle"),extend:vu,...gu};const bu=["verts","lines","polys","strips"],{vtkWarningMacro:xu}=jt,Tu={[Fc]:su,[_c]:su,[Gc]:yu};function Cu(e,t){t.classHierarchy.push("vtkPolyData"),bu.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=ze(t[n]):t[n]=xc.newInstance()})),e.getNumberOfCells=()=>bu.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),bu.forEach((n=>{t[n]=xc.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),a=e.getNumberOfStrips(),i=n+r+o+a,s=new Uint8Array(i);let l=s;const c=new Uint32Array(i);let u=c;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>1?kc:Nc,e+=t+1})),u=u.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>2?_c:Fc,1===t&&xu("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),u=u.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(u[n]=e,t){case 3:l[n]=Gc;break;case 4:l[n]=zc;break;default:l[n]=Wc}t<3&&xu("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),u+=u.subarray(o),l+=l.subarray(o)}if(a){let e=0;l.fill(Uc,0,a),t.strips.getCellSizes().forEach(((t,n)=>{u[n]=e,e+=t+1}))}t.cells=Qc.newInstance(),t.cells.setCellTypes(i,s,c)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=Lc.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case Nc:case kc:o=t.verts;break;case Fc:case _c:o=t.lines;break;case Gc:case zc:case Wc:o=t.polys;break;case Uc:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const a=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(a)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),a=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==a.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Tu[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Su={};function Au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Su,n),du.extend(e,t,n),jt.get(e,t,["cells","links"]),jt.setGet(e,t,["verts","lines","polys","strips"]),Cu(e,t)}var Pu={newInstance:jt.newInstance(Au,"vtkPolyData"),extend:Au};function Iu(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const wu={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Ou(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wu,n),jt.obj(e,t),jt.algo(e,t,6,0),jt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),jt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Iu(e,t)}const Mu={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],a=e.length/(t*n);let i=t,s=n,l=e;const c=[l];for(let e=0;ea&&(u+=t),d<-a&&(u-=t),r[u]?c+=r[u]*o[l]:s-=o[l],i+=1}l[e+n]=c/s}r=[...l];for(let e=0;e{t.renderable!==n&&(t.renderable=n,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),e.modified())},e.createPolyDataForOneLabel=(e,n,r,o,a,i,s)=>{const l=t.renderable.get_tmAtlas().get(e);if(!l)return;const c=t.renderable.getTextPolyData().getPoints().getData(),u=t.lastSize;Nu[0]=c[3*n],Nu[1]=c[3*n+1],Nu[2]=c[3*n+2],Ln(Fu,Nu,r),Fu[0]+=.1,Ln(ku,Fu,o),wn(Gu,ku,Nu),Fu[0]-=.1,Fu[1]+=.1,Ln(ku,Fu,o),wn(Uu,ku,Nu);for(let e=0;e<3;e++)Gu[e]/=.05*u[0],Uu[e]/=.05*u[1];let d=s.ptIdx,p=s.cellIdx;Nu[0]=c[3*n],Nu[1]=c[3*n+1],Nu[2]=c[3*n+2],a[0]<-.5?On(Fu,Gu,a[0]*i-l.width):a[0]>.5?On(Fu,Gu,a[0]*i):On(Fu,Gu,a[0]*i-l.width/2),In(Nu,Nu,Fu),On(Fu,Uu,a[1]*i-l.height/2),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,On(Fu,Gu,l.width),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,On(Fu,Uu,l.height),In(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,On(Fu,Gu,l.width),wn(Nu,Nu,Fu),s.points[3*d]=Nu[0],s.points[3*d+1]=Nu[1],s.points[3*d+2]=Nu[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{const n=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);m(n,n);const r=t.renderable.getTextValues().length,o=4*r,a=2*r,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o);h(Wu,n);const c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l};let u=0,d=0,p=0;const f=t.renderable.getTextPolyData().getPoints().getData(),g=t.renderable.getTextValues();for(;u{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0),t.camera=r,e.updateTexturePolyData()}}const ju=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),t.tmPolyData=Pu.newInstance(),t.tmMapper=fc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=Ps.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),jt.setGet(e,t,["renderable"]),jt.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},jt.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],Hu(e,t)}),"vtkCubeAxesActorHelper");function Ku(e,t){t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=n=>{t.camera!==n&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=n,n&&(t.cameraModifiedSub=n.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{const e=t.camera.getViewMatrix();m(e,e);let n=!1;const r=Ui.getDiagonalLength(t.dataBounds),o=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let a=0;a<6;a++){let i=!1;const s=Math.floor(a/2),l=(s+1)%3,c=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*c]!==t.dataBounds[2*c+1]&&(Nu[s]=t.dataBounds[a]-.1*r*Vu[a][s],Nu[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),Nu[c]=.5*(t.dataBounds[2*c]+t.dataBounds[2*c+1]),Ln(Fu,Nu,e),Nu[s]=t.dataBounds[a],Ln(_u,Nu,e),wn(Fu,_u,Fu),Vn(Fu,Fu),i=Fu[2]>o,t.camera.getParallelProjection()||(Vn(_u,_u),i=En(_u,Fu)>o)),i!==t.lastFacesToDraw[a]&&(t.lastFacesToDraw[a]=i,n=!0)}return n},e.updatePolyData=(e,n,r)=>{let o=0,a=0;o+=8;let i=0;for(let e=0;e<12;e++)n[e]>0&&i++;if(a+=i,t.gridLines)for(let t=0;t<6;t++)e[t]&&(o+=2*r[Bu[t][0]].length+2*r[Bu[t][1]].length,a+=r[Bu[t][0]].length+r[Bu[t][1]].length);const s=new Float64Array(3*o),l=new Uint32Array(3*a);let c=0,u=0;for(let e=0;e<2;e++)for(let n=0;n<2;n++)for(let r=0;r<2;r++)s[3*c]=t.dataBounds[r],s[3*c+1]=t.dataBounds[2+n],s[3*c+2]=t.dataBounds[4+e],c++;for(let e=0;e<12;e++)n[e]>0&&(l[3*u]=2,l[3*u+1]=Du[e][0],l[3*u+2]=Du[e][1],u++);if(t.gridLines)for(let n=0;n<6;n++)if(e[n]){const e=Math.floor(n/2);let o=r[Bu[n][0]];for(let r=0;r{let a=0;for(let e=0;e<12;e++)1===n[e]&&(a+=2,a+=r[Lu[e]].length);const i=t.polyData.getPoints().getData(),s=new Float64Array(3*a);let l=0,c=0,u=0;for(let a=0;a<6;a++)if(e[a])for(let e=0;e<4;e++){const d=Eu[a][e];if(1===n[d]){const e=Lu[d],n=3*Du[d][0],p=3*Du[d][1];s[3*l]=.5*(i[n]+i[p]),s[3*l+1]=.5*(i[n+1]+i[p+1]),s[3*l+2]=.5*(i[n+2]+i[p+2]),l++,s[3*l+Math.floor(a/2)]=t.dataBounds[a],s[3*l+Bu[a][0]]=.5*(t.dataBounds[2*Bu[a][0]]+t.dataBounds[2*Bu[a][0]+1]),s[3*l+Bu[a][1]]=.5*(t.dataBounds[2*Bu[a][1]]+t.dataBounds[2*Bu[a][1]+1]),l++,t.textValues[c]=t.axisLabels[e],c++;const f=(e+1)%3,g=(e+2)%3,m=r[e],h=o[e];t.tickCounts[u]=m.length;for(let r=0;r{if(!t.camera)return;const n=e.computeFacesToDraw(),r=t.lastFacesToDraw;let o=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(o=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(n||o||t.forceUpdate){const n=new Array(12).fill(0);for(let e=0;e<6;e++)if(r[e])for(let t=0;t<4;t++)n[Eu[e][t]]++;const a=[],i=[];for(let e=0;e<3;e++){const n=yo().domain([t.dataBounds[2*e],t.dataBounds[2*e+1]]);a[e]=n.ticks(5);const r=n.tickFormat(5);i[e]=a[e].map(r)}e.updatePolyData(r,n,a),e.updateTextData(r,n,a,i),(o||t.forceUpdate)&&e.updateTextureAtlas(i)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let n=0,r=1;for(let o=0;o<3;o++){if(!t._tmAtlas.has(t.axisLabels[o])){zu(t.tmContext,t.axisTextStyle);const e=t.tmContext.measureText(t.axisLabels[o]),a={height:e.actualBoundingBoxAscent+2,startingHeight:r,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[o],a),r+=a.height,n{e.tcoords=[0,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight)/r,0,(r-e.startingHeight)/r]})),t.tmCanvas.width=n,t.tmCanvas.height=r,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,n,r),t._tmAtlas.forEach(((e,n)=>{zu(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified((()=>{t.forceUpdate=!0,e.update()})),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.getBounds=()=>(e.update(),Ui.setBounds(t.bounds,t.gridActor.getBounds()),Ui.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor),t.bounds);const n=jt.chain(e.setProperty,t.gridActor.setProperty);e.setProperty=e=>n(e)[0]}function $u(e){return{boundsScaleFactor:1.3,camera:null,dataBounds:[...Ui.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:12,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},...e}}function qu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$u(n)),Ps.extend(e,t,n),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=Ru.newInstance(),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=fc.newInstance(),t.polyData=Pu.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=Ps.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=Pu.newInstance(),jt.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset"]),jt.setGetArray(e,t,["dataBounds"],6),jt.setGetArray(e,t,["axisLabels"],3),jt.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),Ku(e,t)}var Xu={newInstance:jt.newInstance(qu,"vtkCubeAxesActor"),extend:qu,newCubeAxesActorHelper:ju};function Yu(e,t){t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Zu={};const Qu=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zu,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Xu.newCubeAxesActorHelper(),Yu(e,t)}),"vtkOpenGLCubeAxesActor");rn("vtkCubeAxesActor",Qu);const Ju={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var ed={ObjectType:Ju};const{ObjectType:td}=ed;function nd(e,t){function n(e){switch(e){case td.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case td.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case td.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,a=!0,i="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===a,e.generateBuffer=e=>{const a=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===a},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,a=!1,!0):(i="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>i}const rd={objectType:td.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function od(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rd,n),jt.obj(e,t),jt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),nd(e,t)}var ad={newInstance:jt.newInstance(od),extend:od,...ed};const{vtkErrorMacro:id}=jt;function sd(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(Ju.ARRAY_BUFFER),e.createVBO=function(n,r,o,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=a.points.getData();let l=null,c=null,u=null;const d=a.colors?a.colors.getNumberOfComponents():0,p=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),a.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,c=a.tcoords.getData()),a.colors?(t.colorComponents=a.colors.getNumberOfComponents(),t.colorOffset=0,u=a.colors.getData(),t.colorBO||(t.colorBO=ad.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,g=0,m=0,h=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let C=null,S=null;o===ps.POINTS||"verts"===r?(C=x.anythingToPoints,S=T.anythingToPoints):o===ps.WIREFRAME||"lines"===r?(C=x[`${r}ToWireframe`],S=T[`${r}ToWireframe`]):(C=x[`${r}ToSurface`],S=T[`${r}ToSurface`]);const A=n.getData(),P=A.length;let I=0;for(let e=0;e0&&(Math.abs(E)/V>1e6||Math.abs(Math.log10(V))>3||0===V&&E>1e6);if(D){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=a.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(i)if(i.points||i.cells){const e=new Int32Array(I+i.points.length);e.set(i.points),i.points=e;const t=new Int32Array(I+i.cells.length);t.set(i.cells),i.cells=t}else i.points=new Int32Array(I),i.cells=new Int32Array(I);let L=a.vertexOffset;f=function(e){if(i&&(i.points[L]=e,i.cells[L]=b+a.cellOffset),++L,g=3*e,t.coordShiftAndScaleEnabled?(O[M++]=(s[g++]-t.coordShift[0])*t.coordScale[0],O[M++]=(s[g++]-t.coordShift[1])*t.coordScale[1],O[M++]=(s[g++]-t.coordShift[2])*t.coordScale[2]):(O[M++]=s[g++],O[M++]=s[g++],O[M++]=s[g++]),null!==l&&(m=a.haveCellNormals?3*(b+a.cellOffset):3*e,O[M++]=l[m++],O[M++]=l[m++],O[M++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&Fn(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&Fn(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(kn(e,[0,0,0])&&kn(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Rn(n,t);const r=new Float64Array(16);return k(r,Hi(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):id("Wrong type for coordScale, expected vec3 or null"):id("Wrong type for coordShift, expected vec3 or null")}}const ld={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function cd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ld,n),ad.extend(e,t,n),jt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),jt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),sd(e,t)}var ud={newInstance:jt.newInstance(cd),extend:cd};const{vtkErrorMacro:dd}=jt;function pd(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return dd(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const fd={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function gd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fd,n),jt.obj(e,t),jt.setGet(e,t,["shaderType","source","error","handle","context"]),pd(e,t)}var md={newInstance:jt.newInstance(gd,"vtkShader"),extend:gd};const{vtkErrorMacro:hd}=jt;function vd(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(hd(`Links failed: ${t.error}`),0):(hd(t.error),0):(hd(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),hd(t.fragmentShader.getError()),0):(hd(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),hd(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return hd(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,a),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,a),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(a,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(a,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,a)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(i,r,o,a),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(hd("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return hd("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const yd={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function bd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yd,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=md.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=md.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=md.newInstance(),t.geometryShader.setShaderType("Geometry"),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),vd(e,t)}var xd={newInstance:jt.newInstance(bd,"vtkShaderProgram"),extend:bd,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),a=!1===r?t:new RegExp(t,"g"),i=e.replace(a,o);return{replace:i!==o,result:i}}};function Td(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,a,i,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,a,i,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,a,i,s,l,c,u,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==Ju.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=a,f.stride=i,f.type=s,f.size=l,f.normalize=c,f.isMatrix=d,f.divisor=u,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),u>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,a,i,s,l,c,u,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Cd={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Sd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cd,n),t.buffers=[],jt.obj(e,t),jt.get(e,t,["supported"]),jt.setGet(e,t,["forceEmulation"]),Td(e,t)}var Ad={newInstance:jt.newInstance(Sd,"vtkOpenGLVertexArrayObject"),extend:Sd};const Pd={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Id(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,a)=>{if(t.CABO.getElementCount()){const i=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,c=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),i===l.LINES&&s?(e.updateShaders(n,r,a),l.drawArraysInstanced(i,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,a),l.drawArrays(i,0,t.CABO.getElementCount()),l.lineWidth(1));const u=(i===l.POINTS?1:0)||(i===l.LINES?2:3);return t.pointPicking&&l.depthMask(c),t.CABO.getElementCount()/u}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ps.POINTS||n===Pd.Points?t.context.POINTS:e===ps.WIREFRAME||n===Pd.Lines||n===Pd.TrisEdges||n===Pd.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(a,n,r);const i=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==e.getProgram()&&(e.setProgram(i),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Pd.Points||r.getProperty().getRepresentation()===ps.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let a=n.Vertex;a=xd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(a=xd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=a},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Pd.Points?2:t.primitiveType===Pd.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const wd={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Od(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wd,n),jt.obj(e,t),t.shaderSourceTime={},jt.obj(t.shaderSourceTime),t.attributeUpdateTime={},jt.obj(t.attributeUpdateTime),jt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=xd.newInstance(),t.VAO=Ad.newInstance(),t.CABO=ud.newInstance(),Id(e,t)}var Md={newInstance:jt.newInstance(Od),extend:Od,primTypes:Pd};const Rd={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Vd={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Ed={Wrap:Rd,Filter:Vd};const Dd=new Float32Array(1),Ld=new Int32Array(Dd.buffer);var Bd={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){Dd[0]=e;const t=Ld[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:Nd,Filter:kd}=Ed,{VtkDataTypes:Fd}=Us,{vtkDebugMacro:_d,vtkErrorMacro:Gd,vtkWarningMacro:Ud}=Kt,{toHalf:Wd}=Bd;function zd(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let a=t.width*t.height*t.components;if(r&&(a*=t.depth),e!==Fd.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==Fd.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Uint8Array(t))}else o.push(null);let i=!1;if(t._openGLRenderWindow.getWebgl2())i=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");i=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(i)for(let e=0;e=o&&(c=o-1);const m=i-l,h=1-m;l=l*r*a,c=c*r*a;for(let t=0;t=r&&(p=r-1);const v=i-s;s*=a,p*=a;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||a);t.useHalfFloat=s}(a,c.offset,c.scale,r),t.useHalfFloat||e.getOpenGLDataType(a,!0),{numComps:o,dataType:a,data:i,scaleOffsets:c}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(kd.LINEAR),e.setMagnificationFilter(kd.LINEAR)):(e.setMinificationFilter(kd.NEAREST),e.setMagnificationFilter(kd.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(Nd.REPEAT),e.setWrapS(Nd.REPEAT),e.setWrapT(Nd.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,Fd.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(kd.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,Fd.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),a=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:Ud("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||_d(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(_d("Unsupported internal texture type!"),_d(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case Fd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&Fd.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&Fd.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&Fd.SHORT:case t.useHalfFloat&&Fd.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case Fd.FLOAT:case Fd.VOID:default:return t.context.FLOAT}switch(e){case Fd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Fd.FLOAT:case Fd.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case kd.NEAREST:return t.context.NEAREST;case kd.LINEAR:return t.context.LINEAR;case kd.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case kd.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case kd.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case kd.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case Nd.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case Nd.REPEAT:return t.context.REPEAT;case Nd.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(a,i,s,l,c){let u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[c],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),u&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(a,i,s,l,c)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=c.length/6-1,e.createTexture(),e.bind();const u=r(n(l,c)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&a>=1;){let i=null;n<=t.maxLevel&&(i=d[6*n+e]),o(l)?null!=i&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,a,t.format,t.openGLDataType,i):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,a,0,t.format,t.openGLDataType,i),n++,r/=2,a/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,a,i)=>(e.getOpenGLDataType(a),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?a===Fd.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=i&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(a,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(Gd("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(Fd.UNSIGNED_CHAR),e.getInternalFormat(Fd.UNSIGNED_CHAR,4),e.getFormat(Fd.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||Wo(n.width)&&Wo(n.height)),a=document.createElement("canvas");a.width=r?Uo(n.width):n.width,a.height=r?Uo(n.height):n.height,t.width=a.width,t.height=a.height;const i=a.getContext("2d");i.translate(0,a.height),i.scale(1,-1),i.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);const s=a;return o(Fd.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(Fd.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,a){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Us.newInstance({numberOfComponents:r,dataType:o,values:a}),i)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:i,dataType:s,data:l}=a(r,o);e.create2DFromRaw(t,n,i,s,l)},e.create3DFromRaw=(a,i,s,l,c,u)=>{if(e.getOpenGLDataType(c),e.getInternalFormat(c,l),e.getFormat(c,l),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=a,t.height=i,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(c,[u],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(c)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(c,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,a,i){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Us.newInstance({numberOfComponents:o,dataType:a,values:i}),s)},e.create3DFilterableFromDataArray=function(n,r,i,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:c,dataType:u,data:d,scaleOffsets:p}=a(s,l),f=n*r*i,g=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=Fd.UNSIGNED_CHAR;if(u===Fd.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=Fd.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,c),e.getFormat(y,c),!t.internalFormat||!t.format||!t.openGLDataType)return Gd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===Fd.FLOAT||c>=3)&&(b=4096);let x=1,T=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),T=x);let C=Math.sqrt(f)/x;C=Uo(C);const S=Math.floor(C*x/n),A=Math.ceil(i/S),P=Uo(r*A/T);let I;t.width=C,t.height=P,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=A,t.volumeInfo.xstride=x,t.volumeInfo.ystride=T,t.volumeInfo.offset=h.offset,t.volumeInfo.scale=h.scale;const w=C*P*c;I=y===Fd.FLOAT?new Float32Array(w):new Uint8Array(w);let O=0;const M=Math.floor(n/x),R=Math.floor(r/T);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const Hd={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:Nd.CLAMP_TO_EDGE,wrapT:Nd.CLAMP_TO_EDGE,wrapR:Nd.CLAMP_TO_EDGE,minificationFilter:kd.NEAREST,magnificationFilter:kd.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function jd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hd,n),Zt.extend(e,t,n),t.sendParametersTime={},yt(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},yt(t.textureBuildTime,{mtime:0}),St(e,t,["format","openGLDataType"]),At(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),xt(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ot(0,t,["openGLRenderWindow"]),zd(e,t)}const Kd=Et(jd,"vtkOpenGLTexture");var $d={newInstance:Kd,extend:jd,...Ed};rn("vtkTexture",Kd);var qd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Xd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",Yd=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const a=e.getCoincidentParameters(r,o);if(a&&(0!==a.factor||0!==a.offset)){let e=n.Fragment;e=xd.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==a.factor?(e=xd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==a.factor?(e=xd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=xd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},Zd=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const a=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,a,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,a)},e.getReplacedShaderTemplate=(n,r,o)=>{const a=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let i=n.Vertex;if(a){const e=a.VertexShaderCode;void 0!==e&&""!==e&&(i=e)}n.Vertex=i;let s=n.Fragment;if(a){const e=a.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(a){const e=a.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};const{FieldAssociations:Qd}=gl,{primTypes:Jd}=Md,{Representation:ep,Shading:tp}=xs,{ScalarMode:np}=fc,{Filter:rp,Wrap:op}=$d,{vtkErrorMacro:ap}=Kt,ip={type:"StartEvent"},sp={type:"EndEvent"},{CoordinateSystem:lp}=is;function cp(e,t){function n(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Jd.Start;e{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;const s=t.lastBoundBO.getReferenceByName("lastLightComplexity");let l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let c=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(c=c.concat([" vec3 specularColor;"," float specularPower;"])),c=c.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(c=c.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),o=xd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=xd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=xd.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=xd.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?t.renderable.getInterpolateScalarsBeforeMapping()&&t.renderable.getColorCoordinates()&&!t.drawingEdges?i=xd.substitute(i,"//VTK::Color::Impl",c.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(r.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),i=xd.substitute(i,"//VTK::Color::Impl",c).result):i=xd.substitute(i,"//VTK::Color::Impl",c.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,i=xd.substitute(i,"//VTK::Color::Dec",l).result,e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderLight=(e,n,r)=>{let o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),i=t.lastBoundBO.getReferenceByName("lastLightCount");let s=[];switch(a){case 0:o=xd.substitute(o,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:o=xd.substitute(o,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5,\n dot(reflect(lightDirectionVC${e},\n normalVCVSOutput),\n normalize(-vertexVC.xyz))),\n specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),o=xd.substitute(o,"//VTK::Light::Impl",s,!1).result;break;default:ap("bad light complexity")}e.Fragment=o},e.replaceShaderNormal=(e,n,r)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex,o=e.Geometry,a=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(n=xd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=xd.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=xd.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,a=xd.substitute(a,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(a=xd.substitute(a,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(r.getProperty().getRepresentation())===t.context.LINES?(a=xd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(a=xd.substitute(a,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,a=xd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=xd.substitute(a,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=n,e.Geometry=o,e.Fragment=a}},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r);let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=xd.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=xd.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,o=xd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=xd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=xd.substitute(o,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;n=xd.substitute(n,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const a=t.openGLActor.getActiveTextures();let i=2,s=2;if(a&&a.length>0&&(i=a[0].getComponents(),a[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(i=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(n=xd.substitute(n,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=xd.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,a&&a.length>=1)switch(i){case 1:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(n=xd.substitute(n,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=xd.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,i){case 1:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=xd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes();o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,o=xd.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,a=xd.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getCoincidentParameters=(e,n)=>{let r={factor:0,offset:0};const o=n.getProperty();if(t.renderable.getResolveCoincidentTopology()||o.getEdgeVisibility()&&o.getRepresentation()===ep.SURFACE){const e=t.lastBoundBO.getPrimitiveType();e===Jd.Points||o.getRepresentation()===ep.POINTS?r=t.renderable.getCoincidentTopologyPointOffsetParameter():e===Jd.Lines||o.getRepresentation()===ep.WIREFRAME?r=t.renderable.getCoincidentTopologyLineOffsetParameters():e!==Jd.Tris&&e!==Jd.TriStrips||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),e!==Jd.TrisEdges&&e!==Jd.TriStripsEdges||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),r.factor/=2,r.offset/=2)}const a=t._openGLRenderer.getSelector();return a&&a.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(r.offset-=2),r},e.replaceShaderPicking=(e,n,r)=>{let o=e.Fragment,a=e.Vertex;if(o=xd.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch(t.lastSelectionState!==Jl.ID_LOW24&&t.lastSelectionState!==Jl.ID_HIGH24||(a=xd.substitute(a,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,a=xd.substitute(a,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,o=xd.substitute(o,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,o=xd.substitute(o,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case Jl.ID_LOW24:o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case Jl.ID_HIGH24:o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=xd.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=xd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=o,e.Vertex=a}},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderColor(n,r,o),e.replaceShaderNormal(n,r,o),e.replaceShaderLight(n,r,o),e.replaceShaderTCoord(n,r,o),e.replaceShaderPicking(n,r,o),e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=xd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=xd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}},e.getNeedToRebuildShaders=(e,n,r)=>{let o=0,a=0;const i=e.getPrimitiveType(),s=t.currentInput;let l=!1;const c=s.getPointData().getNormals(),u=s.getCellData().getNormals(),d=r.getProperty().getInterpolation()===tp.FLAT,p=r.getProperty().getRepresentation(),f=e.getOpenGLMode(p,i);if(f===t.context.TRIANGLES||u&&!c||!d&&c?l=!0:d||f!==t.context.LINES||(l=!0),r.getProperty().getLighting()&&l){o=0;const e=n.getLightsByReference();for(let t=0;t0&&(a++,0===o&&(o=1)),1===o&&(a>1||1!==n.getIntensity()||!n.lightTypeIsHeadLight())&&(o=2),o<3&&n.getPositional()&&(o=3)}}let g=!1;const m=t.lastBoundBO.getReferenceByName("lastLightComplexity"),h=t.lastBoundBO.getReferenceByName("lastLightCount");return m===o&&h===a||(t.lastBoundBO.set({lastLightComplexity:o},!0),t.lastBoundBO.set({lastLightCount:a},!0),g=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(g=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(n,r,o)=>{if(n.getProgram().isUniformUsed("PrimitiveIDOffset")&&n.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),n.getProgram().isUniformUsed("VertexIDOffset")&&n.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){const e=t.lastBoundBO.getReferenceByName("lastLightComplexity");n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ap("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("normalMC")&&n.getCABO().getNormalOffset()&&e>0?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"normalMC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ap("Error setting normalMC in shader VAO."):n.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach(((e,r)=>{n.getProgram().isAttributeUsed(`${e}MC`)&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),`${e}MC`,n.getCABO().getCustomData()[r].offset,n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getCustomData()[r].components,!1)||ap(`Error setting ${e}MC in shader VAO.`))})),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),!1)||ap("Error setting tcoordMC in shader VAO."):n.getVAO().removeAttributeArray("tcoordMC"),n.getProgram().isAttributeUsed("scalarColor")&&n.getCABO().getColorComponents()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO().getColorBO(),"scalarColor",n.getCABO().getColorOffset(),n.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||ap("Error setting scalarColor in shader VAO."):n.getVAO().removeAttributeArray("scalarColor"),n.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes(),r=[],a=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=a?d(t.tmpMat4,o.getMatrix()):o.getMatrix();a&&(m(i,i),b(i,i,a),m(i,i));for(let n=0;n{const o=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const a=e.getProgram();let i=0;const s=n.getLightsByReference();for(let e=0;e0){const e=r.getColorByReference(),o=r.getIntensity();t.lightColor[0]=e[0]*o,t.lightColor[1]=e[1]*o,t.lightColor[2]=e[2]*o;const s=r.getDirection(),l=n.getActiveCamera().getViewMatrix(),c=[...s];r.lightTypeIsSceneLight()&&(c[0]=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],c[1]=l[4]*s[0]+l[5]*s[1]+l[6]*s[2],c[2]=l[8]*s[0]+l[9]*s[1]+l[10]*s[2],Qo(c)),t.lightDirection[0]=c[0],t.lightDirection[1]=c[1],t.lightDirection[2]=c[2],Qo(t.lightDirection),a.setUniform3fArray(`lightColor${i}`,t.lightColor),a.setUniform3fArray(`lightDirectionVC${i}`,t.lightDirection),i++}}if(o<3)return;const l=n.getActiveCamera().getViewMatrix();m(l,l),i=0;for(let e=0;e0){const e=t.getTransformedPosition(),n=new Float64Array(3);Ln(n,e,l),a.setUniform3fArray(`lightAttenuation${i}`,t.getAttenuationValuesByReference()),a.setUniformi(`lightPositional${i}`,t.getPositional()),a.setUniformf(`lightExponent${i}`,t.getExponent()),a.setUniformf(`lightConeAngle${i}`,t.getConeAngle()),a.setUniform3fArray(`lightPositionVC${i}`,[n[0],n[1],n[2]]),i++}}},e.setCameraShaderParameters=(e,a,i)=>{const s=e.getProgram(),l=t.openGLCamera.getKeyMatrices(a),c=a.getActiveCamera(),u=t.openGLCamera.getKeyMatrixTime().getMTime(),d=s.getLastCameraMTime(),p=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,f=i.getIsIdentity(),m=f?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(i.getCoordinateSystem()===lp.DISPLAY){const e=t._openGLRenderer.getTiledSizeAndOrigin();g(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b(t.tmpMat4,t.tmpMat4,p),s.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else s.setUniformMatrix("MCPCMatrix",n([l.wcpc,m.mcwc,p],r,t.tmpMat4));s.isUniformUsed("MCVCMatrix")&&s.setUniformMatrix("MCVCMatrix",n([l.wcvc,m.mcwc,p],r,t.tmpMat4)),s.isUniformUsed("normalMatrix")&&s.setUniformMatrix3x3("normalMatrix",n([l.normalMatrix,m.normalMatrix],o,t.tmpMat3)),d!==u&&(s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",c.getParallelProjection()),s.setLastCameraMTime(u)),f||s.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram();let a=r.getProperty(),i=a.getOpacity(),s=t.drawingEdges?a.getEdgeColorByReference():a.getAmbientColorByReference(),l=t.drawingEdges?a.getEdgeColorByReference():a.getDiffuseColorByReference(),c=t.drawingEdges?1:a.getAmbient(),u=t.drawingEdges?0:a.getDiffuse(),d=t.drawingEdges?0:a.getSpecular();const p=a.getSpecularPower();o.setUniformf("opacityUniform",i),o.setUniform3fArray("ambientColorUniform",s),o.setUniform3fArray("diffuseColorUniform",l),o.setUniformf("ambient",c),o.setUniformf("diffuse",u);const f=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(f<1)return;let g=a.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",g),o.setUniformf("specularPowerUniform",p),o.setUniformf("specular",d),o.isUniformUsed("ambientIntensityBF")){if(a=r.getBackfaceProperty(),i=a.getOpacity(),s=a.getAmbientColor(),c=a.getAmbient(),l=a.getDiffuseColor(),u=a.getDiffuse(),g=a.getSpecularColor(),d=a.getSpecular(),o.setUniformf("ambientIntensityBF",c),o.setUniformf("diffuseIntensityBF",u),o.setUniformf("opacityUniformBF",i),o.setUniform3fArray("ambientColorUniformBF",s),o.setUniform3fArray("diffuseColorUniformBF",l),f<1)return;o.setUniformf("specularIntensityBF",d),o.setUniform3fArray("specularColorUniformBF",g),o.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,n)=>{const r=t._openGLRenderer.getSelector();if(r){if(t.selectionWebGLIdsToVTKIds?.points?.length){const e=t.selectionWebGLIdsToVTKIds.points.length;r.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){const e=t.selectionWebGLIdsToVTKIds.cells.length;r.setMaximumCellId(e-1)}r.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;const o=function(e){const t=e.getSelector();return t?t.getCurrentPass():Jl.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==o&&(t.selectionStateChanged.modified(),t.lastSelectionState=o),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(r),e.updateBufferObjects(n,r),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=r.getProperty().getEdgeVisibility()&&o===ep.SURFACE,i=t._openGLRenderer.getSelector(),s=i&&i.getFieldAssociation()===Qd.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===Jl.ID_LOW24||t.lastSelectionState===Jl.ID_HIGH24);for(let i=Jd.Start;i=0)||(t.lastBoundBO=t.primitives[i],t.primitiveIDOffset+=t.primitives[i].drawArrays(n,r,o,e),t.vertexIDOffset+=t.primitives[i].getCABO().getElementCount()))},e.renderPieceFinish=(e,n)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(n,r)=>{if(e.invokeEvent(ip),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(sp),!t.currentInput)return void ap("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context,a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const o=t.currentInput;if(null===o)return;t.renderable.mapScalars(o,1);const a=t.renderable.getColorMapColors();t.haveCellScalars=!1;const i=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(i!==np.USE_CELL_DATA&&i!==np.USE_CELL_FIELD_DATA&&i!==np.USE_FIELD_DATA&&o.getPointData().getScalars()||i===np.USE_POINT_FIELD_DATA||!a||(t.haveCellScalars=!0));let s=r.getProperty().getInterpolation()!==tp.FLAT?o.getPointData().getNormals():null;null===s&&o.getCellData().getNormals()&&(t.haveCellNormals=!0,s=o.getCellData().getNormals());const l=r.getProperty().getRepresentation();let c=o.getPointData().getTCoords();if(t.openGLActor.getActiveTextures()||(c=null),t.renderable.getColorCoordinates()){c=t.renderable.getColorCoordinates(),t.internalColorTexture||(t.internalColorTexture=$d.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(rp.NEAREST),e.setMagnificationFilter(rp.NEAREST),e.setWrapS(op.CLAMP_TO_EDGE),e.setWrapT(op.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t.renderable.getColorTextureMap(),r=n.getExtent(),o=n.getPointData().getScalars();e.create2DFromRaw(r[1]-r[0]+1,r[3]-r[2]+1,o.getNumberOfComponents(),o.getDataType(),o.getData()),e.activate(),e.sendParameters(),e.deactivate()}const u=`${o.getMTime()}A${l}B${o.getMTime()}C${s?s.getMTime():1}D${a?a.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${c?c.getMTime():1}`;if(t.VBOBuildString!==u){const n={points:o.getPoints(),normals:s,tcoords:c,colors:a,cellOffset:0,vertexOffset:0,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:t.renderable.getCustomShaderAttributes().map((e=>o.getPointData().getArrayByName(e)))};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});const i=[{inRep:"verts",cells:o.getVerts()},{inRep:"lines",cells:o.getLines()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()}],d=r.getProperty().getEdgeVisibility()&&l===ep.SURFACE;for(let e=Jd.Start;e{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const up={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:Jl.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function dp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,up,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.primitives=[],t.primTypes=Jd,t.tmpMat3=pe(new Float64Array(9)),t.tmpMat4=g(new Float64Array(16));for(let e=Jd.Start;e{t.lookupTable=zl.newInstance()},e.getColorModeAsString=()=>jt.enumToString(gp,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(mp,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===mp.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===mp.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===mp.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===mp.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===mp.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===mp.USE_FIELD_DATA){const t=e.getFieldData();i=r===hp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString===a)return;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]);const i=e.getLookupTable();i&&(i.build(),t.colorMapColors=i.mapScalars(o,t.colorMode,t.fieldDataTupleId)),t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}}}const yp={static:!1,lookupTable:null,scalarVisibility:!1,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,transformCoordinate:null,viewSpecificProperties:null,customShaderAttributes:[]};function bp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yp,n),Hs(e,t,n),jt.get(e,t,["colorMapColors"]),jt.setGet(e,t,["arrayAccessMode","colorByArrayName","colorMode","lookupTable","renderTime","scalarMode","scalarVisibility","static","transformCoordinate","useLookupTableScalarRange","viewSpecificProperties","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),t.viewSpecificProperties||(t.viewSpecificProperties={}),vp(e,t)}var xp={newInstance:jt.newInstance(bp,"vtkMapper2D"),extend:bp};const Tp={BACKGROUND:0,FOREGROUND:1};var Cp={DisplayLocation:Tp};const{primTypes:Sp}=Md,{ScalarMode:Ap}=xp,{vtkErrorMacro:Pp}=Kt,Ip={type:"StartEvent"},wp={type:"EndEvent"};function Op(e,t){t.classHierarchy.push("vtkOpenGLPolyDataMapper2D"),e.buildPass=n=>{n&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Sp.Start;e{e.invokeEvent(Ip),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(wp),t.currentInput?t.currentInput.getPoints&&t.currentInput.getPoints().getNumberOfValues()&&(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Pp("No input!")},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(r)),e.updateBufferObjects(n,r),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,n,r)=>e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return!!(o{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,n.getProperty().getOpacity());const o=t.renderable.getColorMapColors();t.haveCellScalars=!1;const a=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(a!==Ap.USE_CELL_DATA&&a!==Ap.USE_CELL_FIELD_DATA&&a!==Ap.USE_FIELD_DATA&&r.getPointData().getScalars()||a===Ap.USE_POINT_FIELD_DATA||!o||(t.haveCellScalars=!0));const i=n.getProperty().getRepresentation();let s=r.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(s=null);const l=t.renderable.getTransformCoordinate(),c=e.getRenderWindow().getViews()[0].getViewportSize(e),u=`${r.getMTime()}A${i}B${r.getMTime()}C${o?o.getMTime():1}D${s?s.getMTime():1}E${l?e.getMTime():1}F${c}`;if(t.VBOBuildString!==u){let n=r.getPoints();if(l){const t=Ic.newInstance(),r=n.getNumberOfPoints();t.setNumberOfPoints(r);const o=[];for(let a=0;ar.getPointData().getArrayByName(e)))};a.cellOffset+=t.primitives[Sp.Points].getCABO().createVBO(r.getVerts(),"verts",i,a),a.cellOffset+=t.primitives[Sp.Lines].getCABO().createVBO(r.getLines(),"lines",i,a),a.cellOffset+=t.primitives[Sp.Tris].getCABO().createVBO(r.getPolys(),"polys",i,a),a.cellOffset+=t.primitives[Sp.TriStrips].getCABO().createVBO(r.getStrips(),"strips",i,a),t.VBOBuildTime.modified(),t.VBOBuildString=u}},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation();t.context.depthMask(!0);for(let a=Sp.Start;a{t.lastBoundBO&&t.lastBoundBO.getVAO().release()},e.replaceShaderValues=(t,n,r)=>{e.replaceShaderColor(t,n,r),e.replaceShaderTCoord(t,n,r),e.replaceShaderPicking(t,n,r),e.replaceShaderPositionVC(t,n,r)},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.haveCellScalars&&(i=xd.substitute(i,"//VTK::Color::Dec",["uniform samplerBuffer texture1;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = texelFetchBuffer(texture1, gl_PrimitiveID + PrimitiveIDOffset);"]).result),0!==t.lastBoundBO.getCABO().getColorComponents()?(o=xd.substitute(o,"//VTK::Color::Dec",["in vec4 diffuseColor;","out vec4 fcolorVSOutput;"]).result,o=xd.substitute(o,"//VTK::Color::Impl",["fcolorVSOutput = diffuseColor;"]).result,a=xd.substitute(a,"//VTK::Color::Dec",["in vec4 fcolorVSOutput[];\n","out vec4 fcolorGSOutput;"]).result,a=xd.substitute(a,"//VTK::Color::Impl",["fcolorGSOutput = fcolorVSOutput[i];"]).result,i=xd.substitute(i,"//VTK::Color::Dec",["in vec4 fcolorVSOutput;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = fcolorVSOutput;"]).result):(i=xd.substitute(i,"//VTK::Color::Dec",["uniform vec4 diffuseColor;"]).result,i=xd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = diffuseColor;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getCABO().getTCoordComponents();1===a?(n=xd.substitute(n,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,r=xd.substitute(r,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=xd.substitute(o,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===a&&(n=xd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=xd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,r=xd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=xd.substitute(o,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.haveCellScalars&&(r=xd.substitute(r,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderPicking=(e,t,n)=>{let r=e.Fragment;r=xd.substitute(r,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,r=xd.substitute(r,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=r},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r)},e.invokeShaderCallbacks=(e,n,r)=>{const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(e,n,r)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)||Pp("Error setting vertexWC in shader VAO.")),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach(((n,r)=>{e.getProgram().isAttributeUsed(`${n}MC`)&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${n}MC`,e.getCABO().getCustomData()[r].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[r].components,!1)||Pp(`Error setting ${n}MC in shader VAO.`))})),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||Pp("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());const o=t.openGLActor2D.getActiveTextures();if(o)for(let t=0;t{const o=t.renderable.getColorMapColors();if(!o||0===o.getNumberOfComponents()){const t=e.getProgram(),n=r.getProperty(),o=n.getOpacity(),a=n.getColor(),i=[a[0],a[1],a[2],o];t.setUniform4f("diffuseColor",i)}},e.setLightingShaderParameters=(e,t,n)=>{},e.setCameraShaderParameters=(e,n,o)=>{const a=e.getProgram(),i=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=n.getRenderWindow().getViews()[0].getViewportSize(n),l=n.getViewport(),c=o.getActualPositionCoordinate().getComputedDoubleViewportValue(n),u=[0,0,1,1],d=[0,0,1,1];if(d[0]=l[0]>=u[0]?l[0]:u[0],d[1]=l[1]>=u[1]?l[1]:u[1],d[2]=l[2]<=u[2]?l[2]:u[2],d[3]=l[3]<=u[3]?l[3]:u[3],d[0]>=d[2])return;if(d[1]>=d[3])return;s[0]=Lo(s[0]*(d[2]-d[0])/(l[2]-l[0])),s[1]=Lo(s[1]*(d[3]-d[1])/(l[3]-l[1]));const p=t._openGLRenderer.getParent().getSize(),f=Lo(c[0]-(d[0]-l[0])*p[0]),h=Lo(c[1]-(d[1]-l[1])*p[1]),v=-f;let y=-f+s[0];const b=-h;let x=-h+s[1];v===y&&(y=v+1),b===x&&(x=b+1);const T=g(new Float64Array(16));var C,S,A;T[0]=2/(y-v),T[5]=2/(x-b),T[3]=-1*(y+v)/(y-v),T[7]=-1*(x+b)/(x-b),T[10]=0,T[11]=o.getProperty().getDisplayLocation()===Tp.FOREGROUND?-1:1,T[15]=1,m(T,T),a.setUniformMatrix("WCVCMatrix",(C=[T,i],S=r,A=t.tmpMat4,S.identity(A),C.reduce(((e,t,n)=>0===n?t?S.copy(e,t):S.identity(e):t?S.multiply(e,e,t):e),A)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const Mp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null};const Rp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mp,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.primitives=[],t.primTypes=Sp,t.tmpMat4=g(new Float64Array(16));for(let e=Sp.Start;e{const n=e.getLastSize(),r=(n[0]/700)**.8,o=(n[1]/700)**.8,a=Math.min(r,o),i=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(i,t.axisTextStyle),Object.assign(s,t.tickTextStyle),i.fontSize=Math.max(24*a,12),e.getLastAspectRatio()>1?s.fontSize=Math.max(20*a,10):s.fontSize=Math.max(16*a,10);const l=e.updateTextureAtlas();e.setTopTitle(!1);const c=e.getBoxSizeByReference();if(e.getLastAspectRatio()>1)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.98-c[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.99-c[0],-.92])),c[1]=Math.max(1.2,Math.min(1.84/o,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);const t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/n[1],r=2*l.tickWidth/n[0];c[0]=Math.min(1.9,Math.max(1.4,1.4*r*(e.getTicks().length+3))),c[1]=t,e.setBoxPosition([-.5*c[0],-.97])}e.recomputeBarSegments(l)}}function Lp(e,t){return e=>{const t=e.getLastTickBounds(),n=yo().domain([t[0],t[1]]),r=n.ticks(5),o=n.tickFormat(5);e.setTicks(r),e.setTickStrings(r.map(o))}}function Bp(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=n=>{t.renderable!==n&&(t.renderable=n,t.barActor.setProperty(n.getProperty()),t.barActor.setParentProp(n),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=n.generateTicks,t.axisTextStyle={...n.getAxisTextStyle()},t.tickTextStyle={...n.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(n,r,o)=>{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0);const a=t.renderable.getScalarsToColors();if(a&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(a),t.camera=r,t.renderWindow=o,t.forceUpdate||Math.max(a.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){const n=a.getMappingRange();if(t.lastTickBounds=[...n],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();const n=e.updateTextureAtlas();e.recomputeBarSegments(n)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";const n={},r=new Map;let o=0,a=1;Ep(t.tmContext,t.axisTextStyle);let i=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:i.actualBoundingBoxAscent+2,startingHeight:a,width:i.width+2,textStyle:t.axisTextStyle};r.set(t.renderable.getAxisLabel(),s),a+=s.height,o=s.width,n.titleWidth=s.width,n.titleHeight=s.height,n.tickWidth=0,n.tickHeight=0,Ep(t.tmContext,t.tickTextStyle);const l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight)/a,0,(a-e.startingHeight)/a]})),t.tmCanvas.width=o,t.tmCanvas.height=a,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,o,a),r.forEach(((e,n)=>{Ep(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=r,n},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];const n=2*e.tickHeight/t.lastSize[1],r=[1,1];if(t.vertical){const o=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-o,t.barSize[1]=t.boxSize[1]-n}else{const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-n-o,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+o,t.barPosition[1]=t.boxPosition[1],r[1]=n}else{const n=(2*e.tickWidth-8)/t.lastSize[0],o=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-o,t.barPosition[1]=t.boxPosition[1],r[0]=n}return r},e.recomputeBarSegments=n=>{const r=e.computeBarSize(n);t.barSegments=[];const o=[0,0],a=t.vertical?1:0,i=t.vertical?.01:.02;function s(e,n){t.barSegments.push({corners:[[...o],[o[0]+r[0],o[1]],[o[0]+r[0],o[1]+r[1]],[o[0],o[1]+r[1]]],scalars:n,title:e}),o[a]+=r[a]+i}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);const l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();o[a]+=i;const c=r[a];r[a]=l?1-2*i-r[a]-o[a]:1-i-o[a],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(r[a]=c,o[a]+=i,s("Above",[1.1,1.1,1.1,1.1]))};const n=new Float64Array(3);e.createPolyDataForOneLabel=(e,r,o,a,i,s)=>{const l=t._tmAtlas.get(e);if(!l)return;let c=s.ptIdx,u=s.cellIdx;n[0]=(.5*r[0]+.5)*t.lastSize[0],n[1]=(.5*r[1]+.5)*t.lastSize[1],n[2]=r[2],n[0]+=i[0],n[1]+=i[1];const d=[],p="vertical"===a?[1,0]:[0,1];"vertical"===a?(d[0]=l.width,d[1]=-l.height,"middle"===o[0]?n[1]-=l.width/2:"right"===o[0]&&(n[1]-=l.width),"middle"===o[1]?n[0]+=l.height/2:"top"===o[1]&&(n[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===o[0]?n[0]-=l.width/2:"right"===o[0]&&(n[0]-=l.width),"middle"===o[1]?n[1]-=l.height/2:"top"===o[1]&&(n[1]-=l.height)),s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[0],s.tcoords[2*c+1]=l.tcoords[1],c++,n[p[0]]+=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[2],s.tcoords[2*c+1]=l.tcoords[3],c++,n[p[1]]+=d[1],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[4],s.tcoords[2*c+1]=l.tcoords[5],c++,n[p[0]]-=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[6],s.tcoords[2*c+1]=l.tcoords[7],c++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-3,s.polys[4*u+3]=c-2,u++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-2,s.polys[4*u+3]=c-1,s.ptIdx+=4,s.cellIdx+=2};const r=new Float64Array(3);e.updatePolyDataForLabels=()=>{const n=e.getTickStrings().length+t.barSegments.length,o=4*n,a=2*n,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o),c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l},u=t.vertical?0:1,d=t.vertical?1:0;r[2]=-.99;const p=t.vertical?["right","middle"]:["middle","bottom"];let f=[0,1];const g=[0,0];t.vertical?(g[0]=-t.tickLabelPixelOffset,t.topTitle?(r[0]=t.boxPosition[0]+.5*t.boxSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)):(r[0]=t.barPosition[0]+t.barSize[0],r[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],c)),f=[-1,0]):(g[1]=t.tickLabelPixelOffset,r[0]=t.barPosition[0]+.5*t.barSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)),r[u]=t.barPosition[u]+(.5*f[u]+.5)*t.barSize[u],r[d]=t.barPosition[d]+.5*t.barSize[d];let m=null;for(let n=0;n{const e=t.renderable.getScalarsToColors();let n=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(n+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(n+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(n+=1);const o=4*(1+n),a=o;let i=1;e.getVectorMode()===Vp.COMPONENT&&(i=e.getVectorComponent()+1);const s=new Float64Array(3*o),l=new Uint16Array(5*a),c=new Float32Array(o*i);let u=0,d=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),jt.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings"]),jt.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),jt.getArray(e,t,["boxPosition","boxSize"]),jt.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=fc.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=Pu.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=Ps.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=Pu.newInstance(),t.tmMapper=fc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=Ru.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=Ps.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],Bp(e,t)}),"vtkScalarBarActorHelper");function kp(e,t){t.classHierarchy.push("vtkScalarBarActor"),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(Dp(0,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(Lp())}}function Fp(e){return{automated:!0,autoLayout:null,axisLabel:"Scalar Value",barPosition:[0,0],barSize:[0,0],boxPosition:[.88,-.92],boxSize:[.1,1.1],scalarToColors:null,axisTitlePixelOffset:36,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:14,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},generateTicks:null,drawNanAnnotation:!0,drawBelowRangeSwatch:!0,drawAboveRangeSwatch:!0,...e}}function _p(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fp(n)),t.autoLayout||(t.autoLayout=Dp(0,t)),t.generateTicks||(t.generateTicks=Lp()),Ps.extend(e,t,n),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),jt.setGet(e,t,["automated","autoLayout","axisTitlePixelOffset","axisLabel","scalarsToColors","tickLabelPixelOffset","generateTicks","drawNanAnnotation","drawBelowRangeSwatch","drawAboveRangeSwatch"]),jt.get(e,t,["axisTextStyle","tickTextStyle"]),jt.getArray(e,t,["barPosition","barSize","boxPosition","boxSize"]),jt.setArray(e,t,["barPosition","barSize","boxPosition","boxSize"],2),kp(e,t)}var Gp={newInstance:jt.newInstance(_p,"vtkScalarBarActor"),extend:_p,newScalarBarActorHelper:Np};function Up(e,t){t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Wp={};const zp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wp,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Gp.newScalarBarActorHelper(),Up(e,t)}),"vtkOpenGLScalarBarActor");rn("vtkScalarBarActor",zp);const{vtkErrorMacro:Hp}=Kt;function jp(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=n=>{if(n){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera())}},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOpaqueActorCount()}},e.opaquePass=(n,r)=>{if(n&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);const n=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",n);const r=t._openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(r),a=new Float64Array(16);if(h(a,o.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",a),"box"===t.lastFormat){const e=r.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){const e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;const n=Us.newInstance({numberOfComponents:3,values:e});n.setName("points");const r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;const o=Us.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(o,"polys",ps.SURFACE,{points:n,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = texture2D(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Hp("Error setting vertexMC in shader VAO."));const e=t.renderable.getTextures();e.length||Hp("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}const Kp={context:null};const $p=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kp,n),Zt.extend(e,t,n),t.openGLTexture=$d.newInstance(),t.tris=Md.newInstance(),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},At(e,t,["context"]),xt(e,t,["activeTextures"]),jp(e,t)}));rn("vtkSkybox",$p);const{FieldAssociations:qp}=gl;function Xp(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,a)=>{const i=await e.getSourceDataAsync(t,n,r,o,a);return i?i.generateSelection(n,r,o,a):[]}}const Yp={fieldAssociation:qp.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Zp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yp,n),jt.obj(e,t),jt.setGet(e,t,["fieldAssociation","captureZValues"]),Xp(e,t)}var Qp={newInstance:jt.newInstance(Zp,"vtkHardwareSelector"),extend:Zp};function Jp(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):et("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void et("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void et("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else et("Attaching depth buffer textures to fbo requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else et("Attaching depth buffer textures to framebuffers requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=$d.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Vd.LINEAR),r.setMagnificationFilter(Vd.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,ws.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}const ef={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function tf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ef,n),yt(e,t),t.colorBuffers&&et("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Pt(e,t,["colorBuffers"]),Jp(e,t)}var nf={newInstance:Et(tf,"vtkFramebuffer"),extend:tf};function rf(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const of={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,of,n),jt.obj(e,t),t.properties={},jt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),rf(e,t)}var sf={newInstance:jt.newInstance(af,"vtkSelectionNode"),extend:af,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:lf}=ec,{SelectionContent:cf,SelectionField:uf}=sf,{FieldAssociations:df}=gl,{vtkErrorMacro:pf}=jt;function ff(e){return`${e.propID} ${e.compositeID}`}function gf(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function mf(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),a=n[o],i=n[o+1];return 256*(256*n[o+2]+i)+a}function hf(e,t){let n=t;return n<<=24,n|=e,n}function vf(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=mf(n[0],n[1],e.pixBuffer[lf.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const a={valid:!0};a.propID=o-1,a.prop=e.props[a.propID];let i=mf(n[0],n[1],e.pixBuffer[lf.COMPOSITE_INDEX_PASS],e.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);a.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,a.displayPosition=t}if(e.pixBuffer[lf.ID_LOW24]&&0===gf(n[0],n[1],e.pixBuffer[lf.ID_LOW24],e.area))return a;const s=mf(n[0],n[1],e.pixBuffer[lf.ID_LOW24],e.area),l=mf(n[0],n[1],e.pixBuffer[lf.ID_HIGH24],e.area);return a.attributeID=hf(s,l),a}const a=[t[0],t[1]],i=[0,0];let s=vf(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=vf(e,i,0,r),s&&s.valid))return s;if(i[0]=a[0]+t,s=vf(e,i,0,r),s&&s.valid)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=vf(e,i,0,r),s&&s.valid))return s;if(i[1]=a[1]+t,s=vf(e,i,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function yf(e,t,n,r,o){const a=[];let i=0;return t.forEach(((t,s)=>{const l=sf.newInstance();switch(l.setContentType(cf.INDICES),e){case df.FIELD_ASSOCIATION_CELLS:l.setFieldType(uf.CELL);break;case df.FIELD_ASSOCIATION_POINTS:l.setFieldType(uf.POINT);break;default:pf("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),a[i]=l,i++})),a}function bf(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=vf(e,[n,t],0,u);if(r&&r.valid){const t=ff(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=nf.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===df.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,a,i)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,a,i);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return pf("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=lf.MIN_KNOWN_PASS;t.currentPass<=lf.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===lf.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===lf.ID_HIGH24){if(t.fieldAssociation===df.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===df.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===lf.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let a=mf(o,r,e,t.area);a>0&&(a--,a in t.hitProps||(t.hitProps[a]=!0,t.propPixels[a]=[]),t.propPixels[a].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===lf.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===lf.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>jt.enumToString(lf,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const a=r<0?0:r;if(0===a){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=mf(e[0],e[1],t.pixBuffer[lf.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const a={valid:!0};a.propID=r-1,a.prop=t.props[a.propID];let i=mf(e[0],e[1],t.pixBuffer[lf.COMPOSITE_INDEX_PASS],t.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);a.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,a.displayPosition=n}if(t.pixBuffer[lf.ID_LOW24]&&0===gf(e[0],e[1],t.pixBuffer[lf.ID_LOW24],t.area))return a;const s=mf(e[0],e[1],t.pixBuffer[lf.ID_LOW24],t.area),l=mf(e[0],e[1],t.pixBuffer[lf.ID_HIGH24],t.area);return a.attributeID=hf(s,l),a}const i=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(s[1]=n,i[0]>=t&&(s[0]=i[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=i[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(s[0]=n,i[1]>=t&&(s[1]=i[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=i[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,a)=>{const i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=Math.floor(a),u=new Map,d=[0,0];for(let n=s;n<=c;n++)for(let r=i;r<=l;r++){const o=[r,n],a=e.getPixelInformation(o,0,d);if(a&&a.valid){const e=ff(a);if(u.has(e)){const n=u.get(e);n.pixelCount++,t.captureZValues&&a.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const Tf={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function Cf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tf,n),Qp.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),jt.setGetArray(e,t,["area"],4),jt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),jt.setGetArray(e,t,["propColorValue"],3),jt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),jt.event(e,t,"event"),xf(e,t)}var Sf={newInstance:jt.newInstance(Cf,"vtkOpenGLHardwareSelector"),extend:Cf,...ec};const{vtkErrorMacro:Af}=Kt,{Representation:Pf}=xs,{ObjectType:If}=ad,{PassTypes:wf}=Sf,Of={type:"StartEvent"},Mf={type:"EndEvent"};function Rf(e,t){t.classHierarchy.push("vtkOpenGLGlyph3DMapper");const n={...e};e.renderPiece=(n,r)=>{if(e.invokeEvent(Of),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(Mf),!t.currentInput)return void Af("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context;t._openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);const a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.multiply4x4WithOffset=(e,t,n,r)=>{const o=t[0],a=t[1],i=t[2],s=t[3],l=t[4],c=t[5],u=t[6],d=t[7],p=t[8],f=t[9],g=t[10],m=t[11],h=t[12],v=t[13],y=t[14],b=t[15];let x=n[r],T=n[r+1],C=n[r+2],S=n[r+3];e[0]=x*o+T*l+C*p+S*h,e[1]=x*a+T*c+C*f+S*v,e[2]=x*i+T*u+C*g+S*y,e[3]=x*s+T*d+C*m+S*b,x=n[r+4],T=n[r+5],C=n[r+6],S=n[r+7],e[4]=x*o+T*l+C*p+S*h,e[5]=x*a+T*c+C*f+S*v,e[6]=x*i+T*u+C*g+S*y,e[7]=x*s+T*d+C*m+S*b,x=n[r+8],T=n[r+9],C=n[r+10],S=n[r+11],e[8]=x*o+T*l+C*p+S*h,e[9]=x*a+T*c+C*f+S*v,e[10]=x*i+T*u+C*g+S*y,e[11]=x*s+T*d+C*m+S*b,x=n[r+12],T=n[r+13],C=n[r+14],S=n[r+15],e[12]=x*o+T*l+C*p+S*h,e[13]=x*a+T*c+C*f+S*v,e[14]=x*i+T*u+C*g+S*y,e[15]=x*s+T*d+C*m+S*b},e.replaceShaderNormal=(e,r,o)=>{if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(n=xd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=xd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=n}n.replaceShaderNormal(e,r,o)},e.replaceShaderColor=(e,r,o)=>{if(t.hardwareSupport&&t.renderable.getColorArray()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];a&&(i=i.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let s=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];a&&(s=s.concat([" vec3 specularColor;"," float specularPower;"])),s=s.concat([" opacity = opacityUniform;"]),a&&(s=s.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(i=i.concat(["varying vec4 vertexColorVSOutput;"]),n=xd.substitute(n,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,n=xd.substitute(n,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,r=xd.substitute(r,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,r=xd.substitute(r,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,s=s.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),o=xd.substitute(o,"//VTK::Color::Impl",s).result,o=xd.substitute(o,"//VTK::Color::Dec",i).result,e.Vertex=n,e.Geometry=r,e.Fragment=o}n.replaceShaderColor(e,r,o)},e.replaceShaderPositionVC=(e,r,o)=>{if(t.hardwareSupport){let n=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(n=xd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result,n=xd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(n=xd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,n=xd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result),e.Vertex=n}n.replaceShaderPositionVC(e,r,o)},e.replaceShaderPicking=(e,r,o)=>{if(t.hardwareSupport){let t=e.Fragment,n=e.Vertex;n=xd.substitute(n,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,n=xd.substitute(n,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,e.Vertex=n,t=xd.substitute(t,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,t=xd.substitute(t,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,e.Fragment=t}else n.replaceShaderPicking(e,r,o)},e.updateGlyphShaderParameters=(n,r,o,a,i,s,l,c)=>{const u=o.getProgram();if(n){const e=t.normalMatrix,n=s,r=9*l,o=t.tmpMat3,a=e[0],i=e[1],c=e[2],d=e[3],p=e[4],f=e[5],g=e[6],m=e[7],h=e[8],v=n[r],y=n[r+1],b=n[r+2],x=n[r+3],T=n[r+4],C=n[r+5],S=n[r+6],A=n[r+7],P=n[r+8];o[0]=v*a+y*d+b*g,o[1]=v*i+y*p+b*m,o[2]=v*c+y*f+b*h,o[3]=x*a+T*d+C*g,o[4]=x*i+T*p+C*m,o[5]=x*c+T*f+C*h,o[6]=S*a+A*d+P*g,o[7]=S*i+A*p+P*m,o[8]=S*c+A*f+P*h,u.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcpcMatrix,i,16*l),u.setUniformMatrix("MCPCMatrix",t.tmpMat4),r&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,i,16*l),u.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a){const e=a.getData();t.tmpColor[0]=e[4*l]/255,t.tmpColor[1]=e[4*l+1]/255,t.tmpColor[2]=e[4*l+2]/255,u.setUniform3fArray("ambientColorUniform",t.tmpColor),u.setUniform3fArray("diffuseColorUniform",t.tmpColor)}c&&u.setUniform3fArray("mapperIndex",c.getPropColorValue())},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=t.context,i=r.getProperty().getEdgeVisibility()&&o===Pf.SURFACE,s=t.openGLCamera.getKeyMatrices(n),l=t.openGLActor.getKeyMatrices();ve(t.normalMatrix,s.normalMatrix,l.normalMatrix),b(t.mcpcMatrix,s.wcpc,l.mcwc),b(t.mcvcMatrix,s.wcvc,l.mcwc);const c=t.renderable.getMatrixArray(),u=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),p=c.length/16;let f=!1;t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().getCurrentPass()===wf.COMPOSITE_INDEX_PASS&&(f=!0);for(let s=t.primTypes.Start;s{if(e.getCABO().getElementCount()&&(t.glyphBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime()))return e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||Af("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||Af("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||Af("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||Af("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(e,r,o),void e.getAttributeUpdateTime().modified();n.setMapperShaderParameters(e,r,o)},e.getNeedToRebuildBufferObjects=(e,r)=>(t.renderable.buildArrays(),t.VBOBuildTime.getMTime()!!(n.getNeedToRebuildShaders(e,r,o)||e.getShaderSourceTime().getMTime(){if(t.hardwareSupport){const e=t.renderable.getMatrixArray(),n=t.renderable.getNormalArray(),r=t.renderable.getColorArray();if(t.matrixBuffer||(t.matrixBuffer=ad.newInstance(),t.matrixBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.normalBuffer=ad.newInstance(),t.normalBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorBuffer=ad.newInstance(),t.colorBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.pickBuffer=ad.newInstance(),t.pickBuffer.setOpenGLRenderWindow(t._openGLRenderWindow)),t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(e,If.ARRAY_BUFFER),t.normalBuffer.upload(n,If.ARRAY_BUFFER),r?t.colorBuffer.upload(r.getData(),If.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();const o=e.length/16,a=new Uint8Array(4*o);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vf,n),fp.extend(e,t,n),t.tmpMat3=pe(new Float64Array(9)),t.normalMatrix=pe(new Float64Array(9)),t.mcpcMatrix=g(new Float64Array(16)),t.mcvcMatrix=g(new Float64Array(16)),t.tmpColor=[],t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),Rf(e,t)}),"vtkOpenGLGlyph3DMapper");rn("vtkGlyph3DMapper",Ef);const{vtkErrorMacro:Df}=jt;class Lf{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const a=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Df("Invalid or missing input");const r=Pu.newInstance();r.shallowCopy(n);const o=new Lf,a=n.getLines().getData();let i=0;for(;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),jt.obj(e,t),jt.algo(e,t,1,1),Bf(e,t)}var Ff={newInstance:jt.newInstance(kf,"vtkClosedPolyLineToSurfaceFilter"),extend:kf};const{vtkErrorMacro:_f}=Kt;function Gf(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void _f("Invalid or missing input");if(!t.cutFunction)return void _f("Missing cut function");const o=Pu.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),a=r.getNumberOfPoints(),i=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const a=[];for(let e=0;e0;if(g[r]>0===i)continue;let s=e,l=r,c=g[l]-g[s];c<=0&&(s=r,l=e,c*=-1);let u=0;0!==c&&(u=(t.cutValue-g[s])/c);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const h=[p[0]+u*(f[0]-p[0]),p[1]+u*(f[1]-p[1]),p[2]+u*(f[2]-p[2])];a.push({pointEdge1:d,pointEdge2:m,intersectedPoint:h,newPointID:-1})}for(let e=0;e2&&(l.push(c),a.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(it(r.getDataType(),i),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Uf={cutFunction:null,cutScalars:null,cutValue:0};function Wf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uf,n),yt(e,t),Mt(e,t,1,1),At(e,t,["cutFunction","cutValue"]),Gf(e,t)}var zf={newInstance:Et(Wf,"vtkCutter"),extend:Wf};const Hf=e=>e,jf=1e-6;class Kf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=g(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?l:Hf}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);Pn(n,e[0],e[1],e[2]),Pn(r,t[0],t[1],t[2]),Vn(n,n),Vn(r,r);const a=En(n,r);return a>=1||(Dn(this.tmp,n,r),Sn(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(ua(To,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qf,n),jt.obj(e,t),jt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),jt.setGetArray(e,t,["center","rotations"],3),jt.setGetArray(e,t,["matrix"],16),t._polys=xc.newInstance({values:Uint16Array.from(Yf)}),t._lineCells=xc.newInstance({values:Uint16Array.from(Xf)}),jt.moveToProtected(e,t,["polys","lineCells"]),jt.algo(e,t,0,1),Zf(e,t)}var eg={newInstance:jt.newInstance(Jf,"vtkCubeSource"),extend:Jf};const{vtkErrorMacro:tg}=jt;function ng(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void tg("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):tg("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const rg={};function og(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rg,n),jt.obj(e,t),jt.algo(e,t,1,1),t._cubeSource=eg.newInstance(),jt.moveToProtected(e,t,["cubeSource","tmpOut"]),ng(e,t)}var ag={newInstance:jt.newInstance(og,"vtkImageDataOutlineFilter"),extend:og};let ig;function sg(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Ln(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let a=0;a{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?b(n,t.matrix,e):b(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),a=t.preMultiplyFlag?()=>b(o,t.matrix,r):()=>b(o,r,t.matrix);for(let t=0;tig({matrix:za.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const lg={preMultiplyFlag:!1,matrix:[...To]};function cg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lg,n),jt.obj(e,t),jt.setGet(e,t,["preMultiplyFlag"]),jt.setGetArray(e,t,["matrix"],16),sg(e,t)}ig=jt.newInstance(cg,"vtkTransform");var ug={newInstance:ig,extend:cg};const dg={NEAREST:0,LINEAR:1};var pg={InterpolationType:dg};const{vtkErrorMacro:fg}=Kt;function gg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function mg(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function hg(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):fg("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===dg.NEAREST?(t.openGLTexture.setMinificationFilter(Vd.NEAREST),t.openGLTexture.setMagnificationFilter(Vd.NEAREST),t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST),t.pwfTexture.setMinificationFilter(Vd.NEAREST),t.pwfTexture.setMagnificationFilter(Vd.NEAREST)):(t.openGLTexture.setMinificationFilter(Vd.LINEAR),t.openGLTexture.setMagnificationFilter(Vd.LINEAR),t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR),t.pwfTexture.setMinificationFilter(Vd.LINEAR),t.pwfTexture.setMagnificationFilter(Vd.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const a=o.getNumberOfComponents();let i=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===i&&t.openGLTextureString===i)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=$d.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=i,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),c=l.getIndependentComponents(),u=c?a:1,d=c?2*u:1,p=l.getRGBTransferFunction();i=gg(l,p,u);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===i&&t.colorTextureString===i)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=$d.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:fg("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ps.SURFACE,r)}t.VBOBuildString=h,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){a.isUniformUsed("texture1")&&a.setUniformi("texture1",t.openGLTexture.getTextureUnit()),a.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||fg("Error setting vertexWC in shader VAO.")),a.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||fg("Error setting normalWC in shader VAO.")),a.isUniformUsed("slabThickness")&&a.setUniformf("slabThickness",t.renderable.getSlabThickness()),a.isUniformUsed("spacing")&&a.setUniform3fv("spacing",t.currentInput.getSpacing()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabTrapezoid")&&a.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(a.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();d(t.tmpMat4,n.getIndexToWorld()),T(t.tmpMat4,t.tmpMat4,r),h(t.tmpMat4,t.tmpMat4),e&&b(t.tmpMat4,t.tmpMat4,e),a.setUniformMatrix("WCTCMatrix",t.tmpMat4)}a.isUniformUsed("vboScaling")&&a.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const a=t._openGLCamera.getKeyMatrices(n),i=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",mg([a.wcpc,i.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",mg([a.wcvc,i.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.openGLTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let c=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(c=!0),!(!c&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a&&t.lastSlabThickness===i&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,t.lastSlabThickness=i,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=xd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=xd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const a=e.Geometry;let i=e.Fragment;const s=t.renderable.getSlabThickness();o=xd.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=xd.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),c=r.getProperty().getIndependentComponents();let u=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(c){for(let e=1;e0&&(u=u.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),u=u.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),i=xd.substitute(i,"//VTK::TCoord::Dec",u).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),c){const e=["r","g","b","a"];for(let t=0;t{let a=n.Vertex;const i=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let c=["attribute vec4 vertexWC;"];c=c.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(c=c.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),a=xd.substitute(a,"//VTK::PositionVC::Dec",c).result;let u=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(u=u.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),a=xd.substitute(a,"//VTK::PositionVC::Impl",u).result,a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=xd.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=a,n.Geometry=i,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const i=t.renderable.getSlicePolyData(),s=t.renderable.getSlicePlane();if(i)e=e.concat(`PolyData${i.getMTime()}`);else if(s){e=e.concat(`Plane${s.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=ue(n?.getDirection());ge(t,t);const r=[...s.getNormal()];Bn(r,r,t),[o,a]=function(e){za.normalize(e);const t=[0,0,0];for(let r=0;r<3;++r){(n=t)[0]=0,n[1]=0,n[2]=0,t[r]=1;const o=za.dot(e,t);if(o<-.999||o>.999)return[!0,r]}var n;return[!1,2]}(r)}else{const o=ri.newInstance();o.setNormal(0,0,1);let a=[0,1,0,1,0,1];n&&(a=r),o.setOrigin(a[0],a[2],.5*(a[5]+a[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${s?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(i)t.resliceGeom||(t.resliceGeom=Pu.newInstance()),t.resliceGeom.getPoints().setData(i.getPoints().getData(),3),t.resliceGeom.getPolys().setData(i.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(i.getPointData().getNormals());else if(s)if(o){const e=new Float32Array(12),r=n.worldToIndex(s.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),l=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let c=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[c+a]=r[a],e[c+o[0]]=l[2*o[0]+n],e[c+o[1]]=l[2*o[1]+t],c+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const u=new Uint16Array(8);u[0]=3,u[1]=0,u[2]=1,u[3]=3,u[4]=3,u[5]=0,u[6]=3,u[7]=2;const d=s.getNormal();za.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=Pu.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(u,1);const f=Us.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(s),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=Pu.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=s.getNormal(),o=t.resliceGeom.getNumberOfPoints();za.normalize(r);const a=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const vg={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const yg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.tris=Md.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},yt(t.VBOBuildTime),t.tmpMat4=g(new Float64Array(16)),t.outlineFilter=ag.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=Pu.newInstance(),t.cutter=zf.newInstance(),t.lineToSurfaceFilter=Ff.newInstance(),t.transform=ug.newInstance(),xt(e,t,["openGLTexture"]),hg(e,t)}),"vtkOpenGLImageResliceMapper");rn("vtkImageResliceMapper",yg);var bg={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}};const{vtkErrorMacro:xg}=Kt,{SlicingMode:Tg}=bg;function Cg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Sg(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function Ag(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,a=xd.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,a=xd.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:i=xd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=a,n.Fragment=i,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(et("OpenGL has a limit of 6 clipping planes"),e=6),o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=xd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=xd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents();let i=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(i=!0),!(!i&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||xg("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||xg("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const a=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",a);const i=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(et("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const a=n.getProgram(),i=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();b(t.imagemat,i.mcwc,l);const c=t.openGLCamera.getKeyMatrices(r);if(b(t.imagemat,c.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,e)}if(a.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();a.setUniform3i("imageDimensions",o[0],o[1],1),a.setUniformMatrix("vWCtoIDX",n);const i=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,i.wcpc),t.openGLCamera.getKeyMatrices(r),a.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();a.setUniformf("vpWidth",l[0]),a.setUniformf("vpHeight",l[1]);const c=e.getRenderTargetOffset();a.setUniformf("vpOffsetX",c[0]/l[0]),a.setUniformf("vpOffsetY",c[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):xg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;const i=a.getDataType(),s=a.getNumberOfComponents(),l=r.getProperty(),c=l.getInterpolationType(),u=l.getIndependentComponents(),d=u?s:1,p=u?2*d:1,f=l.getRGBTransferFunction(),g=Cg(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===g&&t.colorTextureString===g)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=$d.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),c===dg.NEAREST?(t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST)):(t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Tg.X,Tg.Y,Tg.Z].includes(t.renderable.getSlicingMode())?x:T,p=o.getSpatialExtent(),f=a.getData();let g=null;if(b===Tg.I){g=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=$d.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Pg={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Ig=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pg,n),Zt.extend(e,t,n),Yd(e,t,n),Zd(e,t,n),t.tris=Md.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),At(e,t,[]),t.VBOBuildTime={},yt(t.VBOBuildTime),Ag(e,t)}),"vtkOpenGLImageMapper");rn("vtkAbstractImageMapper",Ig);const{vtkErrorMacro:wg}=jt;function Og(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Mg(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===dg.NEAREST?(t.volumeTexture.setMinificationFilter(Vd.NEAREST),t.volumeTexture.setMagnificationFilter(Vd.NEAREST),t.colorTexture.setMinificationFilter(Vd.NEAREST),t.colorTexture.setMagnificationFilter(Vd.NEAREST),t.pwfTexture.setMinificationFilter(Vd.NEAREST),t.pwfTexture.setMagnificationFilter(Vd.NEAREST)):(t.volumeTexture.setMinificationFilter(Vd.LINEAR),t.volumeTexture.setMagnificationFilter(Vd.LINEAR),t.colorTexture.setMinificationFilter(Vd.LINEAR),t.colorTexture.setMagnificationFilter(Vd.LINEAR),t.pwfTexture.setMinificationFilter(Vd.LINEAR),t.pwfTexture.setMagnificationFilter(Vd.LINEAR));const a=r.getMTime();if(t.volumeTextureTime!==a){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=a}const i=r.getPointData()&&r.getPointData().getScalars();if(!i)return;const s=i.getNumberOfComponents(),l=n.getProperty(),c=l.getIndependentComponents(),u=c?s:1,d=c?2*u:1,p=Og(l,l.getRGBTransferFunction,u);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==i||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==a)&&(t.lastUseCenterPoint=i,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=xd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),a=xd.substitute(a,"//VTK::Color::Dec",s).result;const c=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?c.push("centerlineDirVSOutput = centerlineDirection;"):c.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),a=xd.substitute(a,"//VTK::Color::Impl",c).result;const u=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=xd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=xd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=xd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=xd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getShaderTemplate=(e,t,n)=>{e.Vertex=qd,e.Fragment=Xd,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||wg("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&wg(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const a=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",a),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const i=t.currentImageDataInput,s=i.getWorldToIndex(),l=w(new Float32Array(16),Rn([],i.getDimensions())),c=oe(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",c),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentImageDataInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,a=t.openGLCamera.getKeyMatrices(n).wcpc;if(b(t.imagemat,a,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.volumeTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const Rg={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const Vg=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Zt.extend(e,t,n),Yd(e,t,n),jt.algo(e,t,2,0),t.tris=Md.newInstance(),t.volumeTexture=$d.newInstance(),t.colorTexture=$d.newInstance(),t.pwfTexture=$d.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),Mg(e,t)}),"vtkOpenGLImageCPRMapper");function Eg(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkImageCPRMapper",Vg);const Dg={context:null,keyMatrixTime:null,keyMatrices:null};const Lg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},At(e,t,["context"]),Eg(e,t)}),"vtkOpenGLImageSlice");function Bg(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.MCWCMatrix,t.renderable.getMatrix()),m(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?pe(t.normalMatrix):(se(t.normalMatrix,t.MCWCMatrix),ge(t.normalMatrix,t.normalMatrix),fe(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}rn("vtkImageSlice",Lg);const Ng={};const kg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ng,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),At(e,t,["context"]),Bg(e,t)}),"vtkOpenGLVolume");rn("vtkVolume",kg);const Fg=0,_g=1,Gg=1,Ug=0,Wg=1,zg=2,Hg=3,jg=4,{vtkWarningMacro:Kg,vtkErrorMacro:$g}=Kt;function qg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Xg(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Fragment;o.getProperty().getInterpolationType()===_g&&(a=xd.substitute(a,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(a=xd.substitute(a,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const i=t.scalarTexture.getComponents();a=xd.substitute(a,"//VTK::NumComponents",`#define vtkNumComponents ${i}`).result;const s=o.getProperty().getIndependentComponents();if(s){a=xd.substitute(a,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(a=xd.substitute(a,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),c=t.currentInput.getSpacing(),u=new Float64Array(3);Pn(u,(l[1]-l[0])*c[0],(l[3]-l[2])*c[1],(l[5]-l[4])*c[2]);const d=Sn(u)/e.getCurrentSampleDistance(r);a=xd.substitute(a,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,a=xd.substitute(a,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(a=xd.substitute(a,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(a=xd.substitute(a,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(a=xd.substitute(a,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,a=0;n.getLights().forEach((e=>{e.getSwitch()&&(a+=1)})),o=xd.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${a}];`,`uniform vec3 lightDirectionVC[${a}]; // normalized`,`uniform vec3 lightHalfAngleVC[${a}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=xd.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${a}];`,`uniform vec3 lightAttenuation[${a}];`,`uniform float lightConeAngle[${a}];`,`uniform float lightExponent[${a}];`,`uniform int lightPositional[${a}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=xd.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=xd.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=xd.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=xd.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let a=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===Ug&&(a=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===a&&(a=1)),1===a&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(a=2),a<3&&e.getPositional()&&(a=3)})));let i=!1;t.lastLightComplexity!==a&&(t.lastLightComplexity=a,i=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=!1;const u=[];if(l){for(let e=0;e0&&(c=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);Pn(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const g=Sn(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:c,iComps:l,maxSamples:g,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:u};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(a.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||$g("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),a.setUniformi("texture1",t.scalarTexture.getTextureUnit()),a.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const i=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],c=[];for(let e=0;e<4;e++)l[e]=s[0]*i.dataComputedScale[e]+i.dataComputedOffset[e],c[e]=s[1]*i.dataComputedScale[e]+i.dataComputedOffset[e],l[e]=(l[e]-i.offset[e])/i.scale[e],c[e]=(c[e]-i.offset[e])/i.scale[e];if(a.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),a.setUniform4f("ipScalarRangeMax",c[0],c[1],c[2],c[3]),null!==t.zBufferTexture){a.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();a.setUniformf("vpZWidth",e[0]),a.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const a=t.openGLCamera.getKeyMatrices(r),i=t.openGLVolume.getKeyMatrices();b(t.modelToView,a.wcvc,i.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),c=l.getClippingRange();s.setUniformf("camThick",c[1]-c[0]),s.setUniformf("camNear",c[0]),s.setUniformf("camFar",c[1]);const u=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let g=1,m=-1,v=1,y=-1;for(let e=0;e<8;++e)Pn(p,u[e%2],u[2+Math.floor(e/2)%2],u[4+Math.floor(e/4)]),Ln(p,p,t.modelToView),l.getParallelProjection()||(Vn(f,p),On(p,f,-c[0]/p[2])),Ln(p,p,a.vcpc),g=Math.min(p[0],g),m=Math.max(p[0],m),v=Math.min(p[1],v),y=Math.max(p[1],y);s.setUniformf("dcxmin",g),s.setUniformf("dcxmax",m),s.setUniformf("dcymin",v),s.setUniformf("dcymax",y),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),T=t.currentInput.getSpacing(),C=new Float64Array(3);Pn(C,(x[1]-x[0])*T[0],(x[3]-x[2])*T[1],(x[5]-x[4])*T[2]),s.setUniform3f("vSpacing",T[0],T[1],T[2]),Pn(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Ln(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();b(t.idxToView,t.modelToView,S),ve(t.idxNormalMatrix,a.normalMatrix,i.normalMatrix),ve(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const A=Sn(C)/e.getCurrentSampleDistance(r);A>t.renderable.getMaximumSamplesPerRay()&&Kg(`The number of steps required ${Math.ceil(A)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const P=new Float64Array(3);if(Pn(P,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(P,P,C),s.setUniform3f("vVCToIJK",P[0],P[1],P[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const I=new Float64Array(3),w=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:Pn(I,-1,0,0),Pn(w,x[0],x[2],x[4]);break;case 2:Pn(I,0,1,0),Pn(w,x[1],x[3],x[5]);break;case 3:Pn(I,0,-1,0),Pn(w,x[0],x[2],x[4]);break;case 4:Pn(I,0,0,1),Pn(w,x[1],x[3],x[5]);break;case 5:Pn(I,0,0,-1),Pn(w,x[0],x[2],x[4]);break;default:Pn(I,1,0,0),Pn(w,x[1],x[3],x[5])}Bn(I,I,t.idxNormalMatrix),Ln(w,w,t.idxToView);const n=-1*En(w,I);s.setUniform3f(`vPlaneNormal${e}`,I[0],I[1],I[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[a,i]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const c=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,c.wcpc),o.setClippingRange(a,i),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const u=e.getRenderTargetSize();s.setUniformf("vpWidth",u[0]),s.setUniformf("vpHeight",u[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/u[0]),s.setUniformf("vpOffsetY",d[1]/u[1])}if(h(t.projectionToView,a.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let O=0;const M=[],R=[],V=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();M[0+3*O]=t[0]*n,M[1+3*O]=t[1]*n,M[2+3*O]=t[2]*n;const r=e.getDirection();Pn(I,r[0],r[1],r[2]),Bn(I,I,a.normalMatrix),Vn(I,I),R[0+3*O]=I[0],R[1+3*O]=I[1],R[2+3*O]=I[2],V[0+3*O]=-.5*I[0],V[1+3*O]=-.5*I[1],V[2+3*O]=-.5*(I[2]-1),O++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",O),s.setUniform3fv("lightColor",M),s.setUniform3fv("lightDirectionVC",R),s.setUniform3fv("lightHalfAngleVC",V),3===t.lastLightComplexity){O=0;const e=[],n=[],o=[],a=[],i=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*O]=s[0],n[1+3*O]=s[1],n[2+3*O]=s[2],a[O]=r.getExponent(),o[O]=r.getConeAngle(),i[O]=r.getPositional();const l=r.getTransformedPosition();Ln(l,l,t.modelToView),e[0+3*O]=l[0],e[1+3*O]=l[1],e[2+3*O]=l[2],O+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",a),s.setUniformiv("lightPositional",i)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const a=t.scalarTexture.getVolumeInfo(),i=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",i.getAmbient()),o.setUniformf("vDiffuse",i.getDiffuse()),o.setUniformf("vSpecular",i.getSpecular()),o.setUniformf("vSpecularPower",i.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],a=[],i=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Fg?(t.scalarTexture.setMinificationFilter(Vd.NEAREST),t.scalarTexture.setMagnificationFilter(Vd.NEAREST)):(t.scalarTexture.setMinificationFilter(Vd.LINEAR),t.scalarTexture.setMagnificationFilter(Vd.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ad.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||$g("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):$g("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():Ra(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;t._scalars!==a&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=a);const i=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Vd.LINEAR),t.jitterTexture.setMagnificationFilter(Vd.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,ws.UNSIGNED_CHAR,e)}const s=a.getNumberOfComponents(),l=i.getIndependentComponents()?s:1,c=i.getScalarOpacity(),u=t._openGLRenderWindow.getGraphicsResourceForObject(c);let d=qg(i,c,l);if(u.vtkObj&&u.hash===d&&t.opacityTextureString===d)t.opacityTexture=u.vtkObj,t.opacityTextureString=u.hash;else{const r=1024,o=2*r*l,a=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Us.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Us.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ps.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yg,n),Zt.extend(e,t,n),t.VBOBuildTime={},yt(t.VBOBuildTime,{mtime:0}),t.tris=Md.newInstance(),t.scalarTexture=$d.newInstance(),t.opacityTexture=$d.newInstance(),t.colorTexture=$d.newInstance(),t.jitterTexture=$d.newInstance(),t.jitterTexture.setWrapS(Rd.REPEAT),t.jitterTexture.setWrapT(Rd.REPEAT),t.labelOutlineThicknessTexture=$d.newInstance(),t.framebuffer=nf.newInstance(),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),At(e,t,["context"]),Xg(e,t)}),"vtkOpenGLVolumeMapper");rn("vtkVolumeMapper",Zg);const{vtkDebugMacro:Qg}=Kt;function Jg(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),a=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,i=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),a=t._openGLRenderWindow.getContext();e.bind();const i=r.getFramebuffer();i?i.saveCurrentBindingsAndBuffers():Qg("No framebuffer to save/restore");const l=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.getHandle(),0),a.checkFramebufferStatus(a.FRAMEBUFFER)===a.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),a.viewport(0,0,n,o),a.readPixels(0,0,n,o,a.RGBA,a.UNSIGNED_BYTE,s)),i&&i.restorePreviousBindingsAndBuffers(),a.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const em={};const tm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,em,n),Zt.extend(e,t,n),Jg(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");rn("vtkPixelSpaceCallbackMapper",tm);var nm="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtktextureObjectVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\nattribute vec2 tcoordDC;\nvarying vec2 tcoordVC;\n\nvoid main()\n{\n tcoordVC = tcoordDC;\n gl_Position = vertexDC;\n}\n";const{Representation:rm}=xs;function om(e,t,n,r){let[o,a]=t;const i=e.getContext(),s=$d.newInstance({autoParameters:!1,wrapS:r,wrapT:r,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:i.FLOAT,baseLevel:0,maxLevel:0});return s.setOpenGLRenderWindow(e),s.setInternalFormat(i.RGBA32F),s.create2DFromRaw(o,a,4,"Float32Array",null),s.activate(),s.sendParameters(),s.deactivate(),s}function am(e,t){return om(e,t,$d.Filter.NEAREST,$d.Wrap.CLAMP_TO_EDGE)}function im(e,t){t.classHierarchy.push("vtkLICPingPongBufferManager"),t._openGLRenderWindow?(t.quad=function(e){const t=Md.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Us.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Us.newInstance({numberOfComponents:1,values:o}),s=Us.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",rm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow),t.context=t._openGLRenderWindow.getContext(),t.licTexture0=am(t._openGLRenderWindow,t.size),t.seedTexture0=am(t._openGLRenderWindow,t.size),t.licTexture1=am(t._openGLRenderWindow,t.size),t.seedTexture1=am(t._openGLRenderWindow,t.size),t.eeTexture=t.doEEPass?om(t._openGLRenderWindow,t.size,$d.Filter.NEAREST,$d.Wrap.CLAMP_TO_EDGE):null,t.imageVectorTexture=t.doVTPass?function(e,t){return om(e,t,$d.Filter.LINEAR,$d.Wrap.CLAMP_TO_EDGE)}(t._openGLRenderWindow,t.size):null,t.pingTextures[0]=t.licTexture0,t.pingTextures[1]=t.seedTexture0,t.pongTextures[0]=t.licTexture1,t.pongTextures[1]=t.seedTexture1,t.textures[0]=t.pingTextures,t.textures[1]=t.pongTextures,e.swap=()=>{t.readIndex=1-t.readIndex},e.renderQuad=(e,n)=>{const r=t.quad,o=t.context;let a=t.quadVAO;a||(a=Ad.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.quadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.getLastLICBuffer=()=>0===t.readIndex?t.licTexture0:t.licTexture1,e.getLastSeedBuffer=()=>0===t.readIndex?t.seedTexture0:t.seedTexture1,e.getLICBuffer=()=>1-t.readIndex==0?t.licTexture0:t.licTexture1,e.getSeedBuffer=()=>1-t.readIndex==0?t.seedTexture0:t.seedTexture1,e.getLICTextureUnit=()=>{const e=t.textures[t.readIndex][0];return e.activate(),e.getTextureUnit()},e.getSeedTextureUnit=()=>{const e=t.textures[t.readIndex][1];return e.activate(),e.getTextureUnit()},e.getNoiseTextureUnit=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 0===e?(t.noiseTexture.activate(),t.noiseTexture.getTextureUnit()):(t.eeTexture.activate(),t.eeTexture.getTextureUnit())},e.getVectorTextureUnit=()=>(t.vectorTexture.activate(),t.vectorTexture.getTextureUnit()),e.getImageVectorTextureUnit=()=>t.imageVectorTexture?(t.imageVectorTexture.activate(),t.imageVectorTexture.getTextureUnit()):e.getVectorTextureUnit(),e.getMaskVectorTextureUnit=()=>t.maskVectorTexture?(t.maskVectorTexture.activate(),t.maskVectorTexture.getTextureUnit()):e.getImageVectorTextureUnit(),e.clearBuffers=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),n.setColorBuffer(t.licTexture0,0),n.setColorBuffer(t.seedTexture0,1),n.setColorBuffer(t.licTexture1,2),n.setColorBuffer(t.seedTexture1,3);const o=[r.COLOR_ATTACHMENT0,r.COLOR_ATTACHMENT1,r.COLOR_ATTACHMENT2,r.COLOR_ATTACHMENT3];e&&(n.removeColorBuffer(4),n.setColorBuffer(t.eeTexture,4),o.push(r.COLOR_ATTACHMENT4)),r.drawBuffers(o),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),e&&n.removeColorBuffer(4),r.drawBuffers([r.NONE])},e.clearBuffer=e=>{const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.setColorBuffer(e,0),r.drawBuffers([r.COLOR_ATTACHMENT0]),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(e,0),r.drawBuffers([r.NONE])},e.activateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.activate():t.vectorTexture.activate(),t.maskVectorTexture&&t.maskVectorTexture.activate()},e.deactivateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.deactivate():t.vectorTexture.deactivate(),t.maskVectorTexture&&t.maskVectorTexture.deactivate()},e.activateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.activate();break;case 1:t.eeTexture.activate();break;default:console.error("Wrong LIC pass number")}},e.deactivateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.deactivate();break;case 1:t.eeTexture.deactivate();break;default:console.error("Wrong LIC pass number")}},e.attachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.textures[1-t.readIndex],r=t.framebuffer,o=t.context;e[0].activate(),e[1].activate(),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(n[0],0),r.setColorBuffer(n[1],1),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1])},e.detachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.context,r=t.framebuffer;e[0].deactivate(),e[1].deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE])},e.attachImageVectorBuffer=()=>{const e=t.framebuffer,n=t.context;t.vectorTexture.activate(),e.removeColorBuffer(0),e.setColorBuffer(t.imageVectorTexture,0),n.drawBuffers([n.COLOR_ATTACHMENT0])},e.detachImageVectorBuffer=()=>{const e=t.context,n=t.framebuffer;t.vectorTexture.deactivate(),n.removeColorBuffer(0),e.drawBuffers([e.NONE])},e.attachEEBuffer=()=>{t.textures[t.readIndex][0].activate(),t.framebuffer.removeColorBuffer(0),t.framebuffer.setColorBuffer(t.eeTexture,0);const e=t.context;e.drawBuffers([e.COLOR_ATTACHMENT0])},e.detachEEBuffer=()=>{const e=t.context;t.framebuffer.removeColorBuffer(0),e.drawBuffers([e.NONE]),t.textures[t.readIndex][0].deactivate()},e.detachBuffers=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),e.drawBuffers([e.NONE]);const r=t.textures[t.readIndex],o=t.textures[1-t.readIndex];r[0]&&r[0].deactivate(),r[1]&&r[1].deactivate(),o[0]&&o[0].deactivate(),o[1]&&o[1].deactivate(),t.eeTexture&&t.eeTexture.deactivate(),t.noiseTexture&&t.noiseTexture.deactivate()},e.getWriteIndex=()=>1-t.readIndex,e.detachBuffers()):console.error("Pass renderwindow to ping pong manager")}const sm={vectorTexture:null,maskVectorTexture:null,noiseTexture:null,doEEPass:!1,doVTPass:!1,readIndex:0,quad:null,lastProgramHash:null,framebuffer:null,size:null,pingTextures:[],pongTextures:[],textures:[]};function lm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sm,n),jt.obj(e,t),jt.get(e,t,["readIndex"]),jt.setGet(e,t,["doEEPass","doVTPass","_openGLRenderWindow","vectorTexture","maskVectorTexture","noiseTexture","framebuffer","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),im(e,t)}var cm={newInstance:jt.newInstance(lm,"vtkLICPingPongBufferManager"),extend:lm};const um=0,dm=1,pm=2,fm=3,gm=1;function mm(e,t){function n(e,t){e.setUniformi("texLIC",t.getLICTextureUnit()),e.setUniformi("texSeedPts",t.getSeedTextureUnit())}function r(e,t,n){e.attachLICBuffers(),e.renderQuad(t,n),e.detachLICBuffers(),e.swap()}t.classHierarchy.push("vtkLineIntegralConvolution2D"),e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(nm,e,""),e.dumpTextureValues=function(e,n){let[r,o]=n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4;const l=nf.newInstance(),c=a;let u=null;return l.setOpenGLRenderWindow(i),l.saveCurrentBindingsAndBuffers(),l.create(r,o),l.populateFramebuffer(),l.setColorBuffer(e),u=new Float32Array(r*o*s),c.readPixels(0,0,r,o,4===s?c.RGBA:c.RGB,c.FLOAT,u),l.restorePreviousBindingsAndBuffers(),u},e.getTextureMinMax=function(n,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow;const i=e.dumpTextureValues(n,r,o,a,4);let s=Number.MAX_VALUE,l=Number.MIN_VALUE;for(let e=0;el&&(l=t)}return{min:s,max:l}},e.getComponentSelectionProgram=e=>{const t="xyzw";return`.${t[e[0]]}${t[e[1]]}`},e.buildShaders=()=>{t.LIC0ShaderProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LIC0.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n/**\nThis shader initializes the convolution for the LIC computation.\n*/\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texMaskVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\n\nuniform int uStepNo; // in step 0 initialize lic and seeds, else just seeds\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uMaskThreshold; // if |V| < uMaskThreshold render transparent\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the *whole* domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value. this\n// depends on the pass number.\nvec2 getNoiseTC(vec2 vectc)\n{\n // in pass 1 : convert from vector tc to noise tc\n // in pass 2 : use vector tc\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(vectc);\n }\n else\n {\n return vectc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the\n// need to convert to noise texture coordinates.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\nvoid main(void)\n{\n vec2 vectc = tcoordVC.st;\n\n // lic => (convolution, mask, 0, step count)\n if (uStepNo == 0)\n {\n float maskCriteria = length(texture2D(texMaskVectors, vectc).xyz);\n float maskFlag;\n if (maskCriteria <= uMaskThreshold)\n {\n maskFlag = 1.0;\n }\n else\n {\n maskFlag = 0.0;\n }\n float noise = getNoise(vectc);\n LICOutput = vec4(noise, maskFlag, 0.0, 1.0);\n }\n else\n {\n LICOutput = texture2D(texLIC, vectc);\n }\n\n // initial seed\n SeedOutput = vec4(vectc, 0.0, 1.0);\n}\n");const n=xd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_VT.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// move vector field to normalized image space\n// pre-processing for vtkLineIntegralConvolution2D\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Fragment shader used by the gaussian blur filter render pass.\n\nuniform sampler2D texVectors; // input texture\nuniform vec2 uTexSize; // size of texture\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n //VTK::LICComponentSelection::Impl\n V = V/uTexSize;\n gl_FragData[0] = vec4(V, 0.0, 1.0);\n}\n","//VTK::LICComponentSelection::Impl",`vec2 V = texture2D(texVectors, tcoordVC.st)${e.getComponentSelectionProgram(t.componentIds)};`).result;t.VTProgram=e.buildAShader(n);const r=xd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs1.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\nuniform sampler2D texSeedPts;\n\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uStepSize; // step size in parametric space\n\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n//VTK::LICVectorLookup::Impl\n\n// We need to do this manually since CLAMP_TO_BORDER and and borderColor\n// are very poorly supported in webgl\nvec2 clampToBorder(vec2 uv){\n if(uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)\n {\n return vec2(0.0, 0.0);\n }\n return getVector(uv);\n}\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the whole domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value.\n// in pass 1 repeatedly tile the noise texture across\n// the computational domain.\nvec2 getNoiseTC(vec2 tc)\n{\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(tc);\n }\n else\n {\n return tc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the need\n// to convert to either noise or lic texture coordinates in\n// pass 1 and 2 respectively.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\n// fourth-order Runge-Kutta streamline integration\n// no bounds checks are made, therefore it's essential\n// to have the entire texture initialized to 0\n// and set clamp to border and have border color 0\n// an integer is set if the step was taken, keeping\n// an accurate step count is necessary to prevent\n// boundary artifacts. Don't count the step if\n// all vector lookups are identically 0. This is\n// a proxy for \"stepped outside valid domain\"\nvec2 rk4(vec2 pt0, float dt, out bool count)\n{\n count=true;\n float dtHalf = dt * 0.5;\n vec2 pt1;\n\n vec2 v0 = clampToBorder(pt0);\n pt1 = pt0 + v0 * dtHalf;\n\n vec2 v1 = clampToBorder(pt1);\n pt1 = pt0 + v1 * dtHalf;\n\n vec2 v2 = clampToBorder(pt1);\n pt1 = pt0 + v2 * dt;\n\n vec2 v3 = clampToBorder(pt1);\n vec2 vSum = v0 + v1 + v1 + v2 + v2 + v3;\n\n if (vSum == vec2(0.0, 0.0))\n {\n count = false;\n }\n\n pt1 = pt0 + (vSum) * (dt * (1.0/6.0));\n\n return pt1;\n}\n\nvoid main(void)\n{\n vec2 lictc = tcoordVC.st;\n vec4 lic = texture2D(texLIC, lictc);\n vec2 pt0 = texture2D(texSeedPts, lictc).st;\n\n bool count;\n vec2 pt1 = rk4(pt0, uStepSize, count);\n\n if (count)\n {\n // accumulate lic step\n // (lic, mask, 0, step count)\n float noise = getNoise(pt1);\n LICOutput = vec4(lic.r + noise, lic.g, 0.0, lic.a + 1.0);\n SeedOutput = vec4(pt1, 0.0, 1.0);\n }\n else\n {\n // keep existing values\n LICOutput = lic;\n SeedOutput = vec4(pt0, 0.0, 1.0);\n }\n}\n","//VTK::LICVectorLookup::Impl",function(){const e="\n vec2 getVector( vec2 vectc )\n\n {\n\n vec2 V = texture2D( texVectors, vectc ).xy;\n\n // normalize if |V| not 0\n\n float lenV = length( V );\n\n if ( lenV > 1.0e-8 )\n\n {\n\n return V/lenV;\n\n }\n\n else\n\n {\n\n return vec2( 0.0, 0.0 );\n\n }\n\n }\n\n ",t="\n vec2 getVector( vec2 vectc )\n\n {\n\n return texture2D( texVectors, vectc ).xy;\n\n }\n\n ";return arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?t:e}(t.normalizeVectors),!0).result;t.LICIShaderProgram=e.buildAShader(r),t.LICNShaderProgram=e.buildAShader(" //VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LICN.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n/**\nThis shader finalizes the convolution for the LIC computation\napplying the normalization. eg. if box kernel is used the this\nis the number of steps taken.\n*/\n\nuniform sampler2D texLIC;\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n vec4 conv = texture2D(texLIC, tcoordVC.st);\n conv.r = conv.r/conv.a;\n // lic => (convolution, mask, 0, 1)\n LICOutput = vec4(conv.rg , 0.0, 1.0);\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.CEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// gray scale contrast enhance stage implemented via histogram stretching\n// if the min and max are tweaked it can generate out-of-range values\n// these will be clamped in 0 to 1\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uMin; // min gray scale color value\nuniform float uMaxMinDiff; // max-min\n\nin vec2 tcoordVC;\n\nvoid main( void )\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g!=0.0)\n {\n LICOutput = lic;\n }\n else\n {\n float CElic = clamp((lic.r - uMin)/uMaxMinDiff, 0.0, 1.0);\n LICOutput = vec4(CElic, lic.gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.EEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// high-pass filter stage employed by vtkLineIntegralConvolution2D\n// between LIC pass 1 and LIC pass 2. filtered LIC pass 1, becomes\n// noise for pass2.\n\n// the output of this shader\nlayout(location = 0) out vec4 EEOutput;\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uDx; // fragment size\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n// kernel for simple laplace edge enhancement.\n// p=Laplace(p)+p\nfloat K[9] = float[9](\n -1.0, -1.0, -1.0,\n -1.0, 9.0, -1.0,\n -1.0, -1.0, -1.0\n );\n\n// determine if the fragment was masked\nbool Masked(float val) { return val != 0.0; }\n\nvoid main(void)\n{\n // tex coord neighbor offsets\n vec2 fragDx[9] = vec2[9](\n vec2(-uDx, uDy), vec2(0.0, uDy), vec2(uDx, uDy),\n vec2(-uDx, 0.0), vec2(0.0, 0.0), vec2(uDx, 0.0),\n vec2(-uDx,-uDy), vec2(0.0,-uDy), vec2(uDx,-uDy)\n );\n\n vec2 lictc = tcoordVC.st;\n\n // compute the convolution but don't use convovled values if\n // any masked fragments on the stencil. Fragments outside\n // the valid domain are masked during initialization, and\n // texture wrap parameters are clamp to border with border\n // color that contains masked flag\n float conv = 0.0;\n bool dontUse = false;\n for (int i=0; i<9; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n vec4 lic = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic.g);\n conv = conv + K[i] * lic.r;\n }\n\n if (dontUse)\n {\n EEOutput = vec4(texture2D(texLIC, lictc).rg, 0.0, 1.0);\n }\n else\n {\n conv = clamp(conv, 0.0, 1.0);\n EEOutput = vec4(conv,texture2D(texLIC, lictc).g, 0.0, 1.0);\n }\n\n}\n"),t.AAHProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAH.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// horizontal pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDx; // fragment size\n\nin vec2 tcoordVC;\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDx[3] = vec2[3](vec2(-uDx,0.0), vec2(0.0,0.0), vec2(uDx,0.0));\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.AAVProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAV.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// vertical pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDy[3] = vec2[3](vec2(0.0,-uDy), vec2(0.0,0.0), vec2(0.0,uDy));\n\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDy[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n")},e.executeLIC=(o,a,i,s,l,c)=>{if(t._openGLRenderWindow=l,t.context=l.getContext(),Object.assign(t,c),o[0]<=0||o[1]<=0)return null;const u=[1/o[0],1/o[1]];let d=t.stepSize*Math.sqrt(u[0]*u[0]+u[1]*u[1]);d<=0&&(d=1e-10);const p=t.context;let f=t.framebuffer;f&&o[0]===f.getSize()[0]&&o[1]===f.getSize()[1]||(f=nf.newInstance(),f.setOpenGLRenderWindow(t._openGLRenderWindow),f.saveCurrentBindingsAndBuffers(),f.create(...o),f.populateFramebuffer(),f.restorePreviousBindingsAndBuffers(),t.framebuffer=f),f.saveCurrentBindingsAndBuffers(),f.bind(),p.viewport(0,0,...o),p.scissor(0,0,...o),t.shadersNeedBuild&&(e.buildShaders(),t.shadersNeedBuild=!1),t.bufs?(t.bufs.setVectorTexture(a),t.bufs.setMaskVectorTexture(i),t.bufs.setNoiseTexture(s)):t.bufs=cm.newInstance({openGLRenderWindow:l,doEEPass:t.enhancedLIC,doVTPass:t.transformVectors,vectorTexture:a,maskVectorTexture:i,noiseTexture:s,framebuffer:f,size:o});const g=[(s.getWidth()+1)/o[0],(s.getHeight()+1)/o[1]],m=1/o[0],h=1/o[1],v=t._openGLRenderWindow.getShaderCache();if(t.transformVectors){const e=t.VTProgram;v.readyShaderProgram(e),t.bufs.attachImageVectorBuffer(),e.setUniform2f("uTexSize",...o),e.setUniformi("texVectors",t.bufs.getVectorTextureUnit()),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT),t.bufs.renderQuad(o,e),t.bufs.detachImageVectorBuffer()}t.bufs.clearBuffers(t.enhancedLIC),t.bufs.activateVectorTextures(),t.bufs.activateNoiseTexture(0);const{LIC0ShaderProgram:y}=t;v.readyShaderProgram(y),y.setUniformi("uStepNo",0),y.setUniformi("uPassNo",0),y.setUniformf("uMaskThreshold",t.maskThreshold),y.setUniform2f("uNoiseBoundsPt1",...g),y.setUniformi("texMaskVectors",t.bufs.getMaskVectorTextureUnit()),y.setUniformi("texLIC",t.bufs.getLICTextureUnit()),y.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0)),r(t.bufs,o,y);const{LICIShaderProgram:b}=t;v.readyShaderProgram(b),b.setUniformi("uPassNo",0),b.setUniformf("uStepSize",-d),b.setUniform2f("uNoiseBoundsPt1",...g),b.setUniformi("texVectors",t.bufs.getImageVectorTextureUnit()),b.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0));for(let e=0;e{const a=t._openGLRenderWindow.getShaderCache();let{min:i,max:s}=e.getTextureMinMax(t.bufs.getLastLICBuffer(),o,t.context,t._openGLRenderWindow);(s<=i||s>1||i<0)&&(console.error("Invalid color range: ",i,s),i=0,s=1);let l=s-i;n&&(i+=l*t.lowLICContrastEnhancementFactor,s-=l*t.highLICContrastEnhancementFactor,l=s-i);const{CEProgram:c}=t;a.readyShaderProgram(c),c.setUniformi("texLIC",t.bufs.getLICTextureUnit()),c.setUniformf("uMin",i),c.setUniformf("uMaxMinDiff",l),r(t.bufs,o,c)}}const hm={shadersNeedBuild:!0,stepSize:1,numberOfSteps:10,enhancedLIC:!0,enhanceContrast:!1,lowContrastEnhancementFactor:0,highContrastEnhancementFactor:0,antiAlias:0,componentIds:[0,1],normalizeVectors:!0,maskThreshold:0,transformVectors:!0,bufs:null,isComposite:!0};function vm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hm,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","nuberOfSteps","stepSize","normalizeVectors","maskThreshold","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","componentIds","isComposite"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),mm(e,t)}var ym={newInstance:jt.newInstance(vm,"vtkLineIntegralConvolution2D"),extend:vm};function bm(e,t){t.classHierarchy.push("vtkSurfaceLICInterface")}const xm={enableLIC:!1,nuberOfSteps:40,stepSize:.25,transformVectors:!0,normalizeVectors:!0,maskOnSurface:!1,maskThreshold:0,maskColor:[0,0,0],maskIntensity:0,enhancedLIC:!0,enhanceContrast:um,lowLICContrastEnhancementFactor:0,highLICContrastEnhancementFactor:0,lowColorContrastEnhancementFactor:0,highColorContrastEnhancementFactor:0,antiAlias:0,colorMode:0,LICIntensity:1,mapModeBias:0,noiseTextureSize:200,noiseTextureType:gm,noiseGrainSize:8,noiseImpulseProbability:.1,noiseImpulseBackgroundValue:0,noiseGeneratorSeed:0,minNoiseValue:0,maxNoiseValue:1,numberOfNoiseLevels:2,shadersNeedBuilding:!0,reallocateTextures:!0,rebuildNoiseTexture:!1,viewPortScale:1};function Tm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xm,n),jt.obj(e,t),jt.setGet(e,t,["enableLIC","numberOfSteps","stepSize","normalizeVectors","transformVectors","maskOnSurface","maskThreshold","maskColor","maskIntensity","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor","antiAlias","colorMode","LICIntensity","mapModeBias","noiseTextureSize","noiseTextureType","noiseGrainSize","minNoiseValue","maxNoiseValue","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","noiseGeneratorSeed","viewPortScale","rebuildNoiseTexture"]),bm(0,t)}var Cm={newInstance:jt.newInstance(Tm,"vtkSurfaceLICInterface"),extend:Tm};const{Representation:Sm}=xs;function Am(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICInterface"),e.renderQuad=(e,n)=>{const r=t.licQuad,o=t.context;let a=t.licQuadVAO;a||(a=Ad.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.licQuadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.generateNoiseTexture=e=>{if(!t.noiseTexture||t.licInterface.getRebuildNoiseTexture()){t.licInterface.setRebuildNoiseTexture(!1),t.noiseTexture&&t.noiseTexture.releaseGraphicsResources(),xo()(t.noiseGeneratorSeed,{global:!0});let n=[];const{noiseTextureType:r,noiseGrainSize:o,numberOfNoiseLevels:a,noiseImpulseProbability:i,noiseImpulseBackgroundValue:s,minNoiseValue:l,maxNoiseValue:c}=t.licInterface.get("noiseTextureType","noiseGrainSize","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","minNoiseValue","maxNoiseValue");n=r===gm?function(e,t,n,r,o,a){const i=Math.max(0,Math.min(1,n)),s=Float32Array.from({length:e*e},(()=>{let e=0;if(1===i||Math.random()>1-i)for(let t=0;t<2048;++t)e+=Math.random();return e}));let l=0,c=2049;s.forEach((e=>{c=1===i?e0?e:c,l=e>l?e:l}));let u=l-c;0===u&&(c=0,u=0===l?1:l);const d=t-1,p=0!==d?1/d:0,f=a-o;return s.map((e=>{const n=e=c?1===t?a:o+(i>d?d:i)*p*f:r}))}(Math.floor(e/o),a,i,s,l,c):function(e,t,n,r){let[o,a]=e;const i=r-n;return Float32Array.from({length:o*a},(()=>{let e=Math.random();return e=Math.floor(e*t)/t,e=e*i+n,e>1?1:e<0?0:e}))}([Math.ceil(e/o),Math.ceil(e/o)],a,l,c);const u=1/o,d=Float32Array.from({length:e*e*4},((t,r)=>{const a=r/4;if(r%4==0){const t=Math.floor(a%e*u),r=Math.floor(a/e*u);return n[r*(e/o)+t]}return r%4==1||r%4==3?1:0})),p=$d.newInstance({wrapS:$d.Wrap.REPEAT,wrapT:$d.Wrap.REPEAT,minificationFilter:$d.Filter.NEAREST,magnificationFilter:$d.Filter.NEAREST,generateMipMap:!1,openGLDataType:t.context.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});p.setOpenGLRenderWindow(t._openGLRenderWindow),p.create2DFromRaw(e,e,4,"Float32Array",d),p.activate(),p.sendParameters(),p.deactivate(),t.noiseTexture=p}},e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(nm,e,""),e.allocateTextures=()=>{const n=$d.Filter.NEAREST,r=$d.Filter.LINEAR,o=t._openGLRenderWindow;t.geometryImage||(t.geometryImage=e.allocateTexture(o,n)),t.vectorImage||(t.vectorImage=e.allocateTexture(o,r)),t.maskVectorImage||(t.maskVectorImage=e.allocateTexture(o,r)),t.LICImage||(t.LICImage=e.allocateTexture(o,n)),t.RGBColorImage||(t.RGBColorImage=e.allocateTexture(o,n)),t.HSLColorImage||(t.HSLColorImage=e.allocateTexture(o,n)),t.depthTexture||(t.depthTexture=e.allocateDepthTexture(o))},e.allocateTexture=(e,n)=>{const r=t.context,o=$d.newInstance({wrapS:$d.Wrap.CLAMP_TO_EDGE,wrapT:$d.Wrap.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:r.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});return o.setOpenGLRenderWindow(e),o.setInternalFormat(r.RGBA32F),o.create2DFromRaw(...t.size,4,"Float32Array",null),o.activate(),o.sendParameters(),o.deactivate(),o},e.allocateDepthTexture=e=>{const n=t.context,r=$d.newInstance({generateMipmap:!1,openGLDataType:n.FLOAT,autoParameters:!1});return r.setOpenGLRenderWindow(e),r.createDepthFromRaw(...t.size,"Float32Array",null),r.activate(),r.sendParameters(),r.deactivate(),r},e.createFBO=()=>{if(!t.framebuffer){t.licHelper=null;const e=nf.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow),e.saveCurrentBindingsAndBuffers(),e.create(...t.size),e.populateFramebuffer(),t.framebuffer=e,e.restorePreviousBindingsAndBuffers()}},e.completedGeometry=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeDepthBuffer(),e.drawBuffers([e.NONE]),n.restorePreviousBindingsAndBuffers()},e.buildAllShaders=()=>{t.shadersNeedBuilding&&(t.licColorPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader combines surface geometry, LIC, and scalar colors.\n\n// the output of this shader\nlayout(location = 0) out vec4 RGBOutput;\nlayout(location = 1) out vec4 HSLOutput;\n\nuniform sampler2D texVectors; // vectors, depth\nuniform sampler2D texGeomColors; // scalar colors + lighting\nuniform sampler2D texLIC; // image lic\nuniform int uScalarColorMode; // select between blend, and map shader\nuniform float uLICIntensity; // blend shader: blending factor for lic'd colors\nuniform float uMapBias; // map shader: adjust the brightness of the result\nuniform float uMaskIntensity; // blending factor for mask color\nuniform vec3 uMaskColor; // color for the masked out fragments\n\nin vec2 tcoordVC;\n\n/**\nConvert from RGB color space into HSL colorspace.\n*/\nvec3 RGBToHSL(vec3 RGB)\n{\n vec3 HSL = vec3(0.0, 0.0, 0.0);\n\n float RGBMin = min(min(RGB.r, RGB.g), RGB.b);\n float RGBMax = max(max(RGB.r, RGB.g), RGB.b);\n float RGBMaxMinDiff = RGBMax - RGBMin;\n\n HSL.z = (RGBMax + RGBMin) / 2.0;\n\n if (RGBMaxMinDiff == 0.0)\n {\n // Gray scale\n HSL.x = 0.0;\n HSL.y = 0.0;\n }\n else\n {\n // Color\n if (HSL.z < 0.5)\n HSL.y = RGBMaxMinDiff / (RGBMax + RGBMin);\n else\n HSL.y = RGBMaxMinDiff / (2.0 - RGBMax - RGBMin);\n\n float dR\n = (((RGBMax - RGB.r) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dG\n = (((RGBMax - RGB.g) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dB\n = (((RGBMax - RGB.b) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n\n if (RGB.r == RGBMax)\n HSL.x = dB - dG;\n else\n if (RGB.g == RGBMax)\n HSL.x = (1.0 / 3.0) + dR - dB;\n else\n if (RGB.b == RGBMax)\n HSL.x = (2.0 / 3.0) + dG - dR;\n\n if (HSL.x < 0.0)\n HSL.x += 1.0;\n\n if (HSL.x > 1.0)\n HSL.x -= 1.0;\n }\n\n return HSL;\n}\n\n/**\nHelper for HSL to RGB conversion.\n*/\nfloat Util(float v1, float v2, float vH)\n{\n if (vH < 0.0)\n vH += 1.0;\n\n if (vH > 1.0)\n vH -= 1.0;\n\n if ((6.0 * vH) < 1.0)\n return (v1 + (v2 - v1) * 6.0 * vH);\n\n if ((2.0 * vH) < 1.0)\n return (v2);\n\n if ((3.0 * vH) < 2.0)\n return (v1 + (v2 - v1) * ((2.0 / 3.0) - vH) * 6.0);\n\n return v1;\n}\n\n/**\nConvert from HSL space into RGB space.\n*/\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n if (HSL.y == 0.0)\n {\n // Gray\n RGB.r = HSL.z;\n RGB.g = HSL.z;\n RGB.b = HSL.z;\n }\n else\n {\n // Chromatic\n float v2;\n if (HSL.z < 0.5)\n v2 = HSL.z * (1.0 + HSL.y);\n else\n v2 = (HSL.z + HSL.y) - (HSL.y * HSL.z);\n\n float v1 = 2.0 * HSL.z - v2;\n\n RGB.r = Util(v1, v2, HSL.x + (1.0 / 3.0));\n RGB.g = Util(v1, v2, HSL.x);\n RGB.b = Util(v1, v2, HSL.x - (1.0 / 3.0));\n }\n\n return RGB.rgb;\n}\n\nvoid main()\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n\n // depth is used to determine which fragment belong to us\n // and we can change\n float depth = texture2D(texVectors, tcoordVC.st).a;\n\n vec3 fragColorRGB;\n float valid;\n if (depth > 1.0e-3)\n {\n // we own it\n // shade LIC'ed geometry, or apply mask\n if (lic.g!=0.0)\n {\n // it's masked\n // apply fragment mask\n fragColorRGB = uMaskIntensity * uMaskColor + (1.0 - uMaskIntensity) * geomColor.rgb;\n valid = 0.0;\n }\n else\n {\n if (uScalarColorMode==0)\n {\n // blend with scalars\n fragColorRGB = lic.rrr * uLICIntensity + geomColor.rgb * (1.0 - uLICIntensity);\n }\n else\n {\n // multiply with scalars\n fragColorRGB = geomColor.rgb * clamp((uMapBias + lic.r), 0.0, 1.0);\n }\n if (lic.b != 0.0)\n {\n // didn't have the required guard pixels\n // don't consider it in min max estimation\n // for histpgram stretching\n valid = 0.0;\n }\n else\n {\n // ok to use in min/max estimates for histogram\n // stretching\n valid = 1.0;\n }\n }\n }\n else\n {\n // we don't own it\n // pass through scalars\n fragColorRGB = geomColor.rgb;\n valid = 0.0;\n }\n\n // if no further stages this texture is\n // copied to the screen\n RGBOutput = vec4(fragColorRGB, geomColor.a);\n\n // if further stages, move to hsl space for contrast\n // enhancement. encoding validity saves moving a texture to the cpu\n vec3 fragColorHSL = RGBToHSL(fragColorRGB);\n HSLOutput = vec4(fragColorHSL, valid);\n}\n"),t.licCopyPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_DCpy.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader copies fragments and depths to the output buffer\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texDepth; // z values from vertex shader\nuniform sampler2D texRGBColors; // final rgb LIC colors\n\nin vec2 tcoordVC;\n\nvoid main()\n{\n gl_FragDepth = texture2D(texDepth, tcoordVC).x;\n gl_FragData[0] = texture2D(texRGBColors, tcoordVC);\n\n // since we render a screen aligned quad\n // we're going to be writing fragments\n // not touched by the original geometry\n // it's critical not to modify those\n // fragments.\n if (gl_FragDepth == 1.0)\n {\n discard;\n }\n}\n"),t.enhanceContrastPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// color contrast enhance stage implemented via histogram stretching\n// on lightness channel. if the min and max are tweaked it can generate\n// out-of-range values these will be clamped in 0 to 1\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texGeomColors; // scalars + lighting\nuniform sampler2D texLIC; // image lic, mask\nuniform sampler2D texHSLColors; // hsla colors\n\nuniform float uLMin; // min lightness over all fragments\nuniform float uLMaxMinDiff; // max - min lightness over all fragments\n\nin vec2 tcoordVC;\n\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n float v;\n float h = HSL.x;\n float sl = HSL.y;\n float l = HSL.z;\n\n v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);\n if (v <= 0.0) {\n RGB = vec3(0.0,0.0,0.0);\n } else {\n float m;\n int sextant;\n float fract, vsf, mid1, mid2;\n\n m = l + l - v;\n h *= 6.0;\n sextant = int(h);\n fract = h - float(sextant);\n\n vsf = (v - m) * fract;\n mid1 = m + vsf;\n mid2 = v - vsf;\n switch (sextant) {\n case 0: RGB.r = v; RGB.g = mid1; RGB.b = m; break;\n case 1: RGB.r = mid2; RGB.g = v; RGB.b = m; break;\n case 2: RGB.r = m; RGB.g = v; RGB.b = mid1; break;\n case 3: RGB.r = m; RGB.g = mid2; RGB.b = v; break;\n case 4: RGB.r = mid1; RGB.g = m; RGB.b = v; break;\n case 5: RGB.r = v; RGB.g = m; RGB.b = mid2; break;\n }\n }\n return RGB;\n}\n\nvoid main()\n{\n // lookup hsl color , mask\n vec4 fragColor = texture2D(texHSLColors, tcoordVC.st);\n\n // don't modify masked fragments (masked => lic.g==1)\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g==0.0)\n {\n // normalize lightness channel\n fragColor.z = clamp((fragColor.z - uLMin)/uLMaxMinDiff, 0.0, 1.0);\n }\n\n // back into rgb space\n fragColor.rgb = HSLToRGB(fragColor.xyz);\n\n // add alpha\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n fragColor.a = geomColor.a;\n\n gl_FragData[0] = fragColor;\n}\n"),t.shadersNeedBuilding=!1)},e.initializeResources=()=>{e.createFBO(),e.generateNoiseTexture(t.licInterface.getNoiseTextureSize()),e.allocateTextures(),e.buildAllShaders(),t.licQuad||(t.licQuad=function(e){const t=Md.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Us.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Us.newInstance({numberOfComponents:1,values:o}),s=Us.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",Sm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow)),t.licHelper||(t.licHelper=ym.newInstance())},e.prepareForGeometry=()=>{const e=t.framebuffer;e.saveCurrentBindingsAndBuffers(),e.bind(),t.geometryImage.activate(),t.vectorImage.activate(),t.maskVectorImage.activate(),e.removeColorBuffer(0),e.removeColorBuffer(2),e.removeColorBuffer(3),e.setColorBuffer(t.geometryImage,0),e.setColorBuffer(t.vectorImage,2),e.setColorBuffer(t.maskVectorImage,3),e.setDepthBuffer(t.depthTexture);const n=t.context;n.drawBuffers([n.COLOR_ATTACHMENT0,n.NONE,n.COLOR_ATTACHMENT2,n.COLOR_ATTACHMENT3]),n.viewport(0,0,...t.size),n.scissor(0,0,...t.size),n.disable(n.BLEND),n.disable(n.DEPTH_TEST),n.disable(n.SCISSOR_TEST),n.clearColor(0,0,0,0),n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT)},e.copyToScreen=n=>{t.RGBColorImage.activate(),t.depthTexture.activate(),t.licCopyPass||e.initializeResources();const r=t.licCopyPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(r);const o=t.context;o.viewport(0,0,...n),o.scissor(0,0,...n),o.disable(o.BLEND),o.enable(o.DEPTH_TEST),o.disable(o.SCISSOR_TEST),r.setUniformi("texDepth",t.depthTexture.getTextureUnit()),r.setUniformi("texRGBColors",t.RGBColorImage.getTextureUnit()),e.renderQuad(n,r),t.RGBColorImage.deactivate(),t.depthTexture.deactivate()},e.combineColorsAndLIC=()=>{const n=t.context,r=t.framebuffer;r.saveCurrentBindingsAndBuffers(),r.bind(),r.create(...t.size),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(t.RGBColorImage,0),r.setColorBuffer(t.HSLColorImage,1),n.drawBuffers([n.COLOR_ATTACHMENT0,n.COLOR_ATTACHMENT1]),n.disable(n.DEPTH_TEST),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),t.vectorImage.activate(),t.geometryImage.activate(),t.LICImage.activate(),t.licColorPass||e.initializeResources();const o=t.licColorPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(o),o.setUniformi("texVectors",t.vectorImage.getTextureUnit()),o.setUniformi("texGeomColors",t.geometryImage.getTextureUnit());const{colorMode:a,LICIntensity:i,mapModeBias:s,maskIntensity:l,maskColor:c,enhanceContrast:u,lowColorContrastEnhancementFactor:d,highColorContrastEnhancementFactor:p}=t.licInterface.get("colorMode","LICIntensity","mapModeBias","maskIntensity","maskColor","enhanceContrast","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor");if(o.setUniformi("texLIC",t.LICImage.getTextureUnit()),o.setUniformi("uScalarColorMode",a),o.setUniformf("uLICIntensity",i),o.setUniformf("uMapBias",s),o.setUniformf("uMaskIntensity",l),o.setUniform3f("uMaskColor",...c),e.renderQuad(t.size,o),t.vectorImage.deactivate(),t.geometryImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE]),u===pm||u===fm){let o=0,a=1,i=a-o;o+=i*d,a-=i*p,i=a-o,r.setColorBuffer(t.RGBColorImage),n.drawBuffers([n.COLOR_ATTACHMENT0]),t.geometryImage.activate(),t.HSLColorImage.activate(),t.LICImage.activate(),t.enhanceContrastPass||e.initializeResources();const{enhanceContrastPass:s}=t;t._openGLRenderWindow.getShaderCache().readyShaderProgram(s),s.setUniformi("texGeomColors",t.geometryImage.getTextureUnit()),s.setUniformi("texHSLColors",t.HSLColorImage.getTextureUnit()),s.setUniformi("texLIC",t.LICImage.getTextureUnit()),s.setUniformf("uLMin",o),s.setUniformf("uLMaxMinDiff",i),e.renderQuad(t.size,s),t.geometryImage.deactivate(),t.HSLColorImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),n.drawBuffers([n.NONE])}r.restorePreviousBindingsAndBuffers()},e.applyLIC=()=>{const e=t.licInterface.get("stepSize","numberOfSteps","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","normalizeVectors","maskThreshold","transformVectors"),n=t.licHelper.executeLIC(t.size,t.vectorImage,t.maskVectorImage,t.noiseTexture,t._openGLRenderWindow,e);if(!n)return console.error("Failed to compute image LIC"),void(t.LICImage=null);t.LICImage=n},e.setSize=n=>{Array.isArray(n)&&2===n.length&&(t.size&&t.size[0]===n[0]&&t.size[1]===n[1]||(t.size=n,e.releaseGraphicsResources()))},e.releaseGraphicsResources=()=>{t.geometryImage&&(t.geometryImage.releaseGraphicsResources(),t.geometryImage=null),t.vectorImage&&(t.vectorImage.releaseGraphicsResources(),t.vectorImage=null),t.maskVectorImage&&(t.maskVectorImage.releaseGraphicsResources(),t.maskVectorImage=null),t.LICImage&&(t.LICImage.releaseGraphicsResources(),t.LICImage=null),t.RGBColorImage&&(t.RGBColorImage.releaseGraphicsResources(),t.RGBColorImage=null),t.HSLColorImage&&(t.HSLColorImage.releaseGraphicsResources(),t.HSLColorImage=null),t.depthTexture&&(t.depthTexture.releaseGraphicsResources(),t.depthTexture=null),t.framebuffer&&(t.framebuffer.releaseGraphicsResources(),t.framebuffer=null)}}const Pm={context:null,shadersNeedBuilding:!0,reallocateTextures:!0,size:null,licInterface:null};function Im(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pm,n),Cm.extend(e,t,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","reallocateTextures","licInterface","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),Am(e,t)}var wm={newInstance:jt.newInstance(Im,"vtkSurfaceLICInterface"),extend:Im};const{vtkErrorMacro:Om}=Kt;function Mm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICMapper");const n={...e};e.getNeedToRebuildShaders=(e,r,o)=>t.rebuildLICShaders||n.getNeedToRebuildShaders(e,r,o),e.replaceShaderValues=(e,r,o)=>{const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=e.Vertex,s=e.Fragment;const l=t.renderable.getInputArrayToProcess(0);if(l&&t.canDrawLIC){s=xd.substitute(s,"//VTK::Output::Dec",["//VTK::Output::Dec","layout(location = 2) out vec4 vectorTexture;","layout(location = 3) out vec4 maskVectorTexture;"]).result;const n=`${l.getName()}MC`;0===a&&t.lastBoundBO.set({lastLightComplexity:1},!0),i=xd.substitute(i,"//VTK::TCoord::Dec",[`attribute vec3 ${n};`,"out vec3 licOutput;","//VTK::TCoord::Dec"]).result,i=xd.substitute(i,"//VTK::TCoord::Impl",[`licOutput = ${n};`,"//VTK::TCoord::Impl"]).result,s=xd.substitute(s,"//VTK::TCoord::Dec",["uniform int uMaskOnSurface;","uniform mat3 normalMatrix;","in vec3 licOutput;","//VTK::TCoord::Dec"]).result,s=xd.substitute(s,"//VTK::TCoord::Impl",["// projected vectors"," vec3 tcoordLIC = normalMatrix * licOutput;"," vec3 normN = normalize(normalVCVSOutput);"," float k = dot(tcoordLIC, normN);"," vec3 projected = (tcoordLIC - k*normN);"," vectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);","// vectors for fragment masking"," if (uMaskOnSurface == 0)"," {"," maskVectorTexture = vec4(licOutput, 1.0);"," }"," else"," {"," maskVectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);"," }","//VTK::TCoord::Impl"],!1).result,e.Vertex=i}t.rebuildLICShaders=!1,e.Fragment=s,n.replaceShaderValues(e,r,o),a>0&&t.lastBoundBO.set({lastLightComplexity:a},!0)},e.setMapperShaderParameters=(e,r,o)=>{n.setMapperShaderParameters(e,r,o),t.canDrawLIC&&e.getProgram().setUniformi("uMaskOnSurface",t.maskOnSurface)},e.getNeedToRebuildBufferObjects=(e,r)=>t.rebuildLICBuffers||n.getNeedToRebuildBufferObjects(e,r),e.buildBufferObjects=(e,r)=>{if(t.canDrawLIC){const e=t.renderable.getInputArrayToProcess(0);e&&e.getNumberOfComponents()>1&&t.renderable.setCustomShaderAttributes([e.getName()])}t.rebuildLICBuffers=!1,n.buildBufferObjects(e,r)},e.pushState=e=>{t.stateCache={[e.BLEND]:e.isEnabled(e.BLEND),[e.DEPTH_TEST]:e.isEnabled(e.DEPTH_TEST),[e.SCISSOR_TEST]:e.isEnabled(e.SCISSOR_TEST),[e.CULL_FACE]:e.isEnabled(e.CULL_FACE)}},e.popState=e=>{const n=n=>t.stateCache[n]?e.enable(n):e.disable(n);n(e.BLEND),n(e.DEPTH_TEST),n(e.SCISSOR_TEST),n(e.CULL_FACE)},e.renderPiece=(r,o)=>{let a=!0;t._openGLRenderWindow.getWebgl2()||(Om("SurfaceLICMapper Requires WebGL 2"),a=!1),t.context.getExtension("EXT_color_buffer_float")&&t.context.getExtension("OES_texture_float_linear")||(Om("SurfaceLICMapper requires the EXT_color_buffer_float and OES_texture_float_linear WebGL2 extensions."),a=!1),t.currentInput=t.renderable.getInputData(),t.currentInput||(Om("No input"),a=!1);let i=t.renderable.getLicInterface();i||(i=Cm.newInstance(),t.renderable.setLicInterface(i)),t.openGLLicInterface||(t.openGLLicInterface=wm.newInstance()),i!==t.openGLLicInterface.getLicInterface()&&t.openGLLicInterface.setLicInterface(i);const s=t.renderable.getInputArrayToProcess(0);if(i.getEnableLIC()&&(!s||s.getNumberOfComponents()<2)&&(Om("No vector input array"),a=!1),i.getEnableLIC()||(a=!1),t.canDrawLIC!==a&&(t.rebuildLICShaders=!0,t.rebuildLICBuffers=!0),t.canDrawLIC=a,!a||!i.getEnableLIC())return void n.renderPiece(r,o);const l=t.context,c=o.getProperty().getBackfaceCulling(),u=o.getProperty().getFrontfaceCulling();c||u?u?(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.FRONT)):(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.BACK)):t._openGLRenderWindow.disableCullFace();const d=t._openGLRenderWindow.getSize(),p=d.map((e=>Math.round(e*i.getViewPortScale())));t.openGLLicInterface.setSize(p),t.openGLLicInterface.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLLicInterface.setContext(t.context),e.pushState(t.context),t.openGLLicInterface.initializeResources(),t.openGLLicInterface.prepareForGeometry(),e.popState(t.context),n.renderPieceStart(r,o),n.renderPieceDraw(r,o),n.renderPieceFinish(r,o),e.pushState(t.context),t.VBOBuildTime.modified(),t.openGLLicInterface.completedGeometry(),t.context.disable(t.context.CULL_FACE),t.openGLLicInterface.applyLIC(),t.openGLLicInterface.combineColorsAndLIC(),t.openGLLicInterface.copyToScreen(d),e.popState(t.context)}}const Rm={canDrawLIC:!1,rebuildLICShaders:!1,rebuildLICBuffers:!1,openGLLicInterface:null};const Vm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),fp.extend(e,t,n),Mm(e,t),At(e,t,["openGLLicInterface"])}),"vtkOpenGLSurfaceLICMapper");rn("vtkSurfaceLICMapper",Vm);const{vtkErrorMacro:Em}=Kt;function Dm(e,t){t.classHierarchy.push("vtkOpenGLSphereMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,i=xd.substitute(i,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=xd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=xd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{if(e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)||Em("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),e.getProgram().isUniformUsed("scaleFactor")){const n=t.currentInput.getPointData();null!=t.renderable.getScaleArray()&&n.hasArray(t.renderable.getScaleArray())?e.getProgram().setUniformf("scaleFactor",t.renderable.getScaleFactor()):e.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),o.isUniformUsed("MCVCMatrix"))if(r.getIsIdentity())o.setUniformMatrix("MCVCMatrix",i.wcvc);else{const e=t.openGLActor.getKeyMatrices(),n=new Float64Array(16);b(n,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",n)}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(u=i.getArray(t.renderable.getScaleArray()).getData());let d=null,p=0,f=null;o?(p=o.getNumberOfComponents(),a.setColorOffset(0),a.setColorBOStride(4),d=o.getData(),f=new Uint8Array(3*l*4),a.getColorBO()||a.setColorBO(ad.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow)):a.getColorBO()&&a.setColorBO(null),a.setColorComponents(p);const g=new Float32Array(5*l*3);a.setStride(20);const m=Math.cos(Eo(30));let h=0,v=0,y=0,b=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lm,n),fp.extend(e,t,n),Dm(e,t)}),"vtkOpenGLSphereMapper");rn("vtkSphereMapper",Bm);const{vtkErrorMacro:Nm}=Kt;function km(e,t){t.classHierarchy.push("vtkOpenGLStickMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkStickMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Sticks\n\nattribute vec4 vertexMC;\nattribute vec3 orientMC;\nattribute vec4 offsetMC;\nattribute float radiusMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying float lengthVCVSOutput;\nvarying vec3 centerVCVSOutput;\nvarying vec3 orientVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = radiusMC;\n lengthVCVSOutput = length(orientMC);\n orientVCVSOutput = normalMatrix * normalize(orientMC);\n\n // make sure it is pointing out of the screen\n if (orientVCVSOutput.z < 0.0)\n {\n orientVCVSOutput = -orientVCVSOutput;\n }\n\n // make the basis\n vec3 xbase;\n vec3 ybase;\n vec3 dir = vec3(0.0,0.0,1.0);\n if (cameraParallel == 0)\n {\n dir = normalize(-vertexVCVSOutput.xyz);\n }\n if (abs(dot(dir,orientVCVSOutput)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));\n ybase = cross(xbase,orientVCVSOutput);\n }\n else\n {\n xbase = normalize(cross(orientVCVSOutput,dir));\n ybase = cross(orientVCVSOutput,xbase);\n }\n\n vec3 offsets = offsetMC.xyz*2.0-1.0;\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +\n radiusVCVSOutput*offsets.x*xbase +\n radiusVCVSOutput*offsets.y*ybase +\n 0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Xd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=xd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=xd.substitute(i,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,i=xd.substitute(i,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,i=xd.substitute(i,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=xd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=xd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=xd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)||Nm("Error setting 'orientMC' in shader VAO.")),e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)||Nm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isAttributeUsed("radiusMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)||Nm("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),r.getIsIdentity())o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",i.wcvc),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",i.normalMatrix);else{const e=t.openGLActor.getKeyMatrices();if(o.isUniformUsed("MCVCMatrix")){const t=new Float64Array(16);b(t,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",t)}if(o.isUniformUsed("normalMatrix")){const t=new Float64Array(9);ve(t,i.normalMatrix,e.normalMatrix),o.setUniformMatrix3x3("normalMatrix",t)}}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=3;u+=4;let d=null,p=0;a.setColorBOStride(4),a.getColorBO()||a.setColorBO(ad.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow),o&&(p=o.getNumberOfComponents(),a.setColorOffset(4),d=o.getData(),a.setColorBOStride(8)),a.setColorComponents(p),a.setStride(28);const f=new Float32Array(7*l*12),g=new Uint8Array(12*l*(d?8:4));let m=null,h=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(m=i.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&i.hasArray(t.renderable.getOrientationArray())?h=i.getArray(t.renderable.getOrientationArray()).getData():Nm(["Error setting orientationArray.\n","You have to specify the stick orientation"]);const v=[0,1,3,0,3,2,2,3,5,2,5,4];let y=0,b=0,x=0,T=0;for(let e=0;e=4?255:0,g[T++]=v[t]>=2?255:0,g[T++]=255,b=e*p,d&&(g[T++]=d[b],g[T++]=d[b+1],g[T++]=d[b+2],g[T++]=d[b+3])}a.setElementCount(x/7),a.upload(f,Ju.ARRAY_BUFFER),a.getColorBO().upload(g,Ju.ARRAY_BUFFER),t.VBOBuildTime.modified()}}const Fm={};const _m=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fm,n),fp.extend(e,t,n),km(e,t)}),"vtkOpenGLStickMapper");rn("vtkStickMapper",_m);const Gm=Object.create(null);function Um(e,t){Gm[e]=t}function Wm(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const zm={};function Hm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zm,n),t.overrides=Gm,tn.extend(e,t,n),Wm(0,t)}var jm={newInstance:jt.newInstance(Hm,"vtkWebGPUViewNodeFactory"),extend:Hm};function Km(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(g(e),t.renderable.getParallelProjection()){const a=t.renderable.getParallelScale(),i=a*n,s=a,l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(c-l),f=1/(d-u);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(c+l)*p,e[13]=(d+u)*f,e[14]=r[1]/(r[1]-r[0])}else{const a=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let i,s;!0===t.renderable.getUseHorizontalViewAngle()?(i=r[0]*a,s=r[0]*a/n):(i=r[0]*a*n,s=r[0]*a);const l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(c-l),e[5]=2*r[0]/(d-u),e[12]=(l+c)/(c-l),e[13]=(u+d)/(d-u),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();d(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();x(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const a=n.getAspectRatio(),i=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,a,i,t.renderable.getWindowCenterByReference()),b(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),h(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const $m={keyMatrixTime:null,keyMatrices:null};const qm=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$m,n),Zt.extend(e,t,n),t.keyMatrixTime={},jt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},jt.setGet(e,t,["keyMatrixTime"]),Km(e,t)}));function Xm(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ym,n),jt.obj(e,t),t.bindables=[],t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),jt.setGet(e,t,["label","device","arrayInformation"]),Xm(e,t)}var Qm={newInstance:jt.newInstance(Zm),extend:Zm};function Jm(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const eh={device:null,handle:null};function th(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eh,n),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["device","handle"]),Jm(e,t)}var nh={newInstance:jt.newInstance(th,"vtkWebGPUShaderModule"),extend:th};function rh(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oh,n),t._shaderModules=new Map,jt.obj(e,t),jt.setGet(e,t,["device","window"]),rh(e,t)}var ih={newInstance:jt.newInstance(ah,"vtkWebGPUShaderCache"),extend:ah,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let a=!1;-1!==e.search(t)&&(a=!0);let i="";r&&(i="g");const s=new RegExp(t,i),l=e.replace(s,o);return{replace:a,result:l}}};function sh(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const lh={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lh,n),yt(e,t),t.layouts=[],t.shaderDescriptions=[],xt(e,t,["handle","pipelineDescription"]),At(e,t,["device","renderEncoder","topology","vertexState"]),sh(e,t)}var uh={newInstance:Et(ch,"vtkWebGPUPipeline"),extend:ch};function dh(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=ih.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=ih.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const ph={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function fh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ph,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],jt.obj(e,t),jt.setGet(e,t,["type","hash","code"]),jt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),dh(e,t)}var gh={newInstance:jt.newInstance(fh,"vtkWebGPUShaderDescription"),extend:fh};const mh={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var hh=function(e){return!e||e.length<6?0:e in mh==1?mh[e]:(et(`unknown format ${e}`),null)},vh=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(et(`unknown format ${e}`),0):t*(5-r/2)},yh=function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},bh=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void et(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;et(`unknown format ${e}`)},xh=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void et(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},Th=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Ch=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void et(`unknown format ${e}`)};function Sh(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${i}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Ph={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ph,n),yt(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],At(e,t,["created","device","handle","indexBuffer"]),Ah(e,t)}var wh={newInstance:Et(Ih,"vtkWebGPUVertexInput"),extend:Ih};const Oh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",Mh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function Rh(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const a=gh.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),i=gh.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(a),s.push(i);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,c=new RegExp("//VTK::[^:]*::","g"),u=l.match(c).filter(((e,t,n)=>n.indexOf(e)===t)),d=u.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=ih.substitute(i,"//VTK::Renderer::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");i=s.getCode(),i=ih.substitute(i,"//VTK::Renderer::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=ih.substitute(i,"//VTK::Mapper::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),i=s.getCode(),i=ih.substitute(i,"//VTK::Mapper::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=uh.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const Vh={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Eh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vh,n),Zt.extend(e,t,n),t.textureViews=[],t.vertexInput=wh.newInstance(),t.bindGroup=Qm.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||Mh,t.vertexShaderTemplate=t.vertexShaderTemplate||Oh,t.shaderReplacements=new Map,jt.get(e,t,["pipeline","vertexInput"]),jt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),Rh(e,t)}var Dh={newInstance:jt.newInstance(Eh,"vtkWebGPUSimpleMapper"),extend:Eh};function Lh(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const Bh={};function Nh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh,n),Dh.extend(e,t,n),Lh(e,t)}var kh={newInstance:jt.newInstance(Nh,"vtkWebGPUFullScreenQuad"),extend:Nh},Fh={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const _h=["getMappedRange","mapAsync","unmap"];function Gh(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,a=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=a.getMappedRange(0,o);new Uint8Array(i).set(new Uint8Array(r)),a.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(a,0,t,0,o);const l=s.finish();e.queue.submit([l]),a.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n<_h.length;n++)e[_h[n]]=function(){return t.handle[_h[n]](...arguments)}}const Uh={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function Wh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uh,n),jt.obj(e,t),jt.get(e,t,["handle","sizeInBytes","usage"]),jt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),Gh(e,t)}var zh={newInstance:jt.newInstance(Wh),extend:Wh,...Fh};const{Representation:Hh}=xs,{PrimitiveTypes:jh}=Fh;class Kh{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let a=0;a2){for(let a=0;a{const n=e.cells,r=e.primitiveType,o=e.representation,a=e.cellOffset,i=n.getData(),s=i.length,l=function(e){switch(e){case jh.Points:return"points";case jh.Lines:return"lines";case jh.Triangles:case jh.TriangleEdges:return"polys";case jh.TriangleStripEdges:case jh.TriangleStrips:return"strips";default:return""}}(r),c=e.numberOfPoints,u={provokedPointIds:new Uint8Array(c),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Kh};let d=null;d=o===Hh.POINTS||r===jh.Points?ev.anythingToPoints:o===Hh.WIREFRAME||r===jh.Lines?ev[`${l}ToWireframe`]:ev[`${l}ToSurface`],Yh=Xh;let p=a||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),zh.extend(e,t,n),jt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),tv(e,t)}var ov={newInstance:jt.newInstance(rv),extend:rv,...Fh};const{BufferUsage:av}=Fh,{vtkErrorMacro:iv}=Kt,{VtkDataTypes:sv}=Us;function lv(e,t,n,r,o){const a={},i=e.getFlatSize();if(!i)return a;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const c=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let u,d=0;const p=at(r,i*(n+(c?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?u=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||c?3===n&&c?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case sv.UNSIGNED_CHAR:t="uint8";break;case sv.FLOAT:t="float32";break;case sv.UNSIGNED_INT:t="uint32";break;case sv.INT:t="sint32";break;case sv.DOUBLE:t="float32";break;case sv.UNSIGNED_SHORT:t="uint16";break;case sv.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||iv(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:av.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=zh.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const dv={device:null,fullScreenQuadBuffer:null};function pv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dv,n),yt(e,t),At(e,t,["device"]),uv(e,t)}var fv={newInstance:Et(pv),extend:pv,...Fh};const{BufferUsage:gv}=fv,{vtkErrorMacro:mv}=jt;function hv(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void mv(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=Th(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Ch(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:gv.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void mv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType];s[(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void mv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType],l=(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void mv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const vv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function yv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},jt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},jt.get(e,t,["bindGroupTime"]),jt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),hv(e,t)}var bv={newInstance:jt.newInstance(yv,"vtkWebGPUStorageBuffer"),extend:yv};const{BufferUsage:xv}=fv,{vtkErrorMacro:Tv}=jt;function Cv(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?Tv(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:Th(n),offset:-1,nativeType:Ch(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:xv.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void Tv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];a.lastValue!==r&&(i[a.offset/i.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),a.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void Tv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const Sv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function Av(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},jt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,jt.get(e,t,["binding","bindGroupTime"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),Cv(e,t)}var Pv={newInstance:jt.newInstance(Av,"vtkWebGPUUniformBuffer"),extend:Av};const{vtkDebugMacro:Iv}=Kt,wv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",Ov=new Float64Array(16),Mv=new Float64Array(16);function Rv(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];On(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),In(r,n,o),_n(o,r,t.stabilizedCenter),Un(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(Iv("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(Eo(n[t].getConeAngle())),s[l+2]=Math.cos(Eo(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",i),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var a;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=kh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(wv);const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=kh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(wv);const e=Pv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),m(Mv,r.normalMatrix),oe(Ov,r.scvc,r.pcsc),oe(Ov,Mv,Ov),t.clearFSQ.getUBO().setArray("FSQMatrix",Ov),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const Vv={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const Ev=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vv,n),Zt.extend(e,t,n),t.UBO=Pv.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=bv.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=Qm.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=g(new Float64Array(16)),t.stabilizedTime={},yt(t.stabilizedTime,{mtime:0}),xt(e,t,["bindGroup","stabilizedTime"]),Pt(e,t,["stabilizedCenter"]),At(e,t,["renderEncoder","selector","suppressClear","UBO"]),Rv(e,t)}),"vtkWebGPURenderer");Um("vtkRenderer",Ev);const{CoordinateSystem:Dv}=is;function Lv(e,t){t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix();t.bufferShift[0]=n[3],t.bufferShift[1]=n[7],t.bufferShift[2]=n[11];const r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Dv.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Dv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Bv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Nv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Lv(e,t)}));Um("vtkActor",Nv);const{CoordinateSystem:kv}=is;function Fv(e,t){t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;const n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===kv.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),g(t.keyMatrices.bcwc),g(t.keyMatrices.normalMatrix),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===kv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const _v={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Gv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_v,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Fv(e,t)}));function Uv(e,t){t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Um("vtkActor2D",Gv);const Wv={};const zv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wv,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Xu.newCubeAxesActorHelper(),Uv(e,t)}),"vtkWebGPUCubeAxesActor");Um("vtkCubeAxesActor",zv);const{DisplayLocation:Hv}=Cp;function jv(e,t){t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(Hv.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(Hv.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(ps.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(ps.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(ps.POINTS),e.getRepresentationAsString=()=>jt.enumToString(ps,t.representation)}const Kv={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:ps.SURFACE,displayLocation:Hv.FOREGROUND};function $v(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kv,n),jt.obj(e,t),jt.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation"]),jt.setGetArray(e,t,["color"],3),jv(e,t)}var qv={newInstance:jt.newInstance($v,"vtkProperty2D"),extend:$v,...Cp};const{BufferUsage:Xv,PrimitiveTypes:Yv}=fv,{Representation:Zv}=xs,{ScalarMode:Qv}=fc,{CoordinateSystem:Jv}=is,{DisplayLocation:ey}=qv,ty="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ny='\nstruct PBRData {\n diffuse: vec3,\n specular: vec3,\n}\n\n// Dot product with the max already in it\nfn mdot(a: vec3, b: vec3) -> f32 {\n return max(0.0, dot(a, b));\n}\n// Dot product with a max in it that does not allow for negative values\n// Physically based rendering is accurate as long as normals are accurate,\n// however this is pretty often not the case. In order to prevent negative\n// values from ruining light calculations and creating zones of zero light,\n// this remapping is used, which smoothly clamps the dot product between\n// zero and one while still maintaining a good amount of accuracy.\nfn cdot(a: vec3, b: vec3) -> f32 {\n var d: f32 = max(0.0, dot(a, b));\n d = pow((d + 1) / 2.0, 2.6);\n return d;\n}\n\n// Lambertian diffuse model\nfn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 {\n var pi: f32 = 3.14159265359; \n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5);\n return (base/pi)*NdotL;\n}\n\n// Yasuhiro Fujii improvement on the Oren-Nayar model\n// https://mimosa-pudica.net/improved-oren-nayar.html\n// p is surface color, o is roughness\nfn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 {\n var invpi: f32 = 0.31830988618; // 1/pi\n\n var o2 = o*o;\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better\n\n var NdotV: f32 = mdot(N, V);\n var LdotV: f32 = mdot(L, V);\n\n var s: f32 = LdotV - NdotL*NdotV;\n var t: f32 = mix(1, max(NdotL, NdotV), step(0, s)); // Mix with step is the equivalent of an if statement\n var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13));\n A = invpi*(1 - A);\n var B: f32 = 0.45*(o2 / (o2 + 0.09));\n B = invpi*B;\n\n return p*NdotL*(A + B*(s/t));\n}\n\n// Fresnel portion of BRDF (IOR only, simplified)\nfn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 {\n var NdotV: f32 = mdot(V, N);\n var F0: f32 = (pow((ior - 1.0), 2) + k*k) / (pow((ior + 1.0), 2) + k*k); // This takes into account the roughness, which the other one does not\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Fresnel portion of BRDF (Color ior, better)\nfn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 {\n var NdotV: f32 = mdot(V, N);\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Normal portion of BRDF\n// https://learnopengl.com/PBR/Theory\n// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2\nfn trGGX(N: vec3, H: vec3, a: f32) -> f32 {\n var pi: f32 = 3.14159265359; \n\n var a2: f32 = a*a;\n var NdotH = mdot(N, H);\n var NdotH2 = NdotH*NdotH;\n \n var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0;\n\n return a2 / max((pi*denom*denom), 0.000001);\n}\n\n// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent\nfn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 {\n var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz;\n\n var ggx1: f32 = trGGX(N + Op*s, H, a);\n var ggx2: f32 = trGGX(N - Op*s, H, a);\n return (0.5 * ggx1 + 0.5 * ggx2);\n}\n\n// Geometry portion of BRDF\nfn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 {\n var NdotX = cdot(N, X);\n return NdotX / max(0.000001, (NdotX*(1-k) + k));\n}\n\nfn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 {\n var ggx1: f32 = min(1, schlickGGX(N, V, k));\n var ggx2: f32 = min(1, schlickGGX(N, L, k));\n return ggx1*ggx2;\n}\n\n// BRDF Combination\nfn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 {\n var num: f32 = D*F*G;\n var denom: f32 = 4*cdot(V, N)*cdot(L, N);\n\n return num / max(denom, 0.000001);\n}\n\n// Different lighting calculations for different light sources\nfn calcDirectionalLight(N: vec3, V: vec3, ior: f32, roughness: f32, metallic: f32, direction: vec3, color: vec3, base: vec3) -> PBRData { \n var L: vec3 = normalize(direction); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); // Fresnel term is replaced with 1 because it is added later\n var incoming: vec3 = color;\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5);\n\n var specular: vec3 = brdf*incoming*angle;\n // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate\n // control property for the diffuse vs specular roughness\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V); \n // Stores the specular and diffuse separately to allow for finer post processing\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// TODO: find some way to reduce the number of arguments going in here\nfn calcPointLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n var incoming: vec3 = color * (1. / (dist*dist));\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights\nfn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, direction: vec3, cones: vec2, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos);\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n \n // Cones.x is the inner phi and cones.y is the outer phi\n var theta: f32 = mdot(normalize(direction), L);\n var epsilon: f32 = cones.x - cones.y;\n var intensity: f32 = (theta - cones.y) / epsilon;\n intensity = clamp(intensity, 0.0, 1.0);\n intensity /= dist*dist;\n\n var incoming: vec3 = color * intensity;\n\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// Environment mapping stuff\n// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::TCoord::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n // Temporary ambient, diffuse, and opacity\n var ambientColor: vec4 = mapperUBO.AmbientColor;\n var diffuseColor: vec4 = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n\n // This should be declared somewhere else\n var _diffuseMap: vec4 = vec4(1);\n var _roughnessMap: vec4 = vec4(1);\n var _metallicMap: vec4 = vec4(1);\n var _normalMap: vec4 = vec4(0, 0, 1, 0); // normal map was setting off the normal vector detection in fragment\n var _ambientOcclusionMap: vec4 = vec4(1);\n var _emissionMap: vec4 = vec4(0);\n\n //VTK::Color::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Normal::Impl\n\n var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0);\n\n //VTK::Light::Impl\n\n //VTK::Select::Impl\n\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n\n return output;\n}\n';function ry(e){return e.indexOf("edge")>=0}function oy(e,t){t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=n=>{n&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==Jv.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.translucentPass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.opaquePass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.updateUBO=()=>{const n=t.WebGPUActor.getRenderable().getProperty(),r=t.UBO.getSendTime();if(e.getMTime()>r||n.getMTime()>r||t.renderable.getMTime()>r){const e=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",e.bcwc),t.UBO.setArray("BCSCMatrix",e.bcsc),t.UBO.setArray("MCWCNormals",e.normalMatrix),t.is2D){t.UBO.setValue("ZValue",t.WebGPUActor.getRenderable().getProperty().getDisplayLocation()===ey.FOREGROUND?1:0);const e=n.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setValue("SpecularIntensity",0)}else{let e=n.getAmbientColorByReference();t.UBO.setValue("AmbientIntensity",n.getAmbient()),t.UBO.setArray("AmbientColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",n.getDiffuse()),e=n.getDiffuseColorByReference(),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("Roughness",n.getRoughness()),t.UBO.setValue("BaseIOR",n.getBaseIOR()),t.UBO.setValue("Metallic",n.getMetallic()),t.UBO.setValue("NormalStrength",n.getNormalStrength()),t.UBO.setValue("Emission",n.getEmission()),t.UBO.setValue("SpecularIntensity",n.getSpecular()),e=n.getSpecularColorByReference(),t.UBO.setArray("SpecularColor",[e[0],e[1],e[2],1])}const r=n.getEdgeColorByReference?.();r&&t.UBO.setArray("EdgeColor",[r[0],r[1],r[2],1]),t.UBO.setValue("LineWidth",n.getLineWidth()),t.UBO.setValue("Opacity",n.getOpacity()),t.UBO.setValue("PropID",t.WebGPUActor.getPropID());const o=t.WebGPURenderWindow.getDevice();t.UBO.sendIfNeeded(o)}},e.haveWideLines=()=>{const e=t.WebGPUActor.getRenderable(),n=e.getProperty().getRepresentation();return!(e.getProperty().getLineWidth()<=1)&&t.primitiveType!==Yv.Verts&&(t.primitiveType!==Yv.Triangles&&t.primitiveType!==Yv.TriangleStrips||n===Zv.WIREFRAME)},e.replaceShaderPosition=(n,r,o)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position"),a.hasOutput("vertexVC")||a.addOutput("vec4","vertexVC");let i=a.getCode();t.useRendererMatrix?(i=ih.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(i=ih.substitute(i,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(i=ih.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(i=ih.substitute(i,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(a.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),i=ih.substitute(i,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),i=ih.substitute(i,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,a.setCode(i)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,n,r)=>{const o=r.getBuffer("normalMC"),a=t.WebGPUActor.getRenderable();if(o){const e=n.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",o.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",o.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",o.getArrayInformation()[0].interpolation);let t=e.getCode();t=ih.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);const r=n.getShaderDescription("fragment");t=r.getCode(),t=a.getProperty().getNormalTexture()?ih.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, mapperUBO.NormalStrength);"," normal = normalize(normal);"]).result:ih.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,r.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,n,r)=>{if(e.includes("sel"))return;const o=n.getShaderDescription("vertex");o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC");const a=t.WebGPURenderer.getRenderable(),i=n.getShaderDescription("fragment");let s=i.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||ry(e)||t.is2D||e.includes("sel"))s=ih.substitute(s,"//VTK::Light::Impl",[" var diffuse: vec3 = diffuseColor.rgb;"," var specular: vec3 = mapperUBO.SpecularColor.rgb * mapperUBO.SpecularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, mapperUBO.Opacity);"]).result,i.setCode(s);else{const e=[" var pi: f32 = 3.14159265359;"," var fragPos: vec3 = vec3(input.vertexVC.xyz);"," var V: vec3 = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," var baseColor: vec3 = _diffuseMap.rgb * diffuseColor.rgb;"," var roughness: f32 = max(0.000001, mapperUBO.Roughness * _roughnessMap.r);"," var metallic: f32 = mapperUBO.Metallic * _metallicMap.r;"," var alpha: f32 = roughness*roughness;"," var ior: f32 = mapperUBO.BaseIOR;"," var k: f32 = alpha*alpha / 2;"," var diffuse: vec3 = vec3(0.);"," var specular: vec3 = vec3(0.);"," var emission: vec3 = _emissionMap.rgb * mapperUBO.Emission;"," {"," var i: i32 = 0;"," loop {"," if !(i < rendererUBO.LightCount) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var calculated: PBRData = calcPointLight(normal, V, fragPos, ior, roughness, metallic, pos, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Directional light"," case 1 {"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var calculated: PBRData = calcDirectionalLight(normal, V, ior, roughness, metallic, dir, color, baseColor); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Spot Light"," case 2 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var cones: vec2 = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," var calculated: PBRData = calcSpotLight(normal, V, fragPos, ior, roughness, metallic, pos, dir, cones, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," var fresnel: f32 = schlickFresnelIOR(V, normal, ior, k); // Fresnel"," fresnel = min(1, fresnel);"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," var fresnelMetallic: vec3 = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," var kS: vec3 = mix(vec3(fresnel), fresnelMetallic, metallic);"," kS = min(vec3(1), kS);"," var kD: vec3 = (1.0 - kS) * (1.0 - metallic);"," var PBR: vec3 = mapperUBO.DiffuseIntensity*kD*diffuse + kS*specular;"," PBR += emission;"," computedColor = vec4(PBR, mapperUBO.Opacity);"];a.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," var diffuseIBLCoords: vec3 = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," var diffuseCoords: vec2 = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," var VreflN: vec3 = normalize(reflect(-V, normal));"," var reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," var specularCoords: vec2 = vecToRectCoord(reflectionIBLCoords);"," var diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," var level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," var specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," var specularIBLContribution: vec3 = specularIBL.rgb*rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution*kS, 0);"," var diffuseIBLContribution: vec3 = diffuseIBL.rgb*rendererUBO.BackgroundDiffuseStrength;"," diffuseIBLContribution *= baseColor * _ambientOcclusionMap.rgb;"," computedColor += vec4(diffuseIBLContribution*kD, 0);"),s=ih.substitute(s,"//VTK::Light::Impl",e).result,i.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,t,n)=>{if(ry(e)){const e=t.getShaderDescription("fragment");let n=e.getCode();return n=ih.substitute(n,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,void e.setCode(n)}const r=n.getBuffer("colorVI");if(!r)return;const o=t.getShaderDescription("vertex");o.addOutput("vec4","color",r.getArrayInformation()[0].interpolation);let a=o.getCode();a=ih.substitute(a,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,o.setCode(a);const i=t.getShaderDescription("fragment");a=i.getCode(),a=ih.substitute(a,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,i.setCode(a)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,n,r)=>{if(!r.hasAttribute("tcoord"))return;const o=n.getShaderDescription("vertex"),a=r.getBuffer("tcoord"),i=yh(a.getArrayInformation()[0].format);let s=o.getCode();o.addOutput(`vec${i}`,"tcoordVS"),s=ih.substitute(s,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,o.setCode(s);const l=n.getShaderDescription("fragment");s=l.getCode();const c=t.WebGPUActor.getRenderable(),u=e=>!!e&&e.getDimensionality()===i,d=[];(c.getProperty().getDiffuseTexture?.()?.getImageLoaded()||c.getTextures()[0]||t.colorTexture)&&(u(c.getProperty().getDiffuseTexture?.())||u(c.getTextures()[0])||u(t.colorTexture))&&d.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);"),c.getProperty().getRoughnessTexture?.()?.getImageLoaded()&&u(c.getProperty().getRoughnessTexture())&&d.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS);"),c.getProperty().getMetallicTexture?.()?.getImageLoaded()&&u(c.getProperty().getMetallicTexture())&&d.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS);"),c.getProperty().getNormalTexture?.()?.getImageLoaded()&&u(c.getProperty().getNormalTexture())&&d.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),c.getProperty().getAmbientOcclusionTexture?.()?.getImageLoaded()&&u(c.getProperty().getAmbientOcclusionTexture())&&d.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS);"),c.getProperty().getEmissionTexture?.()?.getImageLoaded()&&u(c.getProperty().getEmissionTexture())&&d.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),s=ih.substitute(s,"//VTK::TCoord::Impl",d).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("fragment");let n=e.getCode();n=ih.substitute(n,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"]).result,e.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===Zv.POINTS||t===Yv.Points?Xv.Verts:t===Yv.Lines?Xv.Lines:e===Zv.WIREFRAME?t===Yv.Triangles?Xv.LinesFromTriangles:Xv.LinesFromStrips:t===Yv.Triangles?Xv.Triangles:t===Yv.TriangleStrips?Xv.Strips:t===Yv.TriangleEdges?Xv.LinesFromTriangles:Xv.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case Xv.Triangles:return"triangle-list";case Xv.Verts:return"point-list";case Xv.Lines:default:return"line-list"}},e.buildVertexInput=()=>{const n=t.currentInput,r=t.cellArray,o=t.primitiveType;let a=t.WebGPUActor.getRenderable().getProperty().getRepresentation();const i=t.WebGPURenderWindow.getDevice();let s=!1;o===Yv.TriangleEdges&&(s=!0,a=Zv.WIREFRAME);const l=t.vertexInput,c=n.getPoints();let u;if(r){const e={hash:`R${a}P${o}${r.getMTime()}`,usage:Xv.Index,cells:r,numberOfPoints:c.getNumberOfPoints(),primitiveType:o,representation:a};u=i.getBufferManager().getBuffer(e),l.setIndexBuffer(u)}else l.setIndexBuffer(null);if(c){const e=t.WebGPUActor.getBufferShift(t.WebGPURenderer),n={hash:`${c.getMTime()}I${u.getMTime()}${e.join()}float32x4`,usage:Xv.PointArray,format:"float32x4",dataArray:c,indexBuffer:u,shift:e,packExtra:!0},r=i.getBufferManager().getBuffer(n);l.addBuffer(r,["vertexBC"])}else l.removeBufferIfPresent("vertexBC");const d=e.getUsage(a,o);if(t._usesCellNormals=!1,t.is2D||d!==Xv.Triangles&&d!==Xv.Strips)l.removeBufferIfPresent("normalMC");else{const e=n.getPointData().getNormals(),a={format:"snorm8x4",indexBuffer:u,packExtra:!0,shift:0,scale:127};if(e){a.hash=`${e.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=e,a.usage=Xv.PointArray;const t=i.getBufferManager().getBuffer(a);l.addBuffer(t,["normalMC"])}else if(o===Yv.Triangles){t._usesCellNormals=!0,a.hash=`PFN${c.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=c,a.cells=r,a.usage=Xv.NormalsFromPoints;const e=i.getBufferManager().getBuffer(a);l.addBuffer(e,["normalMC"])}else l.removeBufferIfPresent("normalMC")}let p=!1;if(t.renderable.getScalarVisibility()){const e=t.renderable.getColorMapColors();if(e&&!s){const r=t.renderable.getScalarMode();let o=!1;r!==Qv.USE_CELL_DATA&&r!==Qv.USE_CELL_FIELD_DATA&&r!==Qv.USE_FIELD_DATA&&n.getPointData().getScalars()||r===Qv.USE_POINT_FIELD_DATA||!e||(o=!0);const a={usage:Xv.PointArray,format:"unorm8x4",hash:`${o}${e.getMTime()}I${u.getMTime()}unorm8x4`,dataArray:e,indexBuffer:u,cellData:o,cellOffset:0},s=i.getBufferManager().getBuffer(a);l.addBuffer(s,["colorVI"]),p=!0}}p||l.removeBufferIfPresent("colorVI");let f=null;if(f=t.renderable.getInterpolateScalarsBeforeMapping?.()&&t.renderable.getColorCoordinates()?t.renderable.getColorCoordinates():n.getPointData().getTCoords(),f&&!s){const e=i.getBufferManager().getBufferForPointArray(f,l.getIndexBuffer());l.addBuffer(e,["tcoord"])}else l.removeBufferIfPresent("tcoord")},e.updateTextures=()=>{const e=[],n=[],r=t.renderable.getColorTextureMap?.();r&&(t.colorTexture||(t.colorTexture=Ru.newInstance({label:"polyDataColor"})),t.colorTexture.setInputData(r),n.push(["Diffuse",t.colorTexture]));const o=t.WebGPUActor.getRenderable(),a=t.WebGPURenderer.getRenderable(),i=[];if(o.getProperty().getDiffuseTexture?.()){const e=["Diffuse",o.getProperty().getDiffuseTexture()];i.push(e)}if(o.getTextures()[0]){const e=["Diffuse",o.getTextures()[0]];i.push(e)}if(t.colorTexture){const e=["Diffuse",t.colorTexture];i.push(e)}if(o.getProperty().getRoughnessTexture?.()){const e=["Roughness",o.getProperty().getRoughnessTexture()];i.push(e)}if(o.getProperty().getMetallicTexture?.()){const e=["Metallic",o.getProperty().getMetallicTexture()];i.push(e)}if(o.getProperty().getNormalTexture?.()){const e=["Normal",o.getProperty().getNormalTexture()];i.push(e)}if(o.getProperty().getAmbientOcclusionTexture?.()){const e=["AmbientOcclusion",o.getProperty().getAmbientOcclusionTexture()];i.push(e)}if(o.getProperty().getEmissionTexture?.()){const e=["Emission",o.getProperty().getEmissionTexture()];i.push(e)}if(a.getEnvironmentTexture?.()){const e=["Environment",a.getEnvironmentTexture()];i.push(e)}for(let e=0;e=0;n--)e[n]||(t.textures.splice(n,1),t.textureViews.splice(n,1))},e.computePipelineHash=()=>{let n=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.primitiveType===Yv.TriangleEdges||t.primitiveType===Yv.TriangleStripEdges)n+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(n+="n"),t.vertexInput.hasAttribute("colorVI")&&(n+="c"),t.vertexInput.hasAttribute("tcoord")){const e=t.vertexInput.getBuffer("tcoord");n+=`t${yh(e.getArrayInformation()[0].format)}`}t.textures.length&&(n+=`tx${t.textures.length}`)}t._usesCellNormals&&(n+="cn"),t.SSBO&&(n+="ssbo"),n+=e.getHashFromUsage(t.usage),n+=t.renderEncoder.getPipelineHash(),t.pipelineHash=n},e.updateBuffers=()=>{t.primitiveType!==Yv.TriangleEdges&&t.primitiveType!==Yv.TriangleStripEdges&&e.updateTextures();const n=t.WebGPUActor.getRenderable(),r=n.getProperty().getRepresentation();t.usage=e.getUsage(r,t.primitiveType),e.buildVertexInput();const o=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(o.getSizeInBytes()/o.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){const t=n.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}const ay={is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function iy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ay,n),Dh.extend(e,t,n),t.fragmentShaderTemplate=ny,t.vertexShaderTemplate=ty,t._tmpMat3=pe(new Float64Array(9)),t._tmpMat4=g(new Float64Array(16)),t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),At(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],oy(e,t)}var sy={newInstance:Et(iy,"vtkWebGPUCellArrayMapper"),extend:iy};const{PrimitiveTypes:ly}=fv;function cy(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>sy.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=ly.Points;i<=ly.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility())for(let a=ly.TriangleEdges;a<=ly.TriangleStripEdges;a++)if(r[a-2].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const i=t.primitives[a];i.setCellArray(r[a-2]),i.setCurrentInput(n),i.setCellOffset(t.primitives[a-2].getCellOffset()),i.setPrimitiveType(a),i.setRenderable(t.renderable),o.push(i)}else t.primitives[a]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}const uy={primitives:null};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uy,n),Zt.extend(e,t,n),t.primitives=[],cy(e,t)}const py=Et(dy,"vtkWebGPUPolyDataMapper");var fy={newInstance:py,extend:dy};Um("vtkMapper",py);const{PrimitiveTypes:gy}=fv;function my(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>sy.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=gy.Points;i<=gy.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),s.setIs2D(!0),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}function hy(e){return{primitives:[],...e}}const vy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hy(n)),Zt.extend(e,t,n),t.primitives=[],my(e,t)}),"vtkWebGPUPolyDataMapper2D");function yy(e,t){t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Um("vtkMapper2D",vy);const by={};const xy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,by,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Gp.newScalarBarActorHelper(),yy(e,t)}),"vtkWebGPUScalarBarActor");function Ty(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}Um("vtkScalarBarActor",xy);const Cy={device:null,handle:null,label:null,options:null};function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cy,n),jt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","options"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),Ty(e,t)}var Ay={newInstance:jt.newInstance(Sy),extend:Sy};function Py(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=hh(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=hh(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=Ay.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const Iy={texture:null,handle:null,sampler:null,label:null};function wy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iy,n),jt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","texture"]),jt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Py(e,t)}var Oy={newInstance:jt.newInstance(wy),extend:wy};const{BufferUsage:My}=fv;function Ry(e,t){t.classHierarchy.push("vtkWebGPUTexture"),e.create=(e,n)=>{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=hh(t.format);let a=t.width*o.stride;const i=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,a=2===o.elementSize&&"float"===o.sampleType;if(a||r%256){const i=e,s=r/i.BYTES_PER_ELEMENT,l=o.elementSize,c=256*Math.floor((s*l+255)/256),u=c/l,d=jt.newTypedArray(a?"Uint16Array":i.constructor.name,u*t*n);for(let e=0;e{const e=hh(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>hh(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Oy.newInstance({label:n});return o.create(e,r),o}}const Vy={device:null,handle:null,buffer:null,ready:!1,label:null};function Ey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),jt.obj(e,t),jt.get(e,t,["handle","ready","width","height","depth","format","usage"]),jt.setGet(e,t,["device","label"]),Ry(e,t)}var Dy={newInstance:jt.newInstance(Ey),extend:Ey};function Ly(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DCellArrayMapper");const n={...e};e.setGlyphInstances=e=>{t.glyphInstances=e},e.updateBuffers=()=>{n.updateBuffers(),e.setNumberOfInstances(t.glyphInstances)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),r.addBuiltinOutput("vec4","@builtin(position) Position"),r.hasOutput("vertexVC")||r.addOutput("vec3","vertexVC");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" var vertexSC: vec4 = mapperUBO.BCSCMatrix*glyphSSBO.values[input.instanceIndex].matrix*vertexBC;"," output.vertexVC = (rendererUBO.SCVCMatrix*vertexSC).xyz;"," output.Position = rendererUBO.SCPCMatrix*vertexSC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,t,r)=>{if(r.hasAttribute("normalMC")){const e=t.getShaderDescription("vertex");let n=e.getCode();n=ih.substitute(n,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals"," * mapperUBO.MCWCNormals"," * glyphSSBO.values[input.instanceIndex].normal*normalMC).xyz);"]).result,e.setCode(n)}n.replaceShaderNormal(e,t,r)},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderColor=(e,r,o)=>{if(!t.renderable.getColorArray())return void n.replaceShaderColor(e,r,o);const a=r.getShaderDescription("vertex");a.addOutput("vec4","color");let i=a.getCode();i=ih.substitute(i,"//VTK::Color::Impl",[" output.color = glyphSSBO.values[input.instanceIndex].color;"]).result,a.setCode(i);const s=r.getShaderDescription("fragment");i=s.getCode(),i=ih.substitute(i,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("vertex");e.addOutput("u32","compositeID","flat");let n=e.getCode();n=ih.substitute(n,"//VTK::Select::Impl",[" output.compositeID = input.instanceIndex;"]).result,e.setCode(n);const r=t.getShaderDescription("fragment");n=r.getCode(),n=ih.substitute(n,"//VTK::Select::Impl",["var compositeID: u32 = input.compositeID;"]).result,r.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect)}const By=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,{},n),sy.extend(e,t,n),Ly(e,t)}),"vtkWebGPUGlyph3DCellArrayMapper");function Ny(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DMapper"),e.createCellArrayMapper=()=>{const e=By();return e.setSSBO(t.SSBO),e.setRenderable(t.renderable),e},e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData(1);t.renderable.mapScalars(n,1),e.updateSSBO(),e.updateCellArrayMappers(n);for(let e=0;e{t.currentInput=t.renderable.getInputData(1),t.renderable.buildArrays();const n=t.renderable.getMatrixArray(),r=t.renderable.getNormalArray();if(t.carray=t.renderable.getColorArray(),t.numInstances=n.length/16,t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.WebGPURenderWindow=e.getFirstAncestorOfType("vtkWebGPURenderWindow");const o=t.WebGPURenderWindow.getDevice();t.SSBO.clearData(),t.SSBO.setNumberOfInstances(t.numInstances),t.SSBO.addEntry("matrix","mat4x4"),t.SSBO.addEntry("normal","mat4x4"),t.carray&&t.SSBO.addEntry("color","vec4"),t.SSBO.setAllInstancesFromArray("matrix",n),t.SSBO.setAllInstancesFromArray3x3To4x4("normal",r),t.carray&&t.SSBO.setAllInstancesFromArrayColorToFloat("color",t.carray.getData()),t.SSBO.send(o),t.glyphBOBuildTime.modified()}}}const ky={};const Fy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ky,n),fy.extend(e,t,n),t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),t.SSBO=bv.newInstance({label:"glyphSSBO"}),Ny(e,t)}),"vtkWebGPUGlyph3DMapper");Um("vtkGlyph3DMapper",Fy);const{SlicingMode:_y}=bg,Gy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",Uy=new Float64Array(16),Wy=new Float64Array(16),zy=new Float64Array(16),Hy=new Float64Array(4),jy=new Float64Array(4);function Ky(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();g(Uy),x(Uy,Uy,n);const a=r.getMatrix();m(Wy,a),h(Wy,Wy),b(Uy,Wy,Uy);const i=e.getWorldToIndex();b(Uy,i,Uy),h(zy,Uy),I(Wy,[.5,.5,.5]),b(Uy,Wy,Uy);const s=e.getDimensions();g(Wy),T(Wy,Wy,[1/s[0],1/s[1],1/s[2]]),b(Uy,Wy,Uy),t.UBO.setArray("SCTCMatrix",Uy);const l=t.currentInput.getExtent(),{ijkMode:c}=t.renderable.getClosestIJKAxis();let u=t.renderable.getSlice();c!==t.renderable.getSlicingMode()&&(u=t.renderable.getSliceAtPosition(u));let d=2,p=0,f=1;c===_y.I?(d=0,p=1,f=2):c===_y.J&&(d=1,p=2,f=0),Hy[d]=u,Hy[p]=l[2*p]-.5,Hy[f]=l[2*f]-.5,Hy[3]=1,zi(Hy,Hy,zy),t.UBO.setArray("Origin",Hy),jy[d]=u,jy[p]=l[2*p+1]+.5,jy[f]=l[2*f]-.5,jy[3]=1,zi(jy,jy,zy),Wi(jy,jy,Hy),jy[3]=1,t.UBO.setArray("Axis1",jy),jy[d]=u,jy[p]=l[2*p]-.5,jy[f]=l[2*f+1]+.5,jy[3]=1,zi(jy,jy,zy),Wi(jy,jy,Hy),jy[3]=1,t.UBO.setArray("Axis2",jy);const v=[1,1,1,1],y=[0,0,0,0],C=t.textureViews[0],S=C.getTexture().getScale(),A=C.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let a=0;a<1;a++){o=n.getRGBTransferFunction(a);const i=o.getRange();o.getTable(i[0],i[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const a=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===dg.NEAREST?"nearest":"linear";t.clampSampler&&a===t.clampSampler.getOptions().minFilter||(t.clampSampler=Ay.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:a,magFilter:a}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let a=o.getCode();const i=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?i.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):i.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),i.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),a=ih.substitute(a,"//VTK::Position::Impl",i).result,o.setCode(a)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();t.dimensions,a=ih.substitute(a,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,a=ih.substitute(a,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(a)},r.set("replaceShaderImage",e.replaceShaderImage)}const $y={rowLength:1024};const qy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$y,n),kh.extend(e,t,n),e.setFragmentShaderTemplate(Gy),t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},yt(t.lutBuildTime,{mtime:0}),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},yt(t.VBOBuildTime),Ky(e,t)}),"vtkWebGPUImageMapper");function Xy(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Um("vtkImageMapper",qy);const Yy={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Zy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yy,n),Zt.extend(e,t,n),t.keyMatricesTime={},yt(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},t.bufferShift=[0,0,0,0],xt(e,t,["propID","keyMatricesTime"]),Xy(e,t)}),"vtkWebGPUImageSlice");function Qy(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const a=t.renderable.getMapper().getInputData();if(!a)return;const i=a.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=i[t];for(let t=2;t<4;t++){n[1]=i[t];for(let t=0;t<2;t++){n[0]=i[t],a.indexToWorld(n,r);let c=o+3*l;e[c++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[c++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[c++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();m(t.keyMatrices.bcwc,n),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Um("vtkImageSlice",Zy);const Jy={propID:void 0,keyMatricesTime:null};const eb=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jy,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),Qy(e,t)}),"vtkWebGPUVolume");function tb(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),a=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,i=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,null)}}Um("vtkVolume",eb);const nb={};const rb=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nb,n),Zt.extend(e,t,n),tb(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");Um("vtkPixelSpaceCallbackMapper",rb);const{BufferUsage:ob}=fv,{vtkErrorMacro:ab}=Kt,ib="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3 = normalize(-vertexVC.xyz);\n var base2: vec3 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n var base1: vec3 = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2 = vertexVC.xy + offsetMC;\n vertexVC = vec4(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vec4(vertexVC.xyz, 0.0);\n\n //VTK::Position::Impl\n\n return output;\n}\n";function sb(e,t){t.classHierarchy.push("vtkWebGPUSphereMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("f32","radiusVC");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=ih.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n var invertedDepth: f32 = 1.0;\n if (rendererUBO.cameraParallel != 0u) {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0) {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n // find the intersection\n var b: f32 = 2.0*dot(EyePos,EyeDir);\n var c: f32 = dot(EyePos,EyePos) - 1.0;\n var d: f32 = b*b - 4.0*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else {\n var t: f32 = (-b - invertedDepth*sqrt(d))*0.5;\n\n // compute the normal, for unit sphere this is just\n // the intersection point\n normal = invertedDepth*normalize(EyePos + t*EyeDir);\n // compute the intersection point in VC\n vertexVC = vec4(normal * input.radiusVC + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="spm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=n.getPoints(),o=r.getNumberOfPoints(),a=r.getData();e.setNumberOfInstances(1),e.setNumberOfVertices(3*o);const i=t.vertexInput;let s=`spm${r.getMTime()}float32x3`;if(!t.device.getBufferManager().hasBuffer(s)){const e={hash:s,usage:ob.RawVertex,format:"float32x3"},n=new Float32Array(3*o*3);let r=0,l=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lb,n),sy.extend(e,t,n),e.setVertexShaderTemplate(ib),sb(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUSphereMapper");Um("vtkSphereMapper",cb);const{BufferUsage:ub}=fv,{vtkErrorMacro:db}=Kt,pb="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array, 12> = array, 12>(\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(-1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n vec3(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3;\n var ybase: vec3;\n var dir: vec3 = vec3(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3 = offsetsArray[vertIdx];\n\n vertexVC = vec4(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n";function fb(e,t){t.classHierarchy.push("vtkWebGPUStickMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("vec3","orientVC"),r.addOutput("f32","radiusVC"),r.addOutput("f32","lengthVC"),r.addBuiltinInput("u32","@builtin(vertex_index) vertexIndex");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=ih.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n\n if (rendererUBO.cameraParallel != 0u)\n {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else\n {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0)\n {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n\n // rotate to new basis\n // base1, base2, orientVC\n var base1: vec3;\n if (abs(input.orientVC.z) < 0.99)\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,0.0,1.0)));\n }\n else\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,1.0,0.0)));\n }\n var base2: vec3 = cross(input.orientVC,base1);\n EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,input.orientVC));\n EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,input.orientVC));\n\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n\n // find the intersection\n var a: f32 = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n var b: f32 = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n var c: f32 = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n var d: f32 = b*b - 4.0*a*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else\n {\n var t: f32 = (-b - sqrt(d))*(0.5 / a);\n var tz: f32 = EyePos.z + t*EyeDir.z;\n var iPoint: vec3 = EyePos + t*EyeDir;\n if (abs(iPoint.z)*input.radiusVC > input.lengthVC*0.5)\n {\n // test for end cap\n var t2: f32 = (-b + sqrt(d))*(0.5 / a);\n var tz2: f32 = EyePos.z + t2*EyeDir.z;\n if (tz2*input.radiusVC > input.lengthVC*0.5 || tz*input.radiusVC < -0.5*input.lengthVC) { discard; }\n else\n {\n normal = input.orientVC;\n var t3: f32 = (input.lengthVC*0.5/input.radiusVC - EyePos.z)/EyeDir.z;\n iPoint = EyePos + t3*EyeDir;\n vertexVC = vec4(input.radiusVC*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n else\n {\n // The normal is the iPoint.xy rotated back into VC\n normal = iPoint.x*base1 + iPoint.y*base2;\n // rescale rerotate and translate\n vertexVC = vec4(input.radiusVC*(normal + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="stm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=t.device,o=n.getPoints(),a=n.getPointData(),i=o.getNumberOfPoints(),s=o.getData();e.setNumberOfInstances(i),e.setNumberOfVertices(12);const l=t.vertexInput;let c=`stm${o.getMTime()}float32x3`;if(!r.getBufferManager().hasBuffer(c)){const e={hash:c,usage:ub.RawVertex,format:"float32x3"},t=new Float32Array(3*i);let n=0,o=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gb,n),sy.extend(e,t,n),e.setVertexShaderTemplate(pb),fb(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUStickMapper");Um("vtkStickMapper",mb);var hb=Uint8Array,vb=Uint16Array,yb=Uint32Array,bb=new hb([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,0,0,0]),xb=new hb([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,0,0]),Tb=new hb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cb=function(e,t){for(var n=new vb(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Mb)<<1;Rb=(61680&(Rb=(52428&Rb)>>>2|(13107&Rb)<<2))>>>4|(3855&Rb)<<4,Ob[Mb]=((65280&Rb)>>>8|(255&Rb)<<8)>>>1}var Vb=function(e,t,n){for(var r=e.length,o=0,a=new vb(t);o>>l]=c}else for(i=new vb(r),o=0;o>>15-e[o]);return i},Eb=new hb(288);for(Mb=0;Mb<144;++Mb)Eb[Mb]=8;for(Mb=144;Mb<256;++Mb)Eb[Mb]=9;for(Mb=256;Mb<280;++Mb)Eb[Mb]=7;for(Mb=280;Mb<288;++Mb)Eb[Mb]=8;var Db=new hb(32);for(Mb=0;Mb<32;++Mb)Db[Mb]=5;var Lb=Vb(Eb,9,1),Bb=Vb(Db,5,1),Nb=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},kb=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Fb=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},_b=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?vb:4==e.BYTES_PER_ELEMENT?yb:hb)(n-t);return r.set(e.subarray(t,n)),r},Gb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ub=function(e,t,n){var r=new Error(t||Gb[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ub),!n)throw r;return r},Wb=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new hb(0);var o=!t||n,a=!n||n.i;n||(n={}),t||(t=new hb(3*r));var i,s=function(e){var n=t.length;if(e>n){var r=new hb(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,c=n.p||0,u=n.b||0,d=n.l,p=n.d,f=n.m,g=n.n,m=8*r;do{if(!d){l=kb(e,c,1);var h=kb(e,c+1,3);if(c+=3,!h){var v=e[(i=c,(O=4+((i+7)/8|0))-4)]|e[O-3]<<8,y=O+v;if(y>r){a&&Ub(0);break}o&&s(u+v),t.set(e.subarray(O,y),u),n.b=u+=v,n.p=c=8*y,n.f=l;continue}if(1==h)d=Lb,p=Bb,f=9,g=5;else if(2==h){var b=kb(e,c,31)+257,x=kb(e,c+10,15)+4,T=b+kb(e,c+5,31)+1;c+=14;for(var C=new hb(T),S=new hb(19),A=0;A>>4)<16)C[A++]=O;else{var R=0,V=0;for(16==O?(V=3+kb(e,c,3),c+=2,R=C[A-1]):17==O?(V=3+kb(e,c,7),c+=3):18==O&&(V=11+kb(e,c,127),c+=7);V--;)C[A++]=R}}var E=C.subarray(0,b),D=C.subarray(b);f=Nb(E),g=Nb(D),d=Vb(E,f,1),p=Vb(D,g,1)}else Ub(1);if(c>m){a&&Ub(0);break}}o&&s(u+131072);for(var L=(1<>>4;if((c+=15&R)>m){a&&Ub(0);break}if(R||Ub(2),k<256)t[u++]=k;else{if(256==k){N=c,d=null;break}var F=k-254;if(k>264){var _=bb[A=k-257];F=kb(e,c,(1<<_)-1)+Ab[A],c+=_}var G=p[Fb(e,c)&B],U=G>>>4;if(G||Ub(3),c+=15&G,D=wb[U],U>3&&(_=xb[U],D+=Fb(e,c)&(1<<_)-1,c+=_),c>m){a&&Ub(0);break}o&&s(u+131072);for(var W=u+F;u>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new hb((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function jb(e,t){return Wb(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&Ub(6,"invalid zlib data"),32&n[1]&&Ub(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function Kb(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?Hb(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return Wb(e,t)}(e,t):jb(e,t)}var $b="undefined"!=typeof TextDecoder&&new TextDecoder;try{$b.decode(zb,{stream:!0})}catch(e){}function qb(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,_b(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=o[0];return o[1].length&&Ub(8),a}function Xb(){const e=new ArrayBuffer(4),t=new Uint8Array(e),n=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===n[0]?"LittleEndian":2712847316===n[0]?"BigEndian":null}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var Yb=Xb(),Zb=function(e,t){if(t<2)return;const n=new Int8Array(e),r=n.length,o=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Qb[e](t)};const{vtkErrorMacro:nx,vtkDebugMacro:rx}=jt;let ox=0;function ax(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const ix={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,a)=>{let i=null;i=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=ax("GET",i,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++ox&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=qb(Kb(new Uint8Array(n.buffer))):n.buffer=Kb(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Yb!==n.ref.encode&&Yb&&(rx(`Swap bytes of ${n.name}`),Zb(n.buffer,Is[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&nx(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const a=ax("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++ox&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(JSON.parse(qb(Kb(new Uint8Array(a.response))))):r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(nx("Supported algorithms are: [gz]"),nx(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const a=ax("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++ox&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--ox&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(qb(Kb(new Uint8Array(a.response)))):r(a.responseText):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(nx("Supported algorithms are: [gz]"),nx(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=ax("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(Kb(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};ex("http",(e=>ix));const sx={DEFAULT:0,GEOMETRY:1,SLICE:2,VOLUME:3,YZ_PLANE:4,XZ_PLANE:5,XY_PLANE:6},lx={PICKING_BUFFER:0,FRONT_BUFFER:1};var cx={ViewTypes:sx,RenderingTypes:lx,CaptureOn:{MOUSE_MOVE:0,MOUSE_RELEASE:1}};const ux=0,dx=1,px=2,fx="translateAxis",gx="rotateLine",mx="translateCenter",hx="translateCenterAndUpdatePlanes",vx=(sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE,["X","Y","Z"]),yx={[sx.YZ_PLANE]:"X",[sx.XZ_PLANE]:"Y",[sx.XY_PLANE]:"Z"},bx={X:sx.YZ_PLANE,Y:sx.XZ_PLANE,Z:sx.XY_PLANE};function xx(e,t,n){const r=[...e];return qf().rotate(n,t).apply(r),r}function Tx(e){return e[0]}function Cx(e){return e[3]}function Sx(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vx;const t=[];return e.forEach((n=>{e.forEach((e=>{n!==e&&t.push(`${n}in${e}`)}))})),t}function Ax(e,t){const n=Tx(t),r=Cx(t),o=function(e){return Object.keys(e.getPlanes()).map((e=>yx[e]))}(e).find((e=>e!==n&&e!==r));return`${o}in${r}`}function Px(e,t,n,r){return Ko([...e],t*(r?1:n)/2)}function Ix(e,t,n){const r=Object.keys(e.getPlanes()).map((e=>yx[e])),o=r.reduce(((t,n)=>(r.filter((e=>n!==e)).forEach((r=>{const o=Yo(e.getPlanes()[bx[n]].normal,e.getPlanes()[bx[r]].normal,[]);t[`${n}${r}`]=o,t[`${r}${n}`]=o})),t)),{}),a=e.getImage().getBounds(),i=e.getCenter(),s=Ui.getDiagonalLength(a);e.getCenterHandle().setOrigin(i),Sx(r).forEach((r=>{const a=Tx(r),l=Cx(r),c=o[`${a}${l}`];e[`getRotationHandle${r}0`]().setOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal),e[`getRotationHandle${r}0`]().setOffset(Px(c,n,s,t)),e[`getRotationHandle${r}1`]().setOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal),e[`getRotationHandle${r}1`]().setOffset(Px(c,-n,s,t));const u=e[`getAxis${r}`]();u.setOrigin(i),u.getManipulator()?.setHandleOrigin(i),u.getManipulator()?.setHandleNormal(e.getPlanes()[bx[a]].normal);const d=Qo(c),p=u.getScale3();p[2]=2*d,u.setScale3(p);const f=e.getPlanes()[bx[l]].normal,g=Yo(c,f,[]);u.setRight(f),u.setUp(g),u.setDirection(c)}))}function wx(e,t){t.classHierarchy.push("vtkAbstractManipulator"),e.getOrigin=e=>t.userOrigin?t.userOrigin:t.useCameraFocalPoint?e.pokedRenderer.getActiveCamera().getFocalPoint():t.handleOrigin?t.handleOrigin:t.widgetOrigin?t.widgetOrigin:[0,0,0],e.getNormal=e=>t.userNormal?t.userNormal:t.useCameraNormal?e.pokedRenderer.getActiveCamera().getDirectionOfProjection():t.handleNormal?t.handleNormal:t.widgetNormal?t.widgetNormal:[0,0,1]}const Ox={useCameraFocalPoint:!1,useCameraNormal:!1};function Mx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ox,n),jt.obj(e,t),jt.setGet(e,t,["useCameraFocalPoint","useCameraNormal"]),jt.setGetArray(e,t,["userOrigin","handleOrigin","widgetOrigin","userNormal","handleNormal","widgetNormal"],3),wx(e,t)}var Rx={extend:Mx,newInstance:jt.newInstance(Mx,"vtkAbstractManipulator")};function Vx(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ri.intersectWithLine(i,s,n,r).x}function Ex(e,t){t.classHierarchy.push("vtkCPRManipulator"),e.handleEvent=(n,r)=>{const o=t.cprActor?.getMapper();if(!o)return{worldCoords:null};const a=[];m(a,t.cprActor.getMatrix());const i=a.slice(8,11),s=a.slice(12,15),l=[];h(l,a);const c=[];Ln(c,Vx(n.position.x,n.position.y,s,i,n.pokedRenderer,r),l);const u=o.getHeight()-c[1];return e.distanceEvent(u)},e.distanceEvent=e=>{const n=t.cprActor?.getMapper();if(!n)return{worldCoords:null};const r=n.getHeight(),o=Math.max(0,Math.min(r,e)),{position:a,orientation:i}=n.getCenterlinePositionAndOrientation(o);let s;if(i){const e=Pe([],i),t=n.getDirectionMatrix();s=Ne([],e,t)}return t.currentDistance=o,{worldCoords:a,worldDirection:s}},e.handleScroll=n=>{const r=t.currentDistance+e.getDistanceStep()*n;return e.distanceEvent(r)},e.getDistanceStep=()=>{if(!t.distanceStep){const e=t.cprActor?.getMapper()?.getInputData(0)?.getSpacing?.();if(e)return Math.min(...e)}return t.distanceStep}}function Dx(e){return{distanceStep:0,currentDistance:0,cprActor:null,...e}}function Lx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Rx.extend(e,t,Dx(n)),jt.setGet(e,t,["distance","currentDistance","cprActor"]),jt.set(e,t,["distanceStep"]),Ex(e,t)}var Bx={intersectDisplayWithPlane:Vx,extend:Lx,newInstance:jt.newInstance(Lx,"vtkCPRManipulator")};const{vtkDebugMacro:Nx}=jt;function kx(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),a=g(new Float64Array(16)),i=g(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),c=new Float64Array(3),u=g(new Float64Array(16)),p=g(new Float64Array(16)),f=new Float64Array(3),v=new Float64Array(3);function y(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Nx("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Nx("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,y()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,a=t.viewUp,i=new Float64Array([a[0],a[1],a[2],0]);g(u);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);C(u,u,Eo(n),s),zi(i,i,u),t.viewUp[0]=i[0],t.viewUp[1]=i[1],t.viewUp[2]=i[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;g(p),x(p,p,r),C(p,p,Eo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Ln(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.yaw=n=>{const r=t.position;g(p),x(p,p,r),C(p,p,Eo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Ln(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),a=[-o[0],-o[1],-o[2]];g(p),x(p,p,r),C(p,p,Eo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Ln(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),a=[o[0],o[1],o[2]];g(p),x(p,p,r),C(p,p,Eo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Ln(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const a=[n,r,o];Ho(t.position,a,t.position),Ho(t.focalPoint,a,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],a=[],i=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],zi(o,[...t.position,1],n),zi(a,[...t.focalPoint,1],n),zi(i,r,n),i[0]-=o[0],i[1]-=o[1],i[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...a.slice(0,3)),e.setViewUp(...i.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Nx("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Nx("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(d(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{d(a,e.getViewMatrix()),h(a,a),w(i,[t.distance,t.distance,t.distance]),b(a,a,i),g(t.cameraLightTransform),x(t.cameraLightTransform,a,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Yi(e[0],e[1],e[2],e[3]),n=Hi(),r=Yi(0,0,1,0);var o,a;return a=t,(o=n)[0]=-a[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],Ki(r,t,r),Ki(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),h(t,t)},e.getWorldToPhysicalMatrix=e=>{g(e);const n=[3];Yo(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],m(e,e),Pn(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),T(e,e,s),x(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=i=>{h(a,i),Ln(s,n,a),e.computeDistance();const u=t.distance;e.setPosition(s[0],s[1],s[2]),Ln(l,r,a),wn(l,l,s),Vn(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Ln(c,o,a),wn(c,c,s),Vn(c,c),e.setViewUp(c[0],c[1],c[2]),e.setDistance(u)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(a),b(a,t,a),e.computeViewParametersFromViewMatrix(a)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(d(a,t.viewMatrix),e.computeViewParametersFromViewMatrix(a),m(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;q(a,t.position,t.focalPoint,t.viewUp),m(a,a);const e=new Float64Array(16);return d(e,a),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(g(o),t.projectionMatrix){const e=1/t.physicalScale;return Pn(s,e,e,e),d(o,t.projectionMatrix),T(o,o,s),m(o,o),o}g(a);const i=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*i/2,t.clippingRange[0]+(r+1)*i/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,i=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,c=(t.windowCenter[1]+1)*r;K(a,o,i,s,c,l[0],l[1]),m(a,a)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(Eo(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const i=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,c=(t.windowCenter[1]-1)*o,u=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];a[0]=2*d/(s-i),a[5]=2*d/(u-c),a[2]=(i+s)/(s-i),a[6]=(c+u)/(u-c),a[10]=-(d+p)/(p-d),a[14]=-1,a[11]=-2*d*p/(p-d),a[15]=0}}return d(o,a),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),a=e.getProjectionMatrix(t,n,r);return b(a,o,a),a},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,y()},e.setDeviceAngles=(n,r,o,a)=>{const i=[3];Yo(t.physicalViewNorth,t.physicalViewUp,i);const s=g(new Float64Array(16));C(s,s,Eo(n),t.physicalViewUp),C(s,s,Eo(r),i),C(s,s,Eo(o),t.physicalViewNorth),C(s,s,Eo(-a),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),c=new Float64Array(t.physicalViewNorth);Ln(l,l,s),Ln(c,c,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(c[0],c[1],c[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const a=g(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=Eo(t),i=Hi();ji(i,[n,r,o],e),_(a,i)}const i=new Float64Array(3);Ln(i,[0,0,-1],a);const s=new Float64Array(3);Ln(s,[0,1,0],a),e.setDirectionOfProjection(...i),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],a=-n[1],i=-n[2],s=-(o*r[0]+a*r[1]+i*r[2]),l=[o*e[0]+a*e[2]+i*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const c=o*e[r]+a*e[2+n]+i*e[4+t]+s;l[0]=cl[1]?c:l[1]}return l}}const Fx={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:c(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function _x(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fx,n),jt.obj(e,t),jt.get(e,t,["distance"]),jt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),jt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),jt.setGetArray(e,t,["clippingRange","windowCenter"],2),jt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),kx(e,t)}var Gx={newInstance:jt.newInstance(_x,"vtkCamera"),extend:_x};function Ux(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Ln(n,t.position,t.transformMatrix):Pn(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Ln(n,t.focalPoint,t.transformMatrix):Pn(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);_n(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=Eo(t),o=Eo(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Wx={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function zx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wx,n),jt.obj(e,t),jt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),jt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Ux(e,t)}var Hx={newInstance:jt.newInstance(zx,"vtkLight"),extend:zx,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:jx}=jt;function Kx(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>jx("call displayToView on your view instead"),e.viewToDisplay=()=>jx("callviewtodisplay on your view instead"),e.getSize=()=>jx("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>jx("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const $x={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function qx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$x,n),jt.obj(e,t),jt.event(e,t,"event"),jt.setGetArray(e,t,["viewport"],4),jt.setGetArray(e,t,["background","background2"],3),Kx(e,t)}var Xx={newInstance:jt.newInstance(qx,"vtkViewport"),extend:qx};const{vtkDebugMacro:Yx,vtkErrorMacro:Zx,vtkWarningMacro:Qx}=Kt;function Jx(e){return()=>Zx(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function eT(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(Yx("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(c())):Zx("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Jx("allocateTime"),e.updateGeometry=Jx("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{Yx(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Gx.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Hx.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let a=e.normalizedDisplayToProjection(t,n,r);return a=e.projectionToView(a[0],a[1],a[2],o),e.viewToWorld(a[0],a[1],a[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let a=e.worldToView(t,n,r);return a=e.viewToProjection(a[0],a[1],a[2],o),e.projectionToNormalizedDisplay(a[0],a[1],a[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return Zx("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o),m(o,o);const a=new Float64Array([e,n,r]);return Ln(a,a,o),a},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return Zx("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);h(a,a),m(a,a);const i=new Float64Array([e,n,r]);return Ln(i,i,a),i},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return Zx("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o);const a=new Float64Array([e,n,r]);return Ln(a,a,o),a},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return Zx("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);m(a,a);const i=new Float64Array([e,n,r]);return Ln(i,i,a),i},e.computeVisiblePropBounds=()=>{t.allBounds[0]=Ui.INIT_BOUNDS[0],t.allBounds[1]=Ui.INIT_BOUNDS[1],t.allBounds[2]=Ui.INIT_BOUNDS[2],t.allBounds[3]=Ui.INIT_BOUNDS[3],t.allBounds[4]=Ui.INIT_BOUNDS[4],t.allBounds[5]=Ui.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(Ra(t.allBounds),Yx("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),a=[0,0,0];if(!Va(r))return Yx("Cannot reset camera!"),!1;let i=null;if(!e.getActiveCamera())return Zx("Trying to reset non-existent camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),a[0]=(r[0]+r[1])/2,a[1]=(r[2]+r[3])/2,a[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],c=r[5]-r[4];s*=s,l*=l,c*=c;let u=s+l+c;u=0===u?1:u,u=.5*Math.sqrt(u);const d=Eo(t.activeCamera.getViewAngle()),p=u,f=u/Math.sin(.5*d),g=t.activeCamera.getViewUp();return Math.abs(Xo(g,i))>.999&&(Qx("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-g[2],g[0],g[1])),t.activeCamera.setFocalPoint(a[0],a[1],a[2]),t.activeCamera.setPosition(a[0]+f*i[0],a[1]+f*i[1],a[2]+f*i[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(u),t.activeCamera.setPhysicalTranslation(-a[0],-a[1],-a[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!Va(o))return Yx("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return Zx("Trying to reset clipping range of non-existent camera"),!1;const a=t.activeCamera.computeClippingRange(o);let i=0;if(t.activeCamera.getParallelProjection())i=.2*t.activeCamera.getParallelScale();else{const e=Eo(t.activeCamera.getViewAngle());i=.2*Math.tan(e/2)*a[1]}return a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const tT={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:_a(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function nT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,tT,n),Xx.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),xt(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),At(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Pt(e,t,["actors","volumes","lights"]),wt(e,t,["background"],4,1),Ot(0,t,["renderWindow"]),eT(e,t)}var rT={newInstance:Et(nT,"vtkRenderer"),extend:nT};const oT=Object.create(null);function aT(e,t){oT[e]=t}function iT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return oT[e]&&oT[e](t)}function sT(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return iT(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const lT={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function cT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lT,n),jt.obj(e,t),jt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),jt.get(e,t,["neverRendered"]),jt.getArray(e,t,["renderers"]),jt.moveToProtected(e,t,["views"]),jt.event(e,t,"completion"),sT(e,t)}var uT={newInstance:jt.newInstance(cT,"vtkRenderWindow"),extend:cT,registerViewConstructor:aT,listViewAPIs:function(){return Object.keys(oT)},newAPISpecificView:iT};const dT={Unknown:0,LeftController:1,RightController:2},pT={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var fT={Device:dT,Input:pT,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:gT,Input:mT}=fT,{vtkWarningMacro:hT,vtkErrorMacro:vT,normalizeWheel:yT,vtkOnceErrorMacro:bT}=jt,xT={ctrlKey:!1,altKey:!1,shiftKey:!1},TT={"xr-standard":[mT.Trigger,mT.Grip,mT.TrackPad,mT.Thumbstick,mT.A,mT.B]},CT=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function ST(e){e.cancelable&&e.preventDefault()}function AT(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function PT(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function a(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{vT("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>hT("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||a(0,0),t.currentRenderer);const i=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),i=n.width/o.width,s=n.height/o.height,l={x:i*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&a(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function c(e){return e.pointerType||""}function u(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",ST),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",ST),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&ST(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&hT("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:i(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&ST(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=i(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:vT(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?hT("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):vT("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;hT(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const a=null==n.gripSpace?null:r.getPose(n.gripSpace,o),i=n.gamepad,s=n.handedness;if(i){i.index in t.lastGamepadValues||(t.lastGamepadValues[i.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:i(n),deviceType:c(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),u(),n.size>0||Date.now(){ST(n);const r={...yT(n),...s(n),position:i(n),deviceType:c(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:vT(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=AT(r);if(2===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(xT),position:i(n),deviceType:c(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=AT(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(xT),position:i(n),deviceType:c(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=AT(r);e.recognizeGesture("TouchEnd",t);const a={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonPressEvent(a)}else{const t=AT(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(xT),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,a=null,i=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){i=l;break}null===o&&l.getInteractive()&&(o=l),null===a&&t._view.isInViewport(e,n,l)&&(a=l)}return null===i&&(i=o),null===i&&(i=a),null==i&&(i=r[0]),i},e.render=()=>{e.isAnimating()||t.inRender||u()},CT.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void bT("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const a=[],i=[];Object.keys(r).forEach((e=>{a[o]=r[e],i[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y)),l=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y));let c=Do(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),u=Do(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),d=u-c;u=u+180>=360?u-180:u+180,c=c+180>=360?c-180:c+180,Math.abs(u-c)n&&o>a&&o>i){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(a>n&&a>i){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(i>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const IT={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function wT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IT,n),jt.obj(e,t),t._animationExtendedEnd=0,jt.event(e,t,"RenderEvent"),CT.forEach((n=>jt.event(e,t,n))),jt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),jt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),jt.moveToProtected(e,t,["view"]),PT(e,t)}var OT={newInstance:jt.newInstance(wT,"vtkRenderWindowInteractor"),extend:wT,handledEvents:CT,...fT};const{vtkErrorMacro:MT,VOID:RT}=jt;function VT(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){OT.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):RT),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():MT("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const ET={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function DT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ET,n),jt.obj(e,t),jt.event(e,t,"InteractionEvent"),jt.event(e,t,"StartInteractionEvent"),jt.event(e,t,"EndInteractionEvent"),jt.get(e,t,["_interactor","enabled"]),jt.setGet(e,t,["priority","processEvents"]),jt.moveToProtected(e,t,["interactor"]),VT(e,t)}var LT={newInstance:jt.newInstance(DT,"vtkInteractorObserver"),extend:DT,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}};const BT={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025};var NT={States:BT};const{States:kT}=NT,FT={Rotate:kT.IS_ROTATE,Pan:kT.IS_PAN,Spin:kT.IS_SPIN,Dolly:kT.IS_DOLLY,CameraPose:kT.IS_CAMERA_POSE,WindowLevel:kT.IS_WINDOW_LEVEL,Slice:kT.IS_SLICE};function _T(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(FT).forEach((n=>{jt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===kT.IS_NONE&&(t.state=FT[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},jt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===FT[n]&&(t.state=kT.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const GT={state:kT.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function UT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,GT,n),LT.extend(e,t,n),_T(e,t)}var WT={newInstance:jt.newInstance(UT,"vtkInteractorStyle"),extend:UT,...NT};const{States:zT}=NT;function HT(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case zT.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zT.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==dT.RightController||n.input!==pT.Trigger&&n.input!==pT.TrackPad?!n||n.pressed||n.device!==dT.RightController||n.input!==pT.Trigger&&n.input!==pT.TrackPad||t.state!==zT.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===zT.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case zT.IS_DOLLY:e.endDolly();break;case zT.IS_PAN:e.endPan();break;case zT.IS_SPIN:e.endSpin();break;case zT.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const a=o[2],i=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+i[0]-s[0],o[1]+i[1]-s[1],a),c=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],a),u=[];u[0]=c[0]-l[0],u[1]=c[1]-l[1],u[2]=c[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(u[0]+o[0],u[1]+o[1],u[2]+o[2]),r.setPosition(u[0]+d[0],u[1]+d[1],u[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,a=n.y-t.previousPosition.y,i=r.getView().getViewportSize(e);let s=-.1,l=-.1;i[0]&&i[1]&&(s=-20/i[1],l=-20/i[0]);const c=o*l*t.motionFactor,u=a*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(c)||Number.isNaN(u)||(d.azimuth(c),d.elevation(u),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),a=r.getView().getViewportCenter(e),i=Do(Math.atan2(t.previousPosition.y-a[1],t.previousPosition.x-a[0])),s=Do(Math.atan2(n.y-a[1],n.x-a[0]))-i;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let a=o.getFocalPoint();a=e.computeWorldToDisplay(n,a[0],a[1],a[2]);const i=a[2],s=e.computeDisplayToWorld(n,r.x,r.y,i),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,i),c=[];c[0]=l[0]-s[0],c[1]=l[1]-s[1],c[2]=l[2]-s[2],a=o.getFocalPoint();const u=o.getPosition();o.setFocalPoint(c[0]+a[0],c[1]+a[1],c[2]+a[2]),o.setPosition(c[0]+u[0],c[1]+u[1],c[2]+u[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,a=t._interactor.getView().getViewportCenter(n),i=t.motionFactor*o/a[1];e.dollyByFactor(n,1.1**i)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const jT={motionFactor:10,zoomFactor:10};function KT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jT,n),WT.extend(e,t,n),jt.setGet(e,t,["motionFactor","zoomFactor"]),HT(e,t)}var $T={newInstance:jt.newInstance(KT,"vtkInteractorStyleTrackballCamera"),extend:KT};function qT(e){return e}function XT(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>XT(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var YT=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?XT:qT,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n};function ZT(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${jt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}const QT={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function JT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,QT,n),jt.obj(e,t),jt.get(e,t,["currentOperation"]),jt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),jt.moveToProtected(e,t,["currentParent"]),ZT(e,t)}var eC={newInstance:jt.newInstance(JT,"vtkRenderPass"),extend:JT};const{Representation:tC}=xs,{vtkErrorMacro:nC}=jt;function rC(e){const t=xd.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function oC(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Us.newInstance({numberOfComponents:3,values:e});o.setName("points");const a=Us.newInstance({numberOfComponents:2,values:n});a.setName("tcoords");const i=Us.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",tC.SURFACE,{points:o,tcoords:a,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=nf.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=$d.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=$d.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=$d.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||nC("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||nC("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const a=n.getSize(),i=n.getContext();if(t._supported=!1,r.getSelector()||!i||!n.getWebgl2()||!i.getExtension("EXT_color_buffer_half_float")&&!i.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==a[0]||r[1]!==a[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}i.drawBuffers([i.COLOR_ATTACHMENT0]),i.clearBufferfv(i.COLOR,0,[0,0,0,0]),i.clearBufferfv(i.DEPTH,0,[1]),i.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),i.colorMask(!0,!0,!0,!0),i.drawBuffers([i.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1]),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),i.clearBufferfv(i.COLOR,0,[0,0,0,1]),i.clearBufferfv(i.COLOR,1,[0,0,0,0]),i.enable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFuncSeparate(i.ONE,i.ONE,i.ZERO,i.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),i.drawBuffers([i.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ad.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?rC:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const aC={framebuffer:null,copyShader:null,tris:null};function iC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,aC,n),eC.extend(e,t,n),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Md.newInstance(),jt.get(e,t,["framebuffer"]),oC(e,t)}var sC={newInstance:jt.newInstance(iC,"vtkOpenGLOrderIndependentTranslucentPass"),extend:iC};function lC(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=nf.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),i.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),i.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),i.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=sC.newInstance()),t.translucentPass.traverse(n,i,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),i.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),i.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const cC={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function uC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cC,n),eC.extend(e,t,n),jt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),lC(e,t)}var dC={newInstance:jt.newInstance(uC,"vtkForwardPass"),extend:uC},pC=n(594),fC=n.n(pC);const gC=["lastShaderProgramBound","context","_openGLRenderWindow"];function mC(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=xd.substitute(o,"VSOut","GSOut").result);const a=t._openGLRenderWindow.getWebgl2();let i="\n",s="#version 100\n";a?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(i="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(i+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=xd.substitute(o,"//VTK::System::Dec",[`${s}\n`,a?"":"#extension GL_OES_standard_derivatives : enable\n",i,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=xd.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(a){l=xd.substitute(l,"varying","out").result,o=xd.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=xd.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=xd.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:xd.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),a=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(a)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,a=fC().hash(o);if(!(a in t.shaderPrograms)){const o=xd.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(a),t.shaderPrograms[a]=o,o}return t.shaderPrograms[a]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const hC={lastShaderProgramBound:null,shaderPrograms:null,context:null};function vC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hC,n),t.shaderPrograms={},jt.obj(e,t),jt.setGet(e,t,gC),jt.moveToProtected(e,t,["openGLRenderWindow"]),mC(e,t)}var yC={newInstance:jt.newInstance(vC,"vtkShaderCache"),extend:vC};const{vtkErrorMacro:bC}=jt;function xC(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TC,n),jt.obj(e,t),t.textureUnits=[],jt.get(e,t,["numberOfTextureUnits"]),jt.setGet(e,t,["context"]),xC(e,t)}var SC={newInstance:jt.newInstance(CC,"vtkOpenGLTextureUnitManager"),extend:CC};function AC(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),a=e.getFramebufferSize();return o[0]*a[0]<=t&&o[2]*a[0]>=t&&o[1]*a[1]<=n&&o[3]*a[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const a=o.worldToView(t,n,r),i=e.getViewportSize(o),s=o.viewToProjection(a[0],a[1],a[2],i[0]/i[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const a=e.displayToNormalizedDisplay(t,n,r),i=o.normalizedDisplayToProjection(a[0],a[1],a[2]),s=e.getViewportSize(o),l=o.projectionToView(i[0],i[1],i[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=e.normalizedDisplayToDisplay(t,n,r);return[i[0]-a[0]-.5,i[1]-a[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return a&&0!==a[0]&&0!==a[1]?[t/(a[0]-1),n/(a[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return[t*(a[0]-1),n*(a[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=t+a[0]+.5,s=n+a[1]+.5;return e.displayToNormalizedDisplay(i,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{jt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{jt.vtkErrorMacro("not implemented")},e.createSelector=()=>{jt.vtkErrorMacro("not implemented")}}const PC={size:void 0,selector:void 0};function IC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,PC,n),t.size||(t.size=[300,300]),jt.getArray(e,t,["size"],2),jt.get(e,t,["selector"]),Zt.extend(e,t,n),AC(e,t)}var wC={newInstance:jt.newInstance(IC,"vtkRenderWindowViewNode"),extend:IC};const{vtkDebugMacro:OC,vtkErrorMacro:MC}=jt,RC={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function VC(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),a===e.FRAMEBUFFER_COMPLETE}let EC=0;const DC=[];function LC(){EC++,DC.forEach((e=>e(EC)))}function BC(){EC--,DC.forEach((e=>e(EC)))}function NC(e){e.preventDefault()}function kC(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(a=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(a,r[0]),t.apply(n,r))}));var a},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const a=n[t];return a?a(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",NC,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=SC.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&MC("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const a=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,a),a},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,OC("using webgl2"))),r||(OC("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=eC.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?MC("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case ws.CHAR:case ws.SIGNED_CHAR:case ws.UNSIGNED_CHAR:return 1;case n:case r:case ws.UNSIGNED_SHORT:case ws.SHORT:case ws.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case ws.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&ws.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&ws.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=RC,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),a=n.getExtension("WEBGL_debug_renderer_info"),i=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&VC(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&VC(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&VC(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&VC(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&VC(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&VC(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&VC(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&VC(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&VC(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&VC(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&VC(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&VC(n,n.RGB,n.FLOAT)?"RGB":"",r&&VC(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&VC(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&VC(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",i?n.getParameter(i.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",a&&n.getParameter(a.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",a&&n.getParameter(a.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],c={};for(;l.length;){const[e,t,n]=l.pop();t&&(c[t]={label:e,value:n})}return t._glInformation=c,c},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const a=t.canvas.getBoundingClientRect(),i=t.renderable;i.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=Sf.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=jt.chain((function(){t.canvas.removeEventListener("webglcontextlost",NC),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,BC),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const a=e.setSize;e.setSize=(t,n)=>{const r=a(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const FC={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const _C=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FC,n),wC.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",LC(),t.selector||(t.selector=Sf.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=ln.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",_C),t.shaderCache=yC.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=dC.newInstance(),jt.event(e,t,"imageReady"),jt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),jt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),kC(e,t)}),"vtkOpenGLRenderWindow");aT("WebGL",_C);const GC=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function UC(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),a=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==a&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${a}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,WC,n),yt(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],xt(e,t,["boundPipeline","colorTextureViews"]),At(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),UC(e,t)}var HC={newInstance:Et(zC,"vtkWebGPURenderEncoder"),extend:zC};function jC(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=Dy.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=Dy.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(a)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=HC.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const KC={renderEncoder:null,colorTexture:null,depthTexture:null};function $C(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,KC,n),eC.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),jC(e,t)}var qC={newInstance:jt.newInstance($C,"vtkWebGPUOpaquePass"),extend:$C};function XC(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=Dy.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=Dy.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const a=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,a),t.fullScreenQuad=kh.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=HC.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=HC.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const YC={colorTextureView:null,depthTextureView:null};function ZC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,YC,n),eC.extend(e,t,n),jt.setGet(e,t,["colorTextureView","depthTextureView"]),XC(e,t)}var QC={newInstance:jt.newInstance(ZC,"vtkWebGPUOrderIndependentTranslucentPass"),extend:ZC};const JC="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",eS=new Float64Array(16),tS=new Float64Array(16);function nS(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=ih.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();const i=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));a=ih.substitute(a,"//VTK::Volume::CompositeCalls",i).result,a=ih.substitute(a,"//VTK::Volume::TraverseCalls",s).result,a=ih.substitute(a,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",a),t.SSBO.setAllInstancesFromArray("planeNormals",i),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",c),t.SSBO.setAllInstancesFromArray("ipScalarRange",u),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),f=new Float64Array(t.numRows),v=new Float64Array(t.numRows),y=new Float64Array(t.numRows),C=new Float64Array(t.numRows),S=new Float64Array(t.numRows),A=new Float64Array(t.numRows);let P=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const rS={volumes:null,rowLength:1024,lastVolumeLength:0};function oS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rS,n),kh.extend(e,t,n),t.fragmentShaderTemplate=JC,t.UBO=Pv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=bv.newInstance({label:"volumeSSBO"}),t.componentSSBO=bv.newInstance({label:"componentSSBO"}),t.lutBuildTime={},jt.obj(t.lutBuildTime,{mtime:0}),nS(e,t)}var aS={newInstance:jt.newInstance(oS,"vtkWebGPUVolumePassFSQ"),extend:oS};const{Representation:iS}=xs,{BufferUsage:sS,PrimitiveTypes:lS}=fv,cS=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],uS="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function dS(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=aS.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=kh.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=Pv.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),a=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>a){const o=n.getRenderable().getActiveCamera().getPosition(),i=[];for(let e=0;ei[t]-i[e]));let l=[],c=s.length%a;for(let o=0;o=c&&(e.rayCastPass(r,n,l),l=[],c=a,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=jt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let a=t._colorTextureView.getTexture().getWidth(),i=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),a=t._smallViewportWidth,i=t._smallViewportHeight}o.getHandle().setViewport(0,0,a,i,0,1),o.getHandle().setScissorRect(0,0,a,i),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,a=o.getPoints(),i=o.getPolys();let s={hash:`vp${i.getMTime()}`,usage:sS.Index,cells:i,numberOfPoints:a.getNumberOfPoints(),primitiveType:lS.Triangles,representation:iS.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:sS.PointArray,format:"float32x4",hash:`vp${a.getMTime()}${i.getMTime()}`,dataArray:a,indexBuffer:l,packExtra:!0};const c=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(c,["vertexBC"]),t._mapper.setNumberOfVertices(c.getSizeInBytes()/c.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=HC.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=Dy.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=Dy.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=Dy.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=HC.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=HC.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=HC.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pS,n),eC.extend(e,t,n),t._mapper=Dh.newInstance(),t._mapper.setFragmentShaderTemplate(uS),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=Pu.newInstance(),t._lastMTimes=[],jt.setGet(e,t,["colorTextureView","depthTextureView"]),dS(e,t)}var gS={newInstance:jt.newInstance(fS,"vtkWebGPUVolumePass"),extend:fS};function mS(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=qC.newInstance());const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=QC.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(i,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=gS.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(i,n)),e.finalPass(n,i))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=HC.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=Ay.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=kh.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Oy.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const hS={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function vS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hS,n),eC.extend(e,t,n),jt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),mS(e,t)}var yS={newInstance:jt.newInstance(vS,"vtkForwardPass"),extend:vS};const{VtkDataTypes:bS}=Us;function xS(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case bS.UNSIGNED_CHAR:e.format+="8unorm";break;case bS.FLOAT:case bS.UNSIGNED_INT:case bS.INT:case bS.DOUBLE:case bS.UNSIGNED_SHORT:case bS.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=Dy.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const TS={handle:null,device:null};function CS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TS,n),jt.obj(e,t),jt.setGet(e,t,["device"]),xS(e,t)}var SS={newInstance:jt.newInstance(CS),extend:CS};class AS extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function PS(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IS,n),yt(e,t),At(e,t,["handle"]),xt(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new AS,t.shaderCache=ih.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=fv.newInstance(),t.bufferManager.setDevice(e),t.textureManager=SS.newInstance(),t.textureManager.setDevice(e),t.pipelines={},PS(e,t)}var OS={newInstance:Et(wS,"vtkWebGPUDevice"),extend:wS};function MS(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=Dy.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=Dy.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(a)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=HC.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=ih.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const RS={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function VS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,RS,n),eC.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),MS(e,t)}var ES={newInstance:jt.newInstance(VS,"vtkWebGPUHardwareSelectionPass"),extend:VS};const{SelectionContent:DS,SelectionField:LS}=sf,{FieldAssociations:BS}=gl,{vtkErrorMacro:NS}=jt;function kS(e){return`${e.propID} ${e.compositeID}`}function FS(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function _S(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=FS(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let a=FS(t[0],t[1],e,1);if((a<0||a>16777215)&&(a=0),o.compositeID=a,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const a=[t[0],t[1]],i=[0,0];let s=_S(e,t,0,r);if(s)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=_S(e,i,0,r),s))return s;if(i[0]=a[0]+t,s=_S(e,i,0,r),s)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=_S(e,i,0,r),s))return s;if(i[1]=a[1]+t,s=_S(e,i,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function GS(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return NS("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),a=t._selectionPass.getColorTexture(),i=t._selectionPass.getDepthTexture(),s={area:[0,0,a.getWidth()-1,a.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:a.getWidth(),height:a.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=zh.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const c=t._WebGPURenderWindow.getCommandEncoder();let u;c.copyTextureToBuffer({texture:a.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),u=zh.newInstance({label:"hardwareSelectDepthBuffer"}),u.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,u.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),c.copyTextureToBuffer({texture:i.getHandle(),aspect:"depth-only"},{buffer:u.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(c);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=u.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(u.getMappedRange().slice()),u.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=_S(e,[n,t],0,u);if(r){const t=kS(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const i=sf.newInstance();switch(i.setContentType(DS.INDICES),e){case BS.FIELD_ASSOCIATION_CELLS:i.setFieldType(LS.CELL);break;case BS.FIELD_ASSOCIATION_POINTS:i.setFieldType(LS.POINT);break;default:NS("Unknown field association")}i.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);i.getProperties().prop=s.getRenderable(),i.getProperties().compositeID=t.info.compositeID,i.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(i.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],i.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),i.setSelectionList(t.attributeIDs),r[o]=i,o++})),r}(e.fieldAssociation,c,e)}(s,e,t,n,r),s}}const US={};function WS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,US,n),Qp.extend(e,t,n),t._selectionPass=ES.newInstance(),jt.setGet(e,t,["_WebGPURenderWindow"]),jt.moveToProtected(e,t,["WebGPURenderWindow"]),GS(e,t)}var zS={newInstance:jt.newInstance(WS,"vtkWebGPUHardwareSelector"),extend:WS};const{vtkErrorMacro:HS}=jt,jS={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function KS(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void HS("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&HS("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=OS.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=eC.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=jS,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const a=await e.getPixelsAsync(),i=new ImageData(a.colorValues,a.width,a.height);o.putImageData(i,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=zh.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const a=t.device.createCommandEncoder();a.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(a);const i=o.mapAsync(GPUMapMode.READ);await i,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=zS.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=jt.chain(e.delete,e.setViewStream)}const $S={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const qS=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$S,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",wC.extend(e,t,n),t.myFactory=jm.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",qS),t.renderPasses[0]=yS.newInstance(),t.selector||(t.selector=zS.newInstance(),t.selector.setWebGPURenderWindow(e)),jt.event(e,t,"imageReady"),jt.event(e,t,"initialized"),jt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),jt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),KS(e,t)}),"vtkWebGPURenderWindow");aT("WebGPU",qS);const XS=YT(),YS={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},ZS={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function QS(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function JS(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),QS(t.container,t.containerStyle||YS),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=uT.newInstance(),t.renderer=rT.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(XS.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=OT.newInstance(),t.interactor.setInteractorStyle($T.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),QS(t.controlContainer,t.controlPanelStyle||ZS),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=jt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const eA={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function tA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eA,n),jt.obj(e,t),jt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),JS(e,t)}var nA={newInstance:jt.newInstance(tA),extend:tA};function rA(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>iA({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const oA={name:"",numberOfComponents:1,size:0,dataType:"string"};function aA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,oA,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),jt.obj(e,t),jt.set(e,t,["name"]),rA(e,t)}const iA=jt.newInstance(aA,"vtkStringArray");var sA={newInstance:iA,extend:aA};const{vtkErrorMacro:lA,vtkDebugMacro:cA}=jt,uA=()=>(lA("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let dA=0;function pA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const fA={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?uA():n.ref&&!n.ref.pending?new Promise(((o,a)=>{const i=pA("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);i.onreadystatechange=t=>{1===i.readyState&&(n.ref.pending=!0,1==++dA&&e?.invokeBusy&&e.invokeBusy(!0)),4===i.readyState&&(n.ref.pending=!1,200===i.status||0===i.status?(n.buffer=i.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Yb!==n.ref.encode&&Yb&&(cA(`Swap bytes of ${n.name}`),Zb(n.buffer,Is[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&lA(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:i,e:t}))},i.responseType="string"!==n.dataType?"arraybuffer":"text",i.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?uA():new Promise(((r,o)=>{const a=pA("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++dA&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?uA():new Promise(((r,o)=>{const a=pA("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++dA&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--dA&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(a.responseText):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=pA("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Jb("http")||ex("http",(e=>fA));const gA=["pointData","cellData","fieldData"],mA={vtkDataArray:Us,vtkStringArray:sA},hA={},vA={vtkPolyData(e){const t=[];return t.push(e.points),["verts","lines","polys","strips"].forEach((n=>{e[n]&&t.push(e[n])})),t},vtkImageData:e=>[],vtkUnstructuredGrid(e){const t=[];return t.push(e.points),t.push(e.cells),t.push(e.cellTypes),t},vtkRectilinearGrid(e){const t=[];return t.push(e.xCoordinates),t.push(e.yCoordinates),t.push(e.zCoordinates),t}};function yA(e,t){function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=`${n.ref.id}|${n.vtkClass}`;return hA[o]?Promise.resolve(hA[o]).then((e=>{n!==e&&(Object.assign(n,e),delete n.ref)})):hA[o]=t.dataAccessHelper.fetchArray(e,t.baseURL,n,r).then((e=>(hA[o]=e,e))),Promise.resolve(hA[o])}t.classHierarchy.push("vtkHttpDataSetReader"),t.output[0]=ze({vtkClass:"vtkPolyData"}),t.dataAccessHelper||(t.dataAccessHelper=tx("http")),e.updateMetadata=function(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"zip"===t.compression?new Promise(((r,o)=>{tx("http").fetchBinary(t.url).then((a=>{t.dataAccessHelper=tx("zip",{zipContent:a,callback:a=>{t.baseURL="",t.dataAccessHelper.fetchJSON(e,"index.json").then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}})}),(e=>{o(e)}))})):new Promise(((r,o)=>{t.dataAccessHelper.fetchJSON(e,t.url).then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}))},e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf("index.json")||r.fullpath){t.url=n;const e=n.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=n,t.url=`${n}/index.json`;return t.compression=r.compression,e.updateMetadata(!!r.loadData)},e.parseObject=(r,o)=>{let{loadData:a,baseUrl:i,deepCopy:s=!0}=o;i&&(t.baseURL=i);const l=s?structuredClone(r):r;return new Promise(((r,o)=>{!function(e,t,n,r,o,a,i){const s=t.enableArray;t.arrays=[],gA.forEach((e=>{n[e]&&(n[e].arrays.map((e=>e.data)).forEach((n=>{t.arrays.push({name:n.name,enable:s,location:e,array:n,registration:n.ref.registration||"addArray"})})),n[e].arrays=[])}));const l=[],{progressCallback:c}=t,u=t.fetchGzip?"gz":null;function d(){t.dataset=ze(n),i?e.loadData().then((()=>{t.output[0]=t.dataset,o(e,t.output[0])})):(t.output[0]=t.dataset,o(e,t.output[0]))}vA[n.vtkClass](n).forEach((e=>{l.push(r(e,{compression:u,progressCallback:c}))})),l.length?Promise.all(l).then(d,(e=>{a(e)})):d()}(e,t,l,n,r,o,a)}))},e.loadData=()=>{const r=t.dataset,o=t.arrays.filter((e=>e.enable)).filter((e=>e.array.ref)).map((e=>e.array));return new Promise(((a,i)=>{const s=e=>{i(e)},l=()=>{if(o.length){const{progressCallback:e}=t,r=t.fetchGzip?"gz":null;n(o.pop(),{compression:r,progressCallback:e}).then(l,s)}else r&&(t.arrays.filter((e=>e.registration&&!e.array.ref)).forEach((e=>{const t=mA[e.array.vtkClass].newInstance(e.array);r[`get${jt.capitalize(e.location)}`]()[e.registration](t),delete e.registration})),r.modified(),a(e,r))};l()}))},e.requestData=(e,t)=>{},e.enableArray=function(e,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.arrays.filter((t=>t.name===n&&t.location===e));1===o.length&&(o[0].enable=r)},e.isBusy=()=>!!t.requestCount}const bA={enableArray:!0,fetchGzip:!1,arrays:[],url:null,baseURL:null,requestCount:0};function xA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bA,n),jt.obj(e,t),jt.get(e,t,["enableArray","fetchGzip","url","baseURL","dataAccessHelper"]),jt.set(e,t,["dataAccessHelper","progressCallback"]),jt.getArray(e,t,["arrays"]),jt.algo(e,t,0,1),jt.event(e,t,"busy"),yA(e,t),void 0===t.progressCallback&&(t.progressCallback=null)}var TA={newInstance:jt.newInstance(xA,"vtkHttpDataSetReader"),extend:xA};function CA(e,t){t.classHierarchy.push("vtkAbstractImageMapper"),e.getIsOpaque=()=>!0,e.getCurrentImage=()=>null,e.getBoundsForSlice=()=>(jt.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),_a())}const SA={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1]};var AA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,SA,n),$s(e,t,n),jt.setGet(e,t,["slice","useCustomExtents"]),jt.setGetArray(e,t,["customDisplayExtent"],6),jt.setGetArray(e,t,["backgroundColor"],4),CA(e,t)};function PA(e,t){t.classHierarchy.push("vtkPolyLine");const n=su.newInstance();n.getPoints().setNumberOfPoints(2),e.getCellDimension=()=>1,e.intersectWithLine=(r,o,a,i,s,l,c)=>{const u={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null},d=e.getNumberOfPoints()-1;let p=Number.MAX_VALUE;for(let e=0;e=r&&f.t<=o){u.intersect=1;const t=n.getParametricDistance(d);(t(n.getPoints().getData().set(t.points.getData().subarray(3*e,3*(e+2))),n.evaluateLocation(r,o,a)),e.evaluateOrientation=(e,r,o,a)=>(t.orientations?n.setOrientations([t.orientations[e],t.orientations[e+1]]):n.setOrientations(null),n.evaluateOrientation(r,o,a)),e.getDistancesToFirstPoint=()=>{const n=t.distancesTime.getMTime();if(n0){const e=new Array(3),a=new Array(3);let i=0;t.distances[0]=i,t.points.getPoint(0,e);for(let s=1;s{const n=e.getDistancesToFirstPoint();if(n.length<2)return-1;let r=0,o=n.length-1;if(tn[o]||0===n[o])return-1;for(;o-r>1;){const e=Math.floor((r+o)/2);n[e]<=t?r=e:o=e}return r}}const IA={orientations:null,distanceFunction:Gn};function wA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,IA,n),Rc.extend(e,t,n),jt.setGet(e,t,["orientations","distanceFunction"]),t.distancesTime={},jt.obj(t.distancesTime,{mtime:0}),PA(e,t)}var OA={newInstance:jt.newInstance(wA,"vtkPolyLine"),extend:wA};const{vtkErrorMacro:MA}=jt,{staticOffsetAPI:RA,otherStaticMethods:VA}=Ql;function EA(e,t){t.classHierarchy.push("vtkImageCPRMapper");const n={...e};e.getBounds=()=>[0,e.getWidth(),0,e.getHeight(),0,0],e.getOrientationDataArray=()=>{const n=e.getInputData(1)?.getPointData();return n?null!==t.orientationArrayName?n.getArrayByName(t.orientationArrayName)||null:n.getArrayByName("Orientation")||n.getArrayByName("Direction")||n.getVectors()||n.getTensors()||n.getNormals()||null:null},e.getOrientedCenterline=()=>{const n=e.getInputData(1);if(!n)return t._orientedCenterline;const r=e.getOrientationDataArray(),o=n.getLines(),a=n.getPoints();if(!t.useUniformOrientation&&!r)return MA("Failed to create oriented centerline from polydata: no orientation"),e._resetOrientedCenterline(),t._orientedCenterline;const i=t._orientedCenterline.getMTime();if(i>=e.getMTime()&&i>o.getMTime()&&i>a.getMTime()&&(t.useUniformOrientation||i>r.getMTime()))return t._orientedCenterline;const s=o.getData();if(s.length<=0)return e._resetOrientedCenterline(),t._orientedCenterline;const l=s[0];if(l<=1)return e._resetOrientedCenterline(),t._orientedCenterline;const c=s.subarray(1,1+l),u=new Array(l);let d=()=>null;switch(t.useUniformOrientation?t.uniformOrientation.length:r.getNumberOfComponents()){case 16:d=N;break;case 9:d=(e,t)=>{(function(e,t){var n,r=t[0]+t[4]+t[8];if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var o=0;t[4]>t[0]&&(o=1),t[8]>t[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;n=Math.sqrt(t[3*o+o]-t[3*a+a]-t[3*i+i]+1),e[o]=.5*n,n=.5/n,e[3]=(t[3*a+i]-t[3*i+a])*n,e[a]=(t[3*a+o]+t[3*o+a])*n,e[i]=(t[3*i+o]+t[3*o+i])*n}})(e,t),Qi(e,e)};break;case 4:d=Zi;break;case 3:d=(e,n)=>Ji(e,t.tangentDirection,n);break;default:return MA("Orientation doesnt match mat4, mat3, quat or vec3"),e._resetOrientedCenterline(),t._orientedCenterline}let p=()=>null;if(t.useUniformOrientation){const e=new Float64Array(4);d(e,t.uniformOrientation),p=()=>e}else{const e=new Float64Array(16);p=t=>{const n=new Float64Array(4);return r.getTuple(t,e),d(n,e),n}}for(let e=0;et._orientedCenterline!==e&&(t._orientedCenterline=e,!0),e._resetOrientedCenterline=()=>{t._orientedCenterline.initialize(Ic.newInstance()),t._orientedCenterline.setOrientations([])},e.getMTime=()=>{let e=n.getMTime();return t._orientedCenterline?(e=Math.max(e,t._orientedCenterline.getMTime()),e):e},e.getHeight=()=>{const t=e.getOrientedCenterline().getDistancesToFirstPoint();return 0===t.length?0:t[t.length-1]},e.getCenterlinePositionAndOrientation=t=>{const n=e.getOrientedCenterline(),r=n.findPointIdAtDistanceFromFirstPoint(t);if(r<0)return{};const o=n.getDistancesToFirstPoint(),a=[(t-o[r])/(o[r+1]-o[r])],i=new Array(2),s=new Array(3);n.evaluateLocation(r,a,s,i);const l=new Array(4);return n.evaluateOrientation(r,a,l,i)?{position:s,orientation:l}:{position:s}},e.getCenterlineTangentDirections=()=>{const n=e.getOrientedCenterline();if(t._centerlineTangentDirectionsTime.getMTime()Nn(new Array(3),t.tangentDirection,t.uniformOrientation),e.getDirectionMatrix=()=>{const e=t.tangentDirection,n=t.bitangentDirection,r=t.normalDirection;return new Float64Array([e[0],e[1],e[2],n[0],n[1],n[2],r[0],r[1],r[2]])},e.setDirectionMatrix=n=>!re(n,e.getDirectionMatrix())&&(t.tangentDirection=[n[0],n[1],n[2]],t.bitangentDirection=[n[3],n[4],n[5]],t.normalDirection=[n[6],n[7],n[8]],e.modified(),!0),e.preRenderCheck=()=>!!e.getInputData(0)||(MA("No image data input"),!1),e.useStraightenedMode=()=>{e.setCenterPoint(null),e.setUseUniformOrientation(!1),e.getOrientedCenterline().setDistanceFunction(Gn)},e.useStretchedMode=t=>{const n=e.getOrientedCenterline();if(t)e.setCenterPoint(t);else{const t=n.getPoints(),r=t.getNumberOfTuples()>0?t.getPoint(0):[0,0,0];e.setCenterPoint(r)}e.setUseUniformOrientation(!0),n.setDistanceFunction(((t,n)=>{const r=e.getUniformDirection(),o=wn([],t,n),a=function(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}(o),i=En(r,o);return Math.sqrt(a-i*i)}))},e.setCenterlineData=t=>e.setInputData(t,1),e.setCenterlineConnection=t=>e.setInputConnection(t,1),e.setImageData=t=>e.setInputData(t,0),e.setImageConnection=t=>e.setInputConnection(t,0),e.getIsOpaque=()=>!0,t._orientedCenterline=OA.newInstance(),e._resetOrientedCenterline()}const DA={width:10,uniformOrientation:[0,0,0,1],useUniformOrientation:!1,centerPoint:null,preferSizeOverAccuracy:!1,orientationArrayName:null,tangentDirection:[1,0,0],bitangentDirection:[0,1,0],normalDirection:[0,0,1]};function LA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DA,n),AA(e,t,n),jt.algo(e,t,2,0),t._centerlineTangentDirectionsTime={},jt.obj(t._centerlineTangentDirectionsTime,{mtime:0}),jt.setGet(e,t,["width","uniformOrientation","useUniformOrientation","centerPoint","preferSizeOverAccuracy","orientationArrayName","tangentDirection","bitangentDirection","normalDirection"]),Ql.implementCoincidentTopologyMethods(e,t),EA(e,t)}var BA={newInstance:jt.newInstance(LA,"vtkImageCPRMapper"),extend:LA,...RA,...VA};function NA(e,t,n){const r=n.getCurrentImage(),o=r.getExtent(),a=[o[0],o[2],o[4]],{ijkMode:i}=n.getClosestIJKAxis();let s=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();i!==n.getSlicingMode()&&(s=n.getSliceAtPosition(s)),a[i]+=s;const l=[0,0,0];r.indexToWorld(a,l),a[i]+=1;const c=[0,0,0];r.indexToWorld(a,c),c[0]-=l[0],c[1]-=l[1],c[2]-=l[2],Vn(c,c);const u=ri.intersectWithLine(e,t,l,c);if(u.intersection){const e=u.x,t=[0,0,0];return r.worldToIndex(e,t),{t:u.t,absoluteIJK:t}}return null}const{staticOffsetAPI:kA,otherStaticMethods:FA}=Ql,{SlicingMode:_A}=bg;function GA(e,t){function n(){let n;switch(t.slicingMode){case _A.X:n=0;break;case _A.Y:n=1;break;case _A.Z:n=2;break;default:return void(t.closestIJKAxis={ijkMode:t.slicingMode,flip:!1})}const r=Ga(e.getCurrentImage().getDirection());let o=0;for(;o<3&&0===r[n+3*o];++o);const a=r[n+3*o]<0;t.closestIJKAxis={ijkMode:o,flip:a}}t.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=n=>{const r=e.getCurrentImage();let o;if(3===n.length)o=n;else if(Number.isFinite(n)){const e=r.getBounds();switch(t.slicingMode){case _A.X:o=[n,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case _A.Y:o=[(e[1]+e[0])/2,n,(e[5]+e[4])/2];break;case _A.Z:o=[(e[1]+e[0])/2,(e[3]+e[2])/2,n]}}const a=[0,0,0];r.worldToIndex(o,a);const i=r.getExtent(),{ijkMode:s}=e.getClosestIJKAxis();let l=0;switch(s){case _A.I:l=Ea(a[0],i[0],i[1]);break;case _A.J:l=Ea(a[1],i[2],i[3]);break;case _A.K:l=Ea(a[2],i[4],i[5]);break;default:return 0}return l},e.setSliceFromCamera=n=>{const r=n.getFocalPoint();switch(t.slicingMode){case _A.I:case _A.J:case _A.K:{const t=e.getSliceAtPosition(r);e.setSlice(t)}break;case _A.X:e.setSlice(r[0]);break;case _A.Y:e.setSlice(r[1]);break;case _A.Z:e.setSlice(r[2])}},e.setXSlice=t=>{e.setSlicingMode(_A.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(_A.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(_A.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(_A.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(_A.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(_A.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{const n=[0,0,0],r=e.getCurrentImage().getDirection();switch(t.slicingMode){case _A.X:n[0]=1;break;case _A.Y:n[1]=1;break;case _A.Z:n[2]=1;break;case _A.I:aa(r,[1,0,0],n);break;case _A.J:aa(r,[0,1,0],n);break;case _A.K:aa(r,[0,0,1],n)}return n},e.setSlicingMode=r=>{t.slicingMode!==r&&(t.slicingMode=r,e.getCurrentImage()&&n(),e.modified())},e.getClosestIJKAxis=()=>(void 0!==t.closestIJKAxis&&t.closestIJKAxis.ijkMode!==_A.NONE||!e.getCurrentImage()||n(),t.closestIJKAxis),e.getBounds=()=>{const n=e.getCurrentImage();if(!n)return _a();if(!t.useCustomExtents)return n.getBounds();const r=t.customDisplayExtent.slice(),{ijkMode:o}=e.getClosestIJKAxis();let a=t.slice;switch(o!==t.slicingMode&&(a=e.getSliceAtPosition(t.slice)),o){case _A.I:r[0]=a,r[1]=a;break;case _A.J:r[2]=a,r[3]=a;break;case _A.K:r[4]=a,r[5]=a}return n.extentToBounds(r)},e.getBoundsForSlice=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slice,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.getCurrentImage();if(!o)return _a();const a=o.getSpatialExtent(),{ijkMode:i}=e.getClosestIJKAxis();let s=n;switch(i!==t.slicingMode&&(s=e.getSliceAtPosition(n)),i){case _A.I:a[0]=s-r,a[1]=s+r;break;case _A.J:a[2]=s-r,a[3]=s+r;break;case _A.K:a[4]=s-r,a[5]=s+r}return o.extentToBounds(a)},e.intersectWithLineForPointPicking=(t,n)=>function(e,t,n){const r=NA(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return t[0]e[1]||t[1]e[3]||t[2]e[5]?null:{t:r.t,ijk:t}}return null}(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>function(e,t,n){const r=NA(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=r.absoluteIJK,o=[Math.floor(t[0]),Math.floor(t[1]),Math.floor(t[2])];if(o[0]e[1]-1||o[1]e[3]-1||o[2](e[5]?e[5]-1:e[5]))return null;const a=[t[0]-o[0],t[1]-o[1],t[2]-o[2]];return{t:r.t,ijk:o,pCoords:a}}return null}(t,n,e),e.getCurrentImage=()=>e.getInputData()}const UA={slicingMode:_A.NONE,closestIJKAxis:{ijkMode:_A.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function WA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UA,n),AA(e,t,n),jt.get(e,t,["slicingMode"]),jt.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),Ql.implementCoincidentTopologyMethods(e,t),GA(e,t)}var zA={newInstance:jt.newInstance(WA,"vtkImageMapper"),extend:WA,...kA,...FA,...bg};const HA={CLAMP:0,REPEAT:1,MIRROR:2},jA={NEAREST:0,LINEAR:1,CUBIC:2};var KA={ImageBorderMode:HA,InterpolationMode:jA};const $A={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:HA.CLAMP,interpolationMode:jA.LINEAR,extraInfo:null},qA={...$A,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function XA(e){const t=Math.floor(e);return{floored:t,error:e-t}}function YA(e){return Math.round(e)}function ZA(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function QA(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function JA(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let a=e-t;return a=a>=0?a:-a,a%=o,a=a<=r?a:o-a,a}const{ImageBorderMode:eP}=KA;function tP(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,a=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,a)}const i=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*i,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let c=t.componentOffset;c=c>0?c:0,c=c{},e.interpolateXYZ=(n,r,o,a)=>{let i=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=a>0?a:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,a)=>{}}const nP={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:eP.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...$A},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function rP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nP,n),jt.obj(e,t),jt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),jt.get(e,t,["origin","spacing"]),tP(e,t)}var oP={newInstance:jt.newInstance(rP,"vtkAbstractImageInterpolator"),extend:rP,...KA};function aP(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===jA.LINEAR?n=2:t.interpolationMode===jA.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,a=e.numberOfComponents;let i=YA(t[0]),s=YA(t[1]),l=YA(t[2]);switch(e.borderMode){case HA.REPEAT:i=QA(i,r[0],r[1]),s=QA(s,r[2],r[3]),l=QA(l,r[4],r[5]);break;case HA.MIRROR:i=JA(i,r[0],r[1]),s=JA(s,r[2],r[3]),l=JA(l,r[4],r[5]);break;default:i=ZA(i,r[0],r[1]),s=ZA(s,r[2],r[3]),l=ZA(l,r[4],r[5])}const c=i*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,a=e.numberOfComponents,i=XA(t[0]),s=XA(t[1]),l=XA(t[2]);let c=i.floored,u=s.floored,d=l.floored;const p=i.error,f=s.error,g=l.error;let m=c+(0!==p),h=u+(0!==f),v=d+(0!==g);switch(e.borderMode){case HA.REPEAT:c=QA(c,r[0],r[1]),u=QA(u,r[2],r[3]),d=QA(d,r[4],r[5]),m=QA(m,r[0],r[1]),h=QA(h,r[2],r[3]),v=QA(v,r[4],r[5]);break;case HA.MIRROR:c=JA(c,r[0],r[1]),u=JA(u,r[2],r[3]),d=JA(d,r[4],r[5]),m=JA(m,r[0],r[1]),h=JA(h,r[2],r[3]),v=JA(v,r[4],r[5]);break;default:c=ZA(c,r[0],r[1]),u=ZA(u,r[2],r[3]),d=ZA(d,r[4],r[5]),m=ZA(m,r[0],r[1]),h=ZA(h,r[2],r[3]),v=ZA(v,r[4],r[5])}const y=c*o[0],b=m*o[0],x=u*o[1],T=h*o[1],C=d*o[2],S=v*o[2],A=x+C,P=x+S,I=T+C,w=T+S,O=1-p,M=1-f,R=1-g,V=M*R,E=f*R,D=M*g,L=f*g,B=e.pointer;for(let e=0;e{switch(t.interpolationMode){case jA.LINEAR:e.interpolateLinear(n,r,o);break;case jA.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,a)=>{const i=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),c=e.pointer.subarray(s[0]+l[0]),u=e.numberOfComponents;for(let e=0;e{const i=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],c=t*i,u=n*s,d=r*l,p=e.weights[0].subarray(c),f=e.weights[1].subarray(u),g=e.weights[2].subarray(d),m=e.positions[0].subarray(c),h=e.positions[1].subarray(u),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=h.subarray(v[0]);let T=x,C=x,S=x,A=1,P=0,I=1,w=0;2===s&&(C=h[1].subarray(v[0]),S=C,A=f[0],P=f[1]),2===l&&(T=h[0].subarray(v[1]),S=T,I=g[0],w=g[1]),s+l===4&&(S=h[1].subarray(v[1]));const O=A*I,M=A*w,R=P*I,V=P*w;if(1===i)if(0===P&&0===w)for(let e=a;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],i=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],a=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case jA.LINEAR:e.interpolateRowLinear(n,r,o,a,i,s);break;case jA.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,a,i,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const a={...qA.newInstance(),...t.interpolationInfo};a.weightType="Float32Array";const i=a.interpolationMode;let s=!0;for(let l=0;l<3;++l){let c;for(c=0;c<3&&0===n[4*l+c];++c);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const u=a.extent[2*c],d=a.extent[2*c+1],p=t.structuredBounds[2*c],f=t.structuredBounds[2*c+1];let g=1;g=i1)if(i===jA.LINEAR)v[g*t+1-y]=T[1]*S,b[g*t-y]=1-h,b[g*t+1-y]=h;else if(i===jA.CUBIC){const n=e.vtkTricubicInterpWeights(h);if(4===g)for(let e=0;e<4;e++)v[g*t+e-y]=T[e]*S,b[g*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[T[t]-u]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const iP={interpolationMode:jA.NEAREST};function sP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iP,n),oP.extend(e,t,n),jt.setGet(e,t,["interpolationMode"]),aP(e,t)}var lP={newInstance:jt.newInstance(sP,"vtkImageInterpolator"),extend:sP};function cP(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const a=e.getExtent();let i=n;null==i&&(i=a);let s,l,c,u=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(i[e],a[e]),t.extent[e+1]=Math.min(i[e+1],a[e+1]),t.extent[e]>t.extent[e+1]&&(u=!0);if(t.rowIncrement=a[1]-a[0]+1,t.sliceIncrement=t.rowIncrement*(a[3]-a[2]+1),u){s=0,l=0,c=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=a[e],t.extent[e+1]=a[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,c=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-a[0]+(t.extent[2]-a[2])*t.rowIncrement+(t.extent[4]-a[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*c-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const a=t.extent[4]-e[4];a<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=a*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&a>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*c;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let a;for(a=0;ae);++a)n=!n;t.spanIndex=a,t.inStencil=n;let i=t.extent[1]+1;a{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const uP={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function dP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uP,n),jt.obj(e,t),jt.get(e,t,["id","index"]),cP(e,t)}var pP={newInstance:jt.newInstance(dP,"vtkImagePointDataIterator"),extend:dP},fP={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:gP}=fP,{vtkErrorMacro:mP}=jt;function hP(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=g(new Float64Array(16));let o=null;function a(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=g(new Float64Array(16))),!ne(t.resliceAxes,n)&&(d(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,a)=>{const i=n[0];if(!i)return void mP("Invalid or missing input");const s=i.getOrigin(),l=i.getSpacing(),c=i.getDimensions(),u=i.getPointData().getScalars(),d=[0,c[0]-1,0,c[1]-1,0,c[2]-1],p=[0,0,0],f=[1,1,1],m=[0,0,0,0,0,0],v=[0,0,0],y=g(new Float64Array(16));t.resliceAxes&&b(y,y,t.resliceAxes);const x=new Float64Array(16);h(x,y);const T=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let C=null;t.autoCropOutput&&(C=e.getAutoCroppedOutputBounds(i));for(let e=0;e<3;e++){let n=0,r=0,o=0,a=0;if(t.transformInputSampling){let t=0;for(let i=0;i<3;i++){a+=x[4*i+e]*(T[i]-y[12+i]);const s=y[4*e+i]*y[4*e+i];n+=s*Math.abs(l[i]),r+=s*(d[2*i+1]-d[2*i])*Math.abs(l[i]),o+=s*d[2*i],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else a=T[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?f[e]=n:f[e]=t.outputSpacing[e],e>=t.outputDimensionality?(m[2*e]=0,m[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=C[2*e+1]-C[2*e]),m[2*e]=Math.round(o),m[2*e+1]=Math.round(m[2*e]+Math.abs(r/f[e]))):(m[2*e]=t.outputExtent[2*e],m[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=C[2*e]-m[2*e]*f[e]:p[e]=a-.5*(m[2*e]+m[2*e+1])*f[e]:p[e]=t.outputOrigin[e],v[e]=m[2*e+1]-m[2*e]+1}let S=u.getDataType();t.outputScalarType&&(S=t.outputScalarType);const A=i.getPointData().getScalars().getNumberOfComponents(),P=jt.newTypedArray(S,v[0]*v[1]*v[2]*A),I=Us.newInstance({name:"Scalars",values:P,numberOfComponents:A}),w=Sl.newInstance();w.setDimensions(v),w.setOrigin(p),w.setSpacing(f),t.outputDirection&&w.setDirection(t.outputDirection),w.getPointData().setScalars(I),e.getIndexMatrix(i,w);let O=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,m)&&(O=jA.NEAREST)),t.interpolator.setInterpolationMode(O);let M=HA.CLAMP;M=t.wrap?HA.REPEAT:M,M=t.mirror?HA.MIRROR:M,t.interpolator.setBorderMode(M);const R=762939453125e-17;let V=.5*t.border;V=M===HA.CLAMP?V:4294967294,V=V>R?V:R,t.interpolator.setTolerance(V),t.interpolator.initialize(i),e.vtkImageResliceExecute(i,w),t.interpolator.releaseData(),a[0]=w},e.vtkImageResliceExecute=(n,a)=>{const i=n.getPointData().getScalars(),s=a.getPointData().getScalars();let l=s.getData();const c=a.getExtent(),u=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(u);let g=i.getData();const m=i.getDataType(),h=i.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],T=[0,0,0];T[0]=i.getNumberOfComponents(),T[1]=T[0]*b[0],T[2]=T[1]*b[1];const C=b[0]*b[1]*b[2];v>0&&v+hjA.LINEAR||d>1&&t.slabMode===gP.SUM,B=e.getConversionFunc(m,I,t.scalarShift,t.scalarScale,L),N=e.getSetPixelsFunc(I,1,w,l),k=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let F=c[2]-1,_=c[4]-1;const G=[0,0,0,0],U=[0,0,0,0],W=pP.newInstance();W.initialize(a,c,t.stencil,null);const z=W.getScalars(a,0);let H=0;const j=jt.newTypedArray(I,Ui.getDiagonalLength(c)*w*2),K=new Float64Array(h*d),$=new Float64Array(h);for(;!W.isAtEnd();W.nextSpan()){const n=W.spanEndId()-W.getId();if(H=1*W.getId()*w,W.isInStencil()){const r=W.getIndex();r[2]>_&&(_=r[2],G[0]=V[0]+_*R[0],G[1]=V[1]+_*R[1],G[2]=V[2]+_*R[2],G[3]=V[3]+_*R[3],F=c[2]-1),r[1]>F&&(F=r[1],U[0]=G[0]+F*M[0],U[1]=G[1]+F*M[1],U[2]=G[2]+F*M[2],U[3]=G[3]+F*M[3]);const a=r[0],i=a+n-1;if(P){const e=g,t=l,n=1*T[0],r=1*T[1],o=1*T[2],s=x[1]-x[0]+1,c=x[3]-x[2]+1,u=x[5]-x[4]+1;let d=a,p=a-1,f=!1;const m=1*h;for(let t=a;t<=i;t++){const i=[U[0]+t*O[0],U[1]+t*O[1],U[2]+t*O[2]],l=YA(i[0])-x[0],g=YA(i[1])-x[2],h=YA(i[2])-x[4];if(l>=0&&l=0&&g=0&&h1){let e=n-.5*(d-1);e*=p,s[0]=i[0]+e*R[0],s[1]=i[1]+e*R[1],s[2]=i[2]+e*R[2],s[3]=i[3]+e*R[3],g=s}if(f){const e=1/g[3];g[0]*=e,g[1]*=e,g[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),a=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,g,n,a)}if(t.interpolator.checkBoundsIJK(g)){r=1,t.interpolator.interpolateIJK(g,$);for(let e=0;eh&&k(K,h,m/h);for(let e=0;ea?n:r}const g=l-1-(r!==n)-s+1;let m=0;n?(A&&e.rescaleScalars(E,h,i-a+1,t.scalarShift,t.scalarScale),m=B(j,E.subarray(s*h),w,g)):m=N(j,D,w,g);for(let e=0;e{const a=g(new Float64Array(16));return o=null,t.resliceAxes&&d(a,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?b(a,t.resliceTransform.getMatrix(),a):tt("Non homogeneous transform have not yet been ported")),b(a,a,n.getIndexToWorld()),null==o&&b(a,e.getWorldToIndex(),a),d(r,a),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),a=e.getDimensions(),i=[0,a[0]-1,0,a[1]-1,0,a[2]-1],s=new Float64Array(16);t.resliceAxes?h(s,t.resliceAxes):g(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let c=null;za.isIdentity3x3(o)||(c=qf().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const u=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+i[e%2]*r[0],d[1]=n[1]+i[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+i[4+Math.floor(e/4)%2]*r[2],d[3]=1,c&&zi(d,d,c),t.resliceTransform&&l.transformPoint(d,d),zi(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>u[2*e+1]&&(u[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,a)=>{const i=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let i=a;if(n!==ws.FLOAT&&n!==ws.DOUBLE&&!a){const a=e.getDataTypeMinMax(t);let s=(a.min+r)*o,l=(a.max+r)*o;const c=e.getDataTypeMinMax(n),u=c.min,d=c.max;if(s>l){const e=l;l=s,s=e}i=sd}if(i&&n!==ws.FLOAT&&n!==ws.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,a)=>e.clamp(n,r,o,a,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case gP.MIN:n=s;break;case gP.MAX:n=l;break;case gP.MEAN:n=t?u:c;break;case gP.SUM:n=t?f:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,zi(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const a=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],a=e[12+n];t[2*r]===t[2*r+1]&&(a+=o*t[2*n],o=0);const i=XA(o).error,s=XA(a).error;if(0!==i||0!==s)return!1}return!0}}const vP={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:jA.NEAREST,slabMode:gP.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:lP.newInstance(),usePermuteExecute:!1};function yP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vP,n),jt.obj(e,t),jt.algo(e,t,1,1),jt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),jt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),jt.setGetArray(e,t,["outputExtent"],6),jt.setGetArray(e,t,["outputDirection"],9),jt.setGetArray(e,t,["backgroundColor"],4),jt.get(e,t,["resliceAxes"]),hP(e,t)}var bP={newInstance:jt.newInstance(yP,"vtkImageReslice"),extend:yP,...fP};const{InterpolationType:xP}=pg,{vtkErrorMacro:TP}=jt;function CP(e,t){t.classHierarchy.push("vtkImageProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].piecewiseFunction&&(e=t.componentData[r].piecewiseFunction.getMTime(),n=n>e?n:e);return n},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].rGBTransferFunction!==a&&(t.componentData[o].rGBTransferFunction=a,e.modified(),!0)},e.getRGBTransferFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].rGBTransferFunction},e.setPiecewiseFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].piecewiseFunction!==a&&(t.componentData[o].piecewiseFunction=a,e.modified(),!0)},e.getPiecewiseFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].piecewiseFunction},e.setScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=t,o=n;return Number.isInteger(t)||(o=t,r=0),e.setPiecewiseFunction(r,o)},e.getScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e.getPiecewiseFunction(t)},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return TP("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(TP("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(xP.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(xP.LINEAR),e.getInterpolationTypeAsString=()=>jt.enumToString(xP,t.interpolationType)}const SP={independentComponents:!1,interpolationType:xP.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function AP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,SP,n),jt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;e++)t.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}jt.setGet(e,t,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity"]),jt.setGetArray(e,t,["labelOutlineThickness"]),CP(e,t)}var PP={newInstance:jt.newInstance(AP,"vtkImageProperty"),extend:AP};const{vtkDebugMacro:IP}=jt;function wP(e,t){t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=PP.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){IP("Recomputing bounds..."),t.mapperBounds=n.map((e=>e)),e.computeMatrix();const r=new Float64Array(16);m(r,t.matrix),Ui.transformBounds(n,r,t.bounds),t.boundsMTime.modified()}var r;return t.bounds},e.getBoundsForSlice=(n,r)=>{const o=t.mapper.getBoundsForSlice(n,r);if(!Ui.isValid(o))return o;e.computeMatrix();const a=new Float64Array(16);return m(a,t.matrix),Ui.transformBounds(o,a)},e.getMinXBound=()=>e.getBounds()[0],e.getMaxXBound=()=>e.getBounds()[1],e.getMinYBound=()=>e.getBounds()[2],e.getMaxYBound=()=>e.getBounds()[3],e.getMinZBound=()=>e.getBounds()[4],e.getMaxZBound=()=>e.getBounds()[5],e.getMTime=()=>{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}if(null!==t.property){let n=t.property.getMTime();e=n>e?n:e,null!==t.property.getRGBTransferFunction()&&(n=t.property.getRGBTransferFunction().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}const OP={mapper:null,property:null,bounds:[...Ui.INIT_BOUNDS]};function MP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OP,n),us.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["mapper"]),jt.getArray(e,t,["bounds"],6),wP(e,t)}var RP={newInstance:jt.newInstance(MP,"vtkImageSlice"),extend:MP};function VP(e,t){t.classHierarchy.push("vtkInteractorStyleImage"),e.superHandleMouseMove=e.handleMouseMove,e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case BT.IS_WINDOW_LEVEL:e.windowLevel(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case BT.IS_SLICE:e.slice(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}e.superHandleMouseMove(n)},e.superHandleLeftButtonPress=e.handleLeftButtonPress,e.handleLeftButtonPress=n=>{const r=n.position;if(n.shiftKey||n.controlKey)"IMAGE3D"===t.interactionMode&&n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startRotate():"IMAGE_SLICING"===t.interactionMode&&n.controlKey?(t.lastSlicePosition=r.y,e.startSlice()):e.superHandleLeftButtonPress(n);else{t.windowLevelStartPosition[0]=r.x,t.windowLevelStartPosition[1]=r.y,e.setCurrentImageNumber(t.currentImageNumber);const n=t.currentImageProperty;n&&(t.windowLevelInitial[0]=n.getColorWindow(),t.windowLevelInitial[1]=n.getColorLevel()),e.startWindowLevel()}},e.superHandleLeftButtonRelease=e.handleLeftButtonRelease,e.handleLeftButtonRelease=()=>{switch(t.state){case BT.IS_WINDOW_LEVEL:e.endWindowLevel();break;case BT.IS_SLICE:e.endSlice();break;default:e.superHandleLeftButtonRelease()}},e.handleStartMouseWheel=()=>{e.startSlice()},e.handleEndMouseWheel=()=>{e.endSlice()},e.handleMouseWheel=e=>{const t=e.pokedRenderer.getActiveCamera();let n=t.getDistance();n+=e.spinY;const r=t.getClippingRange();nr[1]&&(n=r[1]),t.setDistance(n),e.pokedRenderer.getViewProps().filter((e=>e.isA("vtkImageSlice"))).forEach((t=>{if(t.getMapper().isA("vtkImageResliceMapper")){const n=t.getMapper().getSlicePlane();n&&(n.push(e.spinY),n.modified(),t.getMapper().modified())}}))},e.windowLevel=(e,n)=>{t.windowLevelCurrentPosition[0]=n.x,t.windowLevelCurrentPosition[1]=n.y;const r=t._interactor;if(t.currentImageProperty){const n=r.getView().getViewportSize(e),o=t.windowLevelInitial[0],a=t.windowLevelInitial[1];let i=4*(t.windowLevelCurrentPosition[0]-t.windowLevelStartPosition[0])/n[0],s=4*(t.windowLevelStartPosition[1]-t.windowLevelCurrentPosition[1])/n[1];Math.abs(o)>.01?i*=o:i*=o<0?-.01:.01,Math.abs(a)>.01?s*=a:s*=a<0?-.01:.01,o<0&&(i*=-1),a<0&&(s*=-1);let l=i+o;const c=a-s;l<.01&&(l=.01),t.currentImageProperty.setColorWindow(l),t.currentImageProperty.setColorLevel(c)}},e.slice=(e,n)=>{const r=t._interactor,o=n.y-t.lastSlicePosition,a=e.getActiveCamera(),i=a.getClippingRange();let s=a.getDistance(),l=0;if(a.getParallelProjection())l=2*a.getParallelScale();else{const e=Eo(a.getViewAngle());l=2*s*Math.tan(.5*e)}s+=o*l/r.getView().getViewportSize(e)[1],si[1]&&(s=i[1]-.001*l),a.setDistance(s),t.lastSlicePosition=n.y},e.setCurrentImageNumber=n=>{if(null===n)return;const r=t._interactor.getCurrentRenderer();if(!r)return;t.currentImageNumber=n;const o=r.getViewProps().filter((e=>e.isA("vtkImageSlice")));let a=n;n<0&&(a+=o.length);const i=o.find(((e,t)=>function(e,t,n){return e===n&&t.getNestedPickable()}(t,e,a)));i&&e.setCurrentImageProperty(i.getProperty())},e.setCurrentImageProperty=e=>{t.currentImageProperty=e}}const EP={windowLevelStartPosition:[0,0],windowLevelCurrentPosition:[0,0],lastSlicePosition:0,windowLevelInitial:[1,.5],currentImageNumber:-1,interactionMode:"IMAGE2D",xViewRightVector:[0,1,0],xViewUpVector:[0,0,-1],yViewRightVector:[1,0,0],yViewUpVector:[0,0,-1],zViewRightVector:[1,0,0],zViewUpVector:[0,1,0]};function DP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,EP,n),$T.extend(e,t,n),jt.setGet(e,t,["interactionMode"]),jt.get(e,t,["currentImageProperty"]),VP(e,t)}var LP={newInstance:jt.newInstance(DP,"vtkInteractorStyleImage"),extend:DP};function BP(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ri.intersectWithLine(i,s,n,r).x}function NP(e,t){t.classHierarchy.push("vtkPlaneManipulator"),e.handleEvent=(t,n)=>({worldCoords:BP(t.position.x,t.position.y,e.getOrigin(t),e.getNormal(t),t.pokedRenderer,n)})}function kP(e){return{...e}}function FP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Rx.extend(e,t,kP(n)),NP(e,t)}var _P={intersectDisplayWithPlane:BP,extend:FP,newInstance:jt.newInstance(FP,"vtkPlaneManipulator")};function GP(e,t){t.classHierarchy.push("vtkAbstractWidget"),t.actorToRepresentationMap=new WeakMap,e.getBounds=t.widgetState.getBounds,e.getNestedProps=()=>t.representations,e.activateHandle=n=>{let{selectedState:r,representation:o}=n;t.widgetState.activateOnly(r),t.activeState=r,r&&r.updateManipulator&&r.updateManipulator(),e.invokeActivateHandle({selectedState:r,representation:o}),e.updateCursor&&e.updateCursor()},e.deactivateAllHandles=()=>{t.widgetState.deactivate()},e.hasActor=e=>t.actorToRepresentationMap.has(e),e.grabFocus=()=>{t.hasFocus=!0},e.loseFocus=()=>{t.hasFocus=!1},e.hasFocus=()=>t.hasFocus,e.placeWidget=e=>t.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e),e.getRepresentationFromActor=e=>t.actorToRepresentationMap.get(e),e.updateRepresentationForRender=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lx.FRONT_BUFFER;for(let n=0;nt._factory.getViewWidgets(),e.setPriority(.5)}const UP={contextVisibility:!0,handleVisibility:!0,hasFocus:!1};function WP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UP,n),is.extend(e,t,n),LT.extend(e,t,n),jt.setGet(e,t,["contextVisibility","handleVisibility","_widgetManager"]),jt.get(e,t,["representations","widgetState","activeState"]),jt.moveToProtected(e,t,["widgetManager"]),jt.event(e,t,"ActivateHandle"),GP(e,t)}var zP={newInstance:jt.newInstance(WP,"vtkAbstractWidget"),extend:WP};const{ViewTypes:HP,RenderingTypes:jP,CaptureOn:KP}=cx,{vtkErrorMacro:$P}=jt;let qP=1;function XP(e){const t=e.getActiveCamera(),n=e.getRenderWindow(),r=n.getInteractor(),o=r.getView();return{renderer:e,renderWindow:n,interactor:r,apiSpecificRenderWindow:o,camera:t}}function YP(e,t){const{dispHeightFactor:n,cameraPosition:r,cameraDir:o,isParallel:a,rendererPixelDims:i}=t;let s=1;if(a)s=n;else{const t=[...e];za.subtract(t,r,t),s=za.dot(t,o)*n}return s/i[1]}function ZP(e,t){t.viewId||(t.viewId="view-"+qP++),t.classHierarchy.push("vtkWidgetManager");const n=new WeakMap,r=[];function o(e){return e&&(e.isA("vtkAbstractWidget")?e:e.getWidgetForView({viewId:t.viewId}))}function a(){const{_apiSpecificRenderWindow:e,_camera:n,_renderer:r}=t;if(r&&e&&n){const[o,a]=e.getSize(),[i,s,l,c]=r.getViewport(),u=e.getComputedDevicePixelRatio(),d=[o*(l-i)/u,a*(c-s)/u],p=n.getPosition(),f=n.getDirectionOfProjection(),g=n.getParallelProjection(),m=g?2*n.getParallelScale():2*Math.tan(za.radiansFromDegrees(n.getViewAngle())/2);t.widgets.forEach((e=>{e.getNestedProps().forEach((e=>{e.getScaleInPixels()&&e.setDisplayScaleParams({dispHeightFactor:m,cameraPosition:p,cameraDir:f,isParallel:g,rendererPixelDims:d})}))}))}}async function i(n,r,o){const{position:a}=n,{requestCount:i,selectedState:s,representation:l,widget:c}=await e.getSelectedDataForXY(a.x,a.y);if(i||o!==t._currentUpdateSelectionCallID)return;function u(e){r&&t._interactor.invokeLeftButtonRelease(n),e.activateHandle({selectedState:s,representation:l}),r&&t._interactor.invokeLeftButtonPress(n)}t._apiSpecificRenderWindow.setCursor(c?"pointer":"default"),t.activeWidget=null;let d=!1;if(t.widgetInFocus===c&&c.hasFocus())u(c),t.activeWidget=c,d=!0;else for(let e=0;e1&&void 0!==arguments[1]&&arguments[1];if(!t.isAnimating&&t.pickingEnabled&&e.pokedRenderer===t._renderer){const r=Symbol("UpdateSelection");t._currentUpdateSelectionCallID=r,await i(e,n,r)}};function l(e){e.updateRepresentationForRender(t.renderingType)}function c(){t.renderingType=jP.FRONT_BUFFER,t.widgets.forEach(l)}async function u(e,n,r,o){t._captureInProgress?await t._captureInProgress:(t.renderingType=jP.PICKING_BUFFER,t.widgets.forEach(l),t._capturedBuffers=null,t._captureInProgress=t._selector.getSourceDataAsync(t._renderer,e,n,r,o),t._capturedBuffers=await t._captureInProgress,t._captureInProgress=null,t.previousSelectedData=null,c())}function d(e){t._renderer.removeActor(e),e.delete()}function p(){t._renderer.getRenderWindow().getInteractor().render(),e.renderWidgets()}e.enablePicking=()=>{t.pickingEnabled=!0,e.renderWidgets()},e.renderWidgets=()=>{if(t.pickingEnabled&&t.captureOn===KP.MOUSE_RELEASE){const[e,n]=t._apiSpecificRenderWindow.getSize();u(0,0,e,n)}c(),e.modified()},e.disablePicking=()=>{t.pickingEnabled=!1},e.setRenderer=n=>{const o=XP(n);for(Object.assign(t,o),jt.moveToProtected({},t,Object.keys(o));r.length;)r.pop().unsubscribe();t._selector=t._apiSpecificRenderWindow.createSelector(),t._selector.setFieldAssociation(ll.FIELD_ASSOCIATION_POINTS),r.push(t._apiSpecificRenderWindow.onWindowResizeEvent(a)),r.push(t._camera.onModified(a)),a(),r.push(t._interactor.onStartAnimation((()=>{t.isAnimating=!0}))),r.push(t._interactor.onEndAnimation((()=>{t.isAnimating=!1,e.renderWidgets()}))),r.push(t._interactor.onMouseMove((e=>(s(e),jt.VOID)))),r.push(t._interactor.onLeftButtonPress((e=>{const{deviceType:t}=e,n="touch"===t||"pen"===t;return n&&s(e,n),jt.VOID}),.25)),e.modified(),t.pickingEnabled&&e.enablePicking()},e.addWidget=(r,o,i)=>{if(!t._renderer)return $P("Widget manager MUST BE link to a view before registering widgets"),null;const{viewId:s,_renderer:l}=t,c=r.getWidgetForView({viewId:s,renderer:l,viewType:o||HP.DEFAULT,initialValues:i});return null!=c&&-1===t.widgets.indexOf(c)&&(t.widgets.push(c),(u=c).setWidgetManager(e),function(e){const t=e.getRepresentations();for(let r=0;r{t.widgets.forEach(d),t.widgets=[],t.widgetInFocus=null,p()},e.removeWidget=n=>{const r=o(n),a=t.widgets.indexOf(r);-1!==a&&(t.widgets.splice(a,1),t.widgetInFocus===r&&e.releaseFocus(),d(r),p())},e.getSelectedDataForXY=async(n,r)=>{if(t.selections=null,t.pickingEnabled){if(t._capturedBuffers&&t.captureOn!==KP.MOUSE_MOVE){const e=t._capturedBuffers.area;(ne[2]||re[3])&&await u(n,r,n,r)}else await u(n,r,n,r);t.selections=t._capturedBuffers.generateSelection(n,r,n,r)}return e.getSelectedData()},e.getSelectedData=()=>{if(!t.selections||!t.selections.length)return t.previousSelectedData=null,{};const{propID:e,compositeID:r,prop:o}=t.selections[0].getProperties();let{widget:a,representation:i}=t.selections[0].getProperties();if(t.previousSelectedData&&t.previousSelectedData.prop===o&&t.previousSelectedData.widget===a&&t.previousSelectedData.compositeID===r)return t.previousSelectedData.requestCount++,t.previousSelectedData;if(n.has(o)){const e=n.get(o);a=e.widget,i=e.representation}if(a&&i){const n=i.getSelectedState(o,r);return t.previousSelectedData={requestCount:0,propID:e,compositeID:r,prop:o,widget:a,representation:i,selectedState:n},t.previousSelectedData}return t.previousSelectedData=null,{}},e.grabFocus=e=>{const n=o(e);t.widgetInFocus&&t.widgetInFocus!==n&&t.widgetInFocus.loseFocus(),t.widgetInFocus=n,t.widgetInFocus&&t.widgetInFocus.grabFocus()},e.releaseFocus=()=>e.grabFocus(null);const f=e.delete;e.delete=()=>{for(;r.length;)r.pop().unsubscribe();f()}}const QP={viewId:null,widgets:[],activeWidget:null,renderer:null,viewType:HP.DEFAULT,isAnimating:!1,pickingEnabled:!0,selections:null,previousSelectedData:null,widgetInFocus:null,captureOn:KP.MOUSE_MOVE};function JP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,QP,n),jt.obj(e,t),jt.setGet(e,t,["captureOn",{type:"enum",name:"viewType",enum:HP}]),jt.get(e,t,["selections","widgets","viewId","pickingEnabled","activeWidget"]),ZP(e,t)}var eI={newInstance:jt.newInstance(JP,"vtkWidgetManager"),extend:JP,Constants:cx,getPixelWorldHeightAtCoord:YP};function tI(){}function nI(e,t){t.classHierarchy.push("vtkAbstractWidgetFactory");const n={};e.getWidgetForView=r=>{let{viewId:o,renderer:a,viewType:i,initialValues:s}=r;if(!n[o]){if(!a)return null;const{interactor:r,apiSpecificRenderWindow:l,camera:c}=XP(a),u={},d={};jt.obj(d,u),Object.assign(d,{onWidgetChange:e.onWidgetChange}),Object.assign(u,{widgetState:t.widgetState,manipulator:t.manipulator,viewType:i,renderer:a,camera:c,apiSpecificRenderWindow:l,factory:e}),jt.moveToProtected(d,u,["renderer","camera","apiSpecificRenderWindow","factory"]),jt.get(d,u,["viewType"]),jt.safeArrays(u),zP.extend(d,u,s);const p=s;u.representations=e.getRepresentationsForViewType(i).map((e=>{let{builder:t,labels:n,initialValues:r}=e;return t.newInstance({_parentProp:d,labels:n,...r,...p})})),u.representations.forEach((e=>{e.setInputData(u.widgetState),e.getActors().forEach((t=>{u.actorToRepresentationMap.set(t,e)}))})),t.behavior(d,u),["coincidentTopologyParameters",...t.methodsToLink||[]].forEach((e=>{const t=`set${jt.capitalize(e)}`,n=`get${jt.capitalize(e)}`,r={[e]:[],[t]:[],[n]:[]};u.representations.forEach((o=>{o[e]&&r[e].push(o[e]),o[t]&&r[t].push(o[t]),o[n]&&r[n].push(o[n])})),Object.keys(r).forEach((e=>{const t=r[e];1===t.length?d[e]=t[0]:t.length>1&&(d[e]=jt.chain(...t))}))})),d.delete=jt.chain((()=>{delete n[o]}),d.delete),d.setInteractor(r);const f=Object.freeze(d);return n[o]=f,f}return n[o]},e.getViewIds=()=>Object.keys(n),e.getViewWidgets=()=>Object.values(n),e.setVisibility=e=>{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;rt.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e);let r=tI;e.delete=jt.chain(e.delete,(()=>r())),t.widgetState&&(r=t.widgetState.onModified((()=>e.invokeWidgetChange(t.widgetState))).unsubscribe)}function rI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,n),jt.obj(e,t),jt.get(e,t,["widgetState"]),jt.event(e,t,"WidgetChange"),nI(e,t)}var oI={newInstance:jt.newInstance(rI,"vtkAbstractWidget"),extend:rI};const{vtkWarningMacro:aI}=jt;function iI(e,t){t.classHierarchy.push("vtkPlaneSource"),e.requestData=(n,r)=>{if(t.deleted)return;const o=r[0],a=o?o.getPoints().getDataType():t.pointType,i=Pu.newInstance(),s=[],l=[];if(jo(t.point1,t.origin,s),jo(t.point2,t.origin,l),!e.updatePlane(s,l))return void aI("Bad plane definition");const c=t.xResolution,u=t.yResolution,d=(c+1)*(u+1),p=c*u,f=jt.newTypedArray(a,3*d);i.getPoints().setData(f,3);const g=new Uint32Array(5*p);i.getPolys().setData(g,1);const m=new Float32Array(3*d),h=Us.newInstance({numberOfComponents:3,values:m,name:"Normals"});i.getPointData().setNormals(h);const v=new Float32Array(2*d),y=Us.newInstance({numberOfComponents:2,values:v,name:"TextureCoordinates"});i.getPointData().setTCoords(y);const b=new Float32Array(2);let x=0;for(let e=0;e{if(Math.abs(n)<1e-6)return;const o=g(new Float64Array(16)),a=[];var i,s;i=a,s=t.center,i[0]=-s[0],i[1]=-s[1],i[2]=-s[2],x(o,o,t.center),C(o,o,n,r),x(o,o,a),Ln(t.origin,t.origin,o),Ln(t.point1,t.point1,o),Ln(t.point2,t.point2,o),qf().rotate(n,r).apply(t.normal),e.modified()},e.setCenter=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.center)){const r=[];jo(t.point1,t.origin,r);const o=[];jo(t.point2,t.origin,o);for(let e=0;e<3;e++)t.center[e]=n[e],t.origin[e]=t.center[e]-.5*(r[e]+o[e]),t.point1[e]=t.origin[e]+r[e],t.point2[e]=t.origin[e]+o[e];e.modified()}},e.setPoint1=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.point1)){const r=[],o=[];t.point1=[...n],jo(t.point1,t.origin,r),jo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.setPoint2=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!kn(n,t.point2)){const r=[],o=[];t.point2=[...n],jo(t.point1,t.origin,r),jo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.updatePlane=(e,n)=>{for(let r=0;r<3;r++)t.center[r]=t.origin[r]+.5*(e[r]+n[r]);return Yo(e,n,t.normal),0!==Qo(t.normal)}}const sI={xResolution:10,yResolution:10,origin:[0,0,0],point1:[1,0,0],point2:[0,1,0],pointType:"Float64Array"};function lI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sI,n),t.normal=[0,0,1],t.center=[0,0,0],jt.obj(e,t),jt.setGet(e,t,["xResolution","yResolution"]),jt.setGetArray(e,t,["origin"],3),jt.getArray(e,t,["point1","point2","normal","center"],3),jt.algo(e,t,0,1),iI(e,t),e.setPoint1(t.point1),e.setPoint2(t.point2)}var cI={newInstance:jt.newInstance(lI,"vtkPlaneSource"),extend:lI};const uI={DIRECTION:0,ROTATION:1,MATRIX:2};var dI={OrientationModes:uI,ScaleModes:{SCALE_BY_CONSTANT:0,SCALE_BY_MAGNITUDE:1,SCALE_BY_COMPONENTS:2}};const{OrientationModes:pI,ScaleModes:fI}=dI,{vtkErrorMacro:gI}=jt;function mI(e,t){t.classHierarchy.push("vtkGlyph3DMapper"),e.getOrientationModeAsString=()=>jt.enumToString(pI,t.orientationMode),e.setOrientationModeToDirection=()=>e.setOrientationMode(pI.DIRECTION),e.setOrientationModeToRotation=()=>e.setOrientationMode(pI.ROTATION),e.setOrientationModeToMatrix=()=>e.setOrientationMode(pI.MATRIX),e.getOrientationArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.orientationArray?n.getPointData().getArray(t.orientationArray):n.getPointData().getVectors():null},e.getScaleModeAsString=()=>jt.enumToString(fI,t.scaleMode),e.setScaleModeToScaleByMagnitude=()=>e.setScaleMode(fI.SCALE_BY_MAGNITUDE),e.setScaleModeToScaleByComponents=()=>e.setScaleMode(fI.SCALE_BY_COMPONENTS),e.setScaleModeToScaleByConstant=()=>e.setScaleMode(fI.SCALE_BY_CONSTANT),e.getScaleArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.scaleArray?n.getPointData().getArray(t.scaleArray):n.getPointData().getScalars():null},e.getBounds=()=>{const n=e.getInputData(0),r=e.getInputData(1);return n&&r?(e.buildArrays(),t.bounds):_a()},e.buildArrays=()=>{const n=e.getInputData(0),r=e.getInputData(1);if(t.buildTime.getMTime()t.bounds[1]&&(t.bounds[1]=u[0]),u[1]>t.bounds[3]&&(t.bounds[3]=u[1]),u[2]>t.bounds[5]&&(t.bounds[5]=u[2]);const r=new Float32Array(y,36*e,9);se(r,n),ge(r,r),fe(r,r)}const O=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),t.colorArray=null;const M=e.getLookupTable();M&&O&&(M.build(),t.colorArray=M.mapScalars(O,t.colorMode,0)),t.buildTime.modified()}},e.getPrimitiveCount=()=>{const t=e.getInputData(1),n=e.getInputData().getPoints().getNumberOfValues()/3;return{points:n*t.getPoints().getNumberOfValues()/3,verts:n*(t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells()),lines:n*(t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells()),triangles:n*(t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells())}},e.setSourceConnection=t=>e.setInputConnection(t,1)}const hI={orient:!0,orientationMode:pI.DIRECTION,orientationArray:null,scaling:!0,scaleFactor:1,scaleMode:fI.SCALE_BY_MAGNITUDE,scaleArray:null,matrixArray:null,normalArray:null,colorArray:null};function vI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hI,n),fc.extend(e,t,n),jt.algo(e,t,2,0),t.buildTime={},jt.obj(t.buildTime,{mtime:0}),t.boundsTime={},jt.obj(t.boundsTime,{mtime:0}),jt.setGet(e,t,["orient","orientationMode","orientationArray","scaleArray","scaleFactor","scaleMode","scaling"]),jt.get(e,t,["colorArray","matrixArray","normalArray","buildTime"]),mI(e,t)}var yI={newInstance:jt.newInstance(vI,"vtkGlyph3DMapper"),extend:vI,...dI};const bI=0,xI=1,{vtkErrorMacro:TI,vtkWarningMacro:CI}=jt;function SI(e,t){e&&e.setResolveCoincidentTopologyToPolygonOffset&&(e.setResolveCoincidentTopologyToPolygonOffset(),Yl.forEach((n=>{if(t[n]){const r=`setRelativeCoincidentTopology${n}OffsetParameters`;if(e[r]){const{factor:o,offset:a}=t[n];e[r](o,a)}}})))}function AI(e,t,n,r,o){let a=e[`get${jt.capitalize(t)}`]?.()||e.getPointData().getArrayByName(t);if(!a||void 0!==r&&a.getDataType()!==r||void 0!==o&&a.getNumberOfComponents()!==o){let i=Us,s=r,l=o;"points"===t?(i=Ic,s=s??"Float32Array",l=o??3):bu.includes(t)?(i=xc,s=s??"Uint16Array",l=o??1):(s=s??"Float32Array",l=o??1),a=i.newInstance({name:t,dataType:s,numberOfComponents:l,size:l*n,empty:0===n}),"points"===t||bu.includes(t)?e[`set${jt.capitalize(t)}`](a):e.getPointData().addArray(a)}else a.getNumberOfTuples()!==n&&a.resize(n);return a}function PI(e,t){t.classHierarchy.push("vtkWidgetRepresentation");const n={mtimes:{},states:[]};t._onCoincidentTopologyParametersChanged=()=>{e.getActors().forEach((e=>{SI(e.getMapper(),t.coincidentTopologyParameters)}))},e.getActors=()=>t.actors,e.getNestedProps=e.getActors,e.setLabels=function(){for(var n=arguments.length,r=new Array(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.mtimes.representation===e.getMTime()&&n.mtimes.input===r.getMTime()||(n.mtimes.representation=e.getMTime(),n.mtimes.input=r.getMTime(),n.states=[],t.labels.forEach((e=>{n.states=n.states.concat(r.getStatesWithLabel(e)||[])}))),n.states},e.getSelectedState=(t,n)=>{const r=e.getRepresentationStates();return n0&&void 0!==arguments[0]?arguments[0]:lx.FRONT_BUFFER,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!0;switch(t.behavior){case bI:o=e===lx.PICKING_BUFFER||r;break;case xI:o=n;break;default:o=!0}const a=o;for(let e=0;ee.addActor(t)))},e.addActor=e=>{SI(e.getMapper(),t.coincidentTopologyParameters),Array.prototype.push.apply(t.actors,[e])},e.setLabels(t.labels)}function II(e){return{activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,actors:[],labels:[],behavior:xI,coincidentTopologyParameters:{Point:{factor:-1,offset:-1},Line:{factor:-1,offset:-1},Polygon:{factor:-1,offset:-1}},scaleInPixels:!1,displayScaleParams:{dispHeightFactor:1,cameraPosition:[0,0,0],cameraDir:[1,0,0],isParallel:!1,rendererPixelDims:[1,1]},_internalArrays:{},...e}}var wI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};is.extend(e,t,II(n)),jt.algo(e,t,1,1),jt.get(e,t,["labels","displayScaleParams","coincidentTopologyParameters"]),jt.set(e,t,[{type:"object",name:"displayScaleParams"},{type:"object",name:"coincidentTopologyParameters"}]),jt.setGet(e,t,["scaleInPixels","activeScaleFactor","activeColor","useActiveColor"]),PI(e,t)},OI=function(e){let t=e.source;e.filter&&(t.isA("vtkDataSet")?e.filter.setInputData(t):e.filter.setInputConnection(t.getOutputPort()),t=e.filter),t&&(t.isA("vtkDataSet")?e.mapper.setInputData(t):e.mapper.setInputConnection(t.getOutputPort())),e.glyph&&e.mapper.setInputConnection(e.glyph.getOutputPort(),1),e.actor.setMapper(e.mapper)};function MI(e,t){t.classHierarchy.push("vtkHandleRepresentation")}const RI={behavior:bI,pickable:!0,dragable:!0,scaleInPixels:!0};var VI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...RI,...n};wI(e,t,r),MI(0,t)};function EI(e,t){t.classHierarchy.push("vtkContextRepresentation")}const DI={behavior:xI,pickable:!1,dragable:!0};var LI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...DI,...n};wI(e,t,r),EI(0,t)};function BI(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,n)=>{if(t.deleted)return;let r=n[0];const o=r?r.getPoints().getDataType():t.pointType;r=Pu.newInstance();let a=0,{thetaResolution:i}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let c=t.startPhit.startPhi?t.endPhi:t.startPhi;u*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++i;const d=(l-s)/t.thetaResolution,p=t.startPhi<=0?1:0,f=t.phiResolution+(t.endPhi>=180?-1:0),g=t.phiResolution*i+2,m=2*t.phiResolution*t.thetaResolution;let h=0,v=jt.newTypedArray(o,3*g),y=new Float32Array(3*g),b=0,x=new Uint32Array(5*m);t.startPhi<=0&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]+t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=1,h++,a++),t.endPhi>=180&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]-t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=-1,h++,a++);const T=t.phiResolution-a,C=(u-c)/(t.phiResolution-1);for(let e=0;e=180){const e=T-1+a;for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,NI,n),jt.obj(e,t),jt.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),jt.setGetArray(e,t,["center"],3),jt.algo(e,t,0,1),BI(e,t)}var FI={newInstance:jt.newInstance(kI,"vtkSphereSource"),extend:kI};function _I(e,t){return(e,n)=>{const r=AI(e,"points",n.length).getData();let o=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=AI(e,"color",n.length,"Uint8Array",4),o=r.getData();let a=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=AI(e,"color",n.length).getData();for(let e=0;e{t._pipeline.mapper.setColorByArrayName(null)}}function zI(e,t){return(n,r)=>{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0),t._pipeline.mapper.setScaleMode(yI.ScaleModes.SCALE_BY_COMPONENTS);const o=AI(n,"scale",r.length,"Float32Array",3).getData();let a=0;for(let n=0;n{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0);const o=AI(n,"scale",r.length).getData();for(let n=0;n{t._pipeline.mapper.setScaleArray(null),t._pipeline.mapper.setScaleFactor(t.defaultScale),t._pipeline.mapper.setScaling(1!==t.defaultScale)}}function KI(e,t){return(e,n)=>{t._pipeline.mapper.setOrientationArray("orientation"),t._pipeline.mapper.setOrientationMode(uI.MATRIX);const r=AI(e,"orientation",n.length,"Float32Array",9).getData();for(let e=0;e{t._pipeline.mapper.setOrientationArray(null)}}function qI(e,t){t.classHierarchy.push("vtkGlyphRepresentation");const n={...e},r=Pu.newInstance({mtime:0});function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rnull!=e[0]?.[`get${jt.capitalize(t)}`]?.()))}e.getRepresentationStates=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.getRepresentationStates(e).filter((e=>e.getOrigin?.()&&(e.isVisible?.()??!0)))},e.getMixins=e=>{const n={};return o(e,"origin")?n.position=t.applyMixin.origin:n.position=t.applyMixin.noPosition,o(e,"color3")?n.color=t.applyMixin.color3:o(e,"color")?n.color=t.applyMixin.color:n.color=t.applyMixin.noColor,o(e,"scale3")?n.scale=t.applyMixin.scale3:o(e,"scale1")?n.scale=t.applyMixin.scale1:n.scale=t.applyMixin.noScale,o(e,"direction")?n.orientation=t.applyMixin.direction:n.orientation=t.applyMixin.noOrientation,n},e.requestData=(t,n)=>{const o=e.getRepresentationStates(t[0]);n[0]=r;const a=e.getMixins(o);Object.values(a).forEach((e=>e(r,o))),r.getPoints().modified(),r.modified()},OI(t._pipeline),e.addActor(t._pipeline.actor)}function XI(e,t,n){return{defaultScale:1,...n,_pipeline:{source:n._pipeline?.source??e,glyph:n._pipeline?.glyph??FI.newInstance({phiResolution:8,thetaResolution:8}),mapper:n._pipeline?.mapper??yI.newInstance({scalarMode:Il.USE_POINT_FIELD_DATA}),actor:n._pipeline?.actor??Ps.newInstance({parentProp:e}),...n._pipeline},applyMixin:{origin:n.applyMixin?.origin??_I(0,t),noPosition:n.applyMixin?.noPosition??((e,t)=>{AI(e,"points",0)}),color3:n.applyMixin?.color3??GI(0,t),color:n.applyMixin?.color??UI(0,t),noColor:n.applyMixin?.noColor??WI(0,t),scale3:n.applyMixin?.scale3??zI(e,t),scale1:n.applyMixin?.scale1??HI(e,t),noScale:n.applyMixin?.noScale??jI(0,t),direction:n.applyMixin?.direction??KI(0,t),noOrientation:n.applyMixin?.noOrientation??$I(0,t),...n.applyMixin}}}function YI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.behavior===xI?LI(e,t,XI(e,t,n)):VI(e,t,XI(e,t,n)),"lighting"in n&&t._pipeline.actor.getProperty().setLighting(n.lighting),jt.setGet(e,t._pipeline,["defaultScale"]),jt.get(e,t._pipeline,["glyph","mapper","actor"]),jt.setGet(e,t.applyMixin,Object.keys(t.applyMixin)),qI(e,t)}var ZI={newInstance:jt.newInstance(YI,"vtkGlyphRepresentation"),extend:YI};function QI(e,t){t.classHierarchy.push("vtkPixelSpaceCallbackMapper"),t.callback||(t.callback=()=>{}),e.invokeCallback=(e,n,r,o,a)=>{if(!t.callback)return;const i=n.getCompositeProjectionMatrix(r,-1,1);m(i,i);const s=e.getPoints(),l=new Float64Array(3),c=o.usize,u=o.vsize,d=c/2,p=u/2,f=[];for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JI,n),fc.extend(e,t,n),jt.setGet(e,t,["callback","useZValues"]),QI(e,t)}var tw={newInstance:jt.newInstance(ew,"vtkPixelSpaceCallbackMapper"),extend:ew};function nw(e,t){t.classHierarchy.push("vtkCylinderSource"),e.requestData=function(e,n){if(t.deleted)return;let r=n[0];const o=2*Math.PI/t.resolution;let a=2*t.resolution,i=5*t.resolution;t.capping&&(a=4*t.resolution,i=7*t.resolution+2);const s=jt.newTypedArray(t.pointType,3*a);let l=0;const c=new Uint32Array(i),u=new Float32Array(3*a),d=Us.newInstance({numberOfComponents:3,values:u,name:"Normals"}),p=new Float32Array(2*a),f=Us.newInstance({numberOfComponents:2,values:p,name:"TCoords"}),g=[0,0,0],m=[0,0,0],h=[0,0,0],v=[0,0,0],y=[0,0],b=[0,0],x=null==t.otherRadius?t.radius:t.otherRadius;for(let e=0;e-1*e))).apply(s),r=Pu.newInstance(),r.getPoints().setData(s,3),r.getPolys().setData(c,1),r.getPointData().setNormals(d),r.getPointData().setTCoords(f),n[0]=r}}const rw={height:1,initAngle:0,radius:1,resolution:6,center:[0,0,0],direction:[0,1,0],capping:!0,pointType:"Float64Array"};function ow(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rw,n),jt.obj(e,t),jt.setGet(e,t,["height","initAngle","otherRadius","radius","resolution","capping"]),jt.setGetArray(e,t,["center","direction"],3),jt.algo(e,t,0,1),nw(e,t)}var aw={newInstance:jt.newInstance(ow,"vtkCylinderSource"),extend:ow};function iw(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;e{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)};const r=e.getScale3();e.setScale3(((e,n)=>{if(r(e,n),t.infiniteLine){const t=AI(e,"scale",n.length,"Float32Array",3).getData();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};ZI.extend(e,t,sw(n)),jt.setGet(e,t,["infiniteLine","glyphResolution"]),iw(e,t)}var cw={newInstance:jt.newInstance(lw,"vtkLineHandleRepresentation"),extend:lw};function uw(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;et._pipeline.glyph.getPhiResolution(),e.setGlyphResolution=e=>t._pipeline.glyph.setPhiResolution(e)||t._pipeline.glyph.setThetaResolution(e),e.setDisplayCallback=e=>{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)}}function dw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ZI.extend(e,t,n),uw(e,t)}var pw={newInstance:jt.newInstance(dw,"vtkSphereHandleRepresentation"),extend:dw};function fw(e,t){t._isDragging=!1;let n,r=!1;jt.setGet(e,t,["keepOrthogonality",{type:"object",name:"cursorStyles"}]),e.setCursorStyles({[mx]:"move",[gx]:"alias",[fx]:"pointer",default:"default"}),e.setEnableTranslation=e=>{t.representations[0].setPickable(e),t.representations[2].setPickable(e)},e.setEnableRotation=e=>{t.representations[1].setPickable(e)},e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("rotation").includes(t.activeState)?gx:t.widgetState.getStatesWithLabel("line").includes(t.activeState)?fx:t.widgetState.getStatesWithLabel("center").includes(t.activeState)?mx:null,e.getActiveLineName=()=>function(e){return Sx(Object.keys(e.getPlanes()).map((e=>yx[e])))}(t.widgetState).find((e=>t.widgetState.getStatesWithLabel(e).includes(t.activeState))),e.getActiveLineHandle=()=>t.widgetState[`getAxis${e.getActiveLineName()}`]?.(),e.getOtherLineHandle=e=>t.widgetState[`getAxis${Ax(t.widgetState,e)}`]?.(),e.getActiveRotationPointName=()=>t.widgetState.getStatesWithLabel("point0").includes(t.activeState)?"point0":t.widgetState.getStatesWithLabel("point1").includes(t.activeState)?"point1":null,e.startScrolling=t=>{t&&(n=t),r=!0,e.startInteraction()},e.endScrolling=()=>{r=!1,e.endInteraction()},e.updateCursor=()=>{const n=e.getCursorStyles();if(n)switch(e.getActiveInteraction()){case mx:t._apiSpecificRenderWindow.setCursor(n.translateCenter);break;case gx:t._apiSpecificRenderWindow.setCursor(n.rotateLine);break;case fx:t._apiSpecificRenderWindow.setCursor(n.translateAxis);break;default:t._apiSpecificRenderWindow.setCursor(n.default)}},e.handleLeftButtonPress=r=>{if(t.activeState&&t.activeState.getActive()){t._isDragging=!0;const o=t.viewType,a=t.widgetState.getPlanes()[o].normal,i=t.activeState?.getManipulator?.()??t.manipulator;i.setWidgetOrigin(t.widgetState.getCenter()),i.setWidgetNormal(a);const{worldCoords:s}=i.handleEvent(r,t._apiSpecificRenderWindow);n=s,e.startInteraction()}else{if(t.widgetState.getScrollingMethod()!==dx)return jt.VOID;e.startScrolling(r.position)}return jt.EVENT_ABORT},e.handleMouseMove=o=>{if(t._isDragging)return e.handleEvent(o);if(r&&n.y!==o.position.y){const t=n.y-o.position.y;e.translateCenterOnPlaneDirection(t),n=o.position,e.invokeInternalInteractionEvent()}return jt.VOID},e.handleLeftButtonRelease=()=>{(t._isDragging||r)&&e.endScrolling(),t._isDragging=!1,t.widgetState.deactivate()},e.handleRightButtonPress=n=>{t.widgetState.getScrollingMethod()===px&&e.startScrolling(n.position)},e.handleRightButtonRelease=()=>{t.widgetState.getScrollingMethod()===px&&e.endScrolling()},e.handleStartMouseWheel=()=>{e.startInteraction()},e.handleMouseWheel=t=>{const n=t.spinY;return r=!0,e.translateCenterOnPlaneDirection(n),e.invokeInternalInteractionEvent(),r=!1,jt.EVENT_ABORT},e.handleEndMouseWheel=()=>{e.endScrolling()},e.handleMiddleButtonPress=n=>{t.widgetState.getScrollingMethod()===ux&&e.startScrolling(n.position)},e.handleMiddleButtonRelease=()=>{t.widgetState.getScrollingMethod()===ux&&e.endScrolling()},e.handleEvent=n=>t.activeState.getActive()?(e[e.getActiveInteraction()](n),e.invokeInternalInteractionEvent(),jt.EVENT_ABORT):jt.VOID,e.invokeInternalInteractionEvent=()=>{const t=e.getActiveInteraction(),n=t!==gx,r=t===gx;e.invokeInteractionEvent({computeFocalPointOffset:n,canUpdateFocalPoint:r})},e.startInteraction=()=>{e.invokeStartInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().requestAnimation(e)}))},e.endInteraction=()=>{e.invokeEndInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().cancelAnimation(e)}))},e.translateCenterOnPlaneDirection=n=>{const r=t.widgetState.getPlanes()[t.viewType].normal,o=t.widgetState.getCenter(),a=t.widgetState.getImage().getSpacing(),i=r.map((e=>Math.abs(e))),s=i.indexOf(Math.max(...i)),l=n*a[s]/Math.abs(r[s]);let c=[o[0]+l*r[0],o[1]+l*r[1],o[2]+l*r[2]];c=e.getBoundedCenter(c),t.widgetState.setCenter(c),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[fx]=r=>{const o=e.getActiveLineHandle(),a=e.getActiveLineName(),i=Ho(o.getOrigin(),o.getDirection(),[]),s=o.getDirection();Qo(s);const l=e.getOtherLineHandle(a),c=t.widgetState.getCenter(),u=t.activeState?.getManipulator?.()??t.manipulator;let d=null,p=[];if(t.activeState?.getManipulator?.())d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Ho(c,jo(d,n,[]),p);else if(l){const e=l.getDirection();Qo(e);const n=e,a=Xo(s,e);1!==a&&-1!==a||Yo(s,u.getWidgetNormal(),n);const f=[];d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,su.distanceToLine(d,o.getOrigin(),i,f),p=qo(c,n,Xo(jo(d,f,[]),n),p)}p=e.getBoundedCenter(p),t.widgetState.setCenter(p),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition()),n=d},e.getBoundedCenter=e=>{const n=t.widgetState.getCenter(),r=t.widgetState.getImage().getBounds();return Ui.containsPoint(r,...e)?e:function(e,t,n){const r=[0,0,0];jo(t,e,r);const o=[0,0,0];return Ui.intersectBox(n,e,r,o,[0,0,0]),o}(e,n,r)},e[mx]=r=>{const o=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:a}=o.handleEvent(r,t._apiSpecificRenderWindow),i=jo(a,n,[]);n=a;let s=Ho(t.widgetState.getCenter(),i,[]);s=e.getBoundedCenter(s),t.widgetState.setCenter(s),Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[gx]=n=>{const r=e.getActiveLineHandle(),o=t.activeState?.getManipulator?.()??t.manipulator,a=o.getWidgetNormal(),{worldCoords:i}=o.handleEvent(n,t._apiSpecificRenderWindow);if(!i||!i.length)return;const s=[0,0,0];jo(i,t.widgetState.getCenter(),s),Qo(s);const l=r.getDirection();Qo(l);const c=e.getActiveRotationPointName();("point1"===c||!c&&Xo(s,l)<0)&&Ko(l,-1);const u=ta(l,s,a);e.rotateLineInView(e.getActiveLineName(),u)},e.rotateLineInView=(n,r)=>{const o=bx[Tx(n)],a=bx[Cx(n)],i=t.widgetState.getPlanes()[a].normal;if(e.rotatePlane(o,r,i),e.getKeepOrthogonality()){const o=Tx(Ax(t.widgetState,n));e.rotatePlane(bx[o],r,i)}Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.rotatePlane=(e,n,r)=>{const{normal:o,viewUp:a}=t.widgetState.getPlanes()[e],i=xx(o,r,n),s=xx(a,r,n);t.widgetState.getPlanes()[e]={normal:i,viewUp:s}}}const gw="default";function mw(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function hw(e,t){t.classHierarchy.push("vtkWidgetState");const n=[];t.labels={},t.nestedStates=[],e.bindState=function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[gw];if(t.nestedStates.push(r),n.push(r.onModified(e.modified)),Array.isArray(o)&&o.length)for(let e=0;e{for(;n.length;)n.pop().unsubscribe();mw(t.nestedStates,r);for(let r=0;r{mw(t.labels[e],r)}))},e.unbindAll=()=>{for(;n.length;)n.pop().unsubscribe();t.nestedStates=[]},e.activate=()=>e.setActive(!0),e.deactivate=n=>{n!==e&&e.setActive(!1);for(let e=0;e{t&&t.setActive(!0),e.deactivate(t)},e.getStatesWithLabel=e=>t.labels[e],e.getAllNestedStates=()=>t.nestedStates,e.delete=jt.chain(e.unbindAll,e.delete)}const vw={active:!1};var yw=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vw,n),jt.obj(e,t),jt.setGet(e,t,["active"]),hw(e,t)};function bw(e,t){const n=[],r=[...Ui.INIT_BOUNDS];e.containsPoint=(e,t,n)=>Array.isArray(e)?Ui.containsPoint(r,e[0],e[1],e[2]):Ui.containsPoint(r,e,t,n),e.placeWidget=o=>{t.bounds=[];const a=[(o[0]+o[1])/2,(o[2]+o[3])/2,(o[4]+o[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];n[e]=o[e],t.bounds[e]=(o[e]-r)*t.placeFactor+r}Ui.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()},e.setPlaceFactor=o=>{if(t.placeFactor!==o){t.placeFactor=o,t.bounds=[];const a=[(n[0]+n[1])/2,(n[2]+n[3])/2,(n[4]+n[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];t.bounds[e]=(n[e]-r)*t.placeFactor+r}Ui.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()}}}const xw={bounds:[-1,1,-1,1,-1,1],placeFactor:1};var Tw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xw,n),jt.setGetArray(e,t,["bounds"],6),jt.get(e,t,["placeFactor"]),jt.event(e,t,"BoundsChange"),t.bounds=t.bounds.slice(),bw(e,t)}};const Cw={color:.5};var Sw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cw,n),jt.setGet(e,t,["color"])}};const Aw={color3:[255,255,255],opacity:255};var Pw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Aw,n),jt.setGetArray(e,t,["color3"],3,255),jt.setGet(e,t,["opacity"])}};function Iw(e,t){e.translate=(t,n,r)=>{const[o,a,i]=e.getCornerByReference();e.setCorner(o+t,a+n,i+r)}}const ww={corner:[0,0,0]};var Ow={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ww,n),jt.setGetArray(e,t,["corner"],3),Iw(e)}};function Mw(e,t){const n="degree"===t.angleUnit?$f():qf();e.rotateFromDirections=(r,o)=>{n.identity().rotateFromDirections(r,o).apply(t.direction),e.modified()},e.rotate=(e,r)=>{n.identity().rotate(e,r).apply(t.direction)},e.rotateX=e=>{n.identity().rotateX(e).apply(t.direction)},e.rotateY=e=>{n.identity().rotateY(e).apply(t.direction)},e.rotateZ=e=>{n.identity().rotateZ(e).apply(t.direction)}}const Rw={direction:[1,0,0]};var Vw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rw,n),jt.setGetArray(e,t,["direction"],3),Mw(e,t)}};function Ew(e,t){e.updateManipulator=()=>{if(t.manipulator){const{origin:e,normal:n,direction:r}=t,{setHandleOrigin:o,setHandleCenter:a,setHandleNormal:i,setHandleDirection:s}=t.manipulator;e&&o?o(e):e&&a&&a(e),r&&s?s(r):r&&!n&&i?i(r):n&&s&&s(n)}}}const Dw={manipulator:null};var Lw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dw,n),jt.setGet(e,t,["manipulator"]),Ew(e,t)}};const Bw={name:""};var Nw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bw,n),jt.setGet(e,t,["name"])}};function kw(e,t){return 3===e.length&&3===t.length&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Fw(e,t){const n={o:[],p1:[],p2:[]};e.normalize=()=>{Qo(t.up),Qo(t.right),Qo(t.direction),e.modified()},e.updateFromOriginRightUp=(r,o,a)=>{(function(e,t,n,r){return kw(e,r.o)&&kw(t,r.p1)&&kw(n,r.p2)})(r,o,a,n)||(n.o=r.slice(),n.p1=o.slice(),n.p2=a.slice(),t.up=[a[0]-r[0],a[1]-r[1],a[2]-r[2]],t.right=[o[0]-r[0],o[1]-r[1],o[2]-r[2]],Yo(t.up,t.right,t.direction),Yo(t.direction,t.up,t.right),e.normalize(),e.modified())}}const _w={up:[0,1,0],right:[1,0,0],direction:[0,0,1]};var Gw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_w,n),jt.setGetArray(e,t,["up","right","direction"],3),Fw(e,t)}};function Uw(e,t){const n={...e};e.translate=(t,n,r)=>{const[o,a,i]=e.getOriginByReference();e.setOrigin(o+t,a+n,i+r)},e.getOrigin=e=>{const r=n.getOrigin();if(!t.offset)return r;if(!e)return za.add(r,t.offset,r);const o=YP(r,e),{rendererPixelDims:a}=e,i=Math.min(a[0],a[1]);return za.multiplyAccumulate(r,t.offset,i*o,r)}}const Ww={origin:null,offset:null};var zw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ww,n),jt.setGetArray(e,t,["origin","offset"],3),Uw(e,t)}};const Hw={scale1:.5};var jw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hw,n),jt.setGet(e,t,["scale1"])}};const Kw={scale3:[1,1,1]};var $w={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kw,n),jt.setGetArray(e,t,["scale3"],3)}};const qw={text:"DefaultText"};var Xw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qw,n),jt.setGet(e,t,["text"])}};const Yw={visible:!0};var Zw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yw,n),jt.setGet(e,t,["visible"]),e.isVisible=e.getVisible}};const Qw={shape:""};var Jw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qw,n),jt.setGet(e,t,["shape"])}};const{vtkErrorMacro:eO}=jt,tO={bounds:Tw,color:Sw,color3:Pw,corner:Ow,direction:Vw,manipulator:Lw,name:Nw,orientation:Gw,origin:zw,scale1:jw,scale3:$w,text:Xw,visible:Zw,shape:Jw};function nO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];o||yw(n,r,t);for(let o=0;o{const r=nO(n,{...o,...e});return this.publicAPI.bindState(r,t),this.model[a].push(r),this.publicAPI.modified(),r},this.publicAPI[`remove${jt.capitalize(r)}`]=e=>{let t=this.model[a].indexOf(e);-1===t&&ethis.model[a].slice(),this.publicAPI[`clear${jt.capitalize(r)}List`]=()=>{for(;this.model[a].length;){const e=this.model[a].pop();e&&this.publicAPI.unbindState(e)}this.publicAPI.modified()},this}addStateFromMixin(e){let{labels:t,mixins:n,name:r,initialValues:o}=e;const a=nO(n,o);return this.model[r]=a,this.publicAPI.bindState(a,t),jt.setGet(this.publicAPI,this.model,[r]),this}addStateFromInstance(e){let{labels:t,name:n,instance:r}=e;return this.model[n]=r,this.publicAPI.bindState(r,t),jt.setGet(this.publicAPI,this.model,[n]),this}addField(e){let{name:t,initialValue:n}=e;return Array.isArray(n)?jt.setGetArray(this.publicAPI,this.model,[t],n.length):jt.setGet(this.publicAPI,this.model,[t]),this.model[t]=n,this}build(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:vx;const t=oO().addField({name:"center",initialValue:[0,0,0]}).addField({name:"image",initialValue:null}).addField({name:"activeViewType",initialValue:null}).addField({name:"planes",initialValue:e.reduce(((e,t)=>({...e,[bx[t]]:{normal:aO[t].normal,viewUp:aO[t].viewUp}})),{})}).addField({name:"scrollingMethod",initialValue:ux}).addField({name:"cameraOffsets",initialValue:{}}).addField({name:"viewUpFromViewType",initialValue:{}}).addStateFromMixin({labels:["handles","sphere","center"],mixins:["origin","color3","scale1","visible","manipulator"],name:"centerHandle",initialValues:{scale1:30,color3:[255,255,255]}});return e.reduce(((t,n)=>e.filter((e=>e!==n)).reduce(((e,t)=>{e.addStateFromMixin({labels:["handles","line",`lineIn${n}`,`${t}in${n}`],mixins:["origin","color3","scale3","orientation","visible","manipulator"],name:`axis${t}in${n}`,initialValues:{scale3:[4,4,4],color3:iO[t]}});for(let r=0;r<2;++r)e.addStateFromMixin({labels:["handles","sphere","rotation",`rotationIn${n}`,`${t}in${n}`,`point${r}`],mixins:["origin","color3","scale1","visible","manipulator"],name:`rotationHandle${t}in${n}${r}`,initialValues:{scale1:30,color3:iO[t]}});return e}),t)),t),t.build()}const{vtkErrorMacro:lO}=jt;function cO(e,t){t.classHierarchy.push("vtkResliceCursorWidget"),t.methodsToLink=["scaleInPixels"],e.getRepresentationsForViewType=e=>{switch(e){case sx.XY_PLANE:case sx.XZ_PLANE:case sx.YZ_PLANE:return[{builder:cw,labels:[`lineIn${yx[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels}},{builder:pw,labels:[`rotationIn${yx[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}},{builder:pw,labels:["center"],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}}];case sx.DEFAULT:case sx.GEOMETRY:case sx.SLICE:case sx.VOLUME:default:return[]}},e.setImage=e=>{t.widgetState.setImage(e);const n=e.getCenter();t.widgetState.setCenter(n),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)},e.setCenter=n=>{t.widgetState.setCenter(n),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition),e.modified()},e.updateCameraPoints=(n,r,o,a,i)=>{e.resetCamera(n,r,o,a),i&&function(e,n){const r=n.getActiveCamera().getFocalPoint(),o=t.widgetState.getCenter(),a=n.getRenderWindow().getViews()[0].getViewportSize(n),i=a[0]/a[1],s=jo(n.worldToNormalizedDisplay(...r,i),n.worldToNormalizedDisplay(...o,i),[0,0,0]),l=t.widgetState.getCameraOffsets();l[e]=s,t.widgetState.setCameraOffsets(l)}(r,n)},e.resetCamera=(n,r,o,a)=>{const i=t.widgetState.getImage().getCenter(),s=n.getActiveCamera().getFocalPoint(),l=n.getActiveCamera().getPosition(),c=Math.sqrt(ea(l,s)),u=e.getPlaneNormalFromViewType(r),d=o?i:s,p=qo(d,u,c,[0,0,0]);n.getActiveCamera().setFocalPoint(...d),n.getActiveCamera().setPosition(...p),n.getActiveCamera().setViewUp(t.widgetState.getPlanes()[r].viewUp),function(e,n,r,o,a){const i=e.getActiveCamera().getFocalPoint(),s=e.getActiveCamera().getDistance(),l=qo(i,n,s,[0,0,0]);let c=i;if(o&&(c=ri.intersectWithLine(i,l,t.widgetState.getCenter(),n).x),a){const o=t.widgetState.getCenter(),a=e.getRenderWindow().getViews()[0].getViewportSize(e),i=a[0]/a[1],s=Ho(e.worldToNormalizedDisplay(...o,i),t.widgetState.getCameraOffsets()[r],[0,0,0]),u=e.normalizedDisplayToWorld(...s,i),d=ri.intersectWithLine(u,l,o,n);c[0]=d.x[0],c[1]=d.x[1],c[2]=d.x[2]}e.getActiveCamera().setFocalPoint(c[0],c[1],c[2]);const u=qo(c,n,s,[0,0,0]);e.getActiveCamera().setPosition(u[0],u[1],u[2]);const d=t.widgetState.getImage().getBounds();o&&e.resetCamera(d),e.resetCameraClippingRange(d)}(n,u,r,o,a)},e.getPlaneSource=n=>{const r=function(n){const r=t.widgetState.getImage().getBounds(),o=e.getWidgetState().getCenter(),a=t.widgetState.getImage().getCenter(),i=[];for(let e=0;e<3;e++)i[e]=-Math.abs(o[e]-a[e]),i[e]*=2;const s=cI.newInstance();return n===sx.XZ_PLANE?(s.setOrigin(r[0]+i[0],o[1],r[4]+i[2]),s.setPoint1(r[1]-i[0],o[1],r[4]+i[2]),s.setPoint2(r[0]+i[0],o[1],r[5]-i[2])):n===sx.XY_PLANE?(s.setOrigin(r[0]+i[0],r[2]+i[1],o[2]),s.setPoint1(r[1]-i[0],r[2]+i[1],o[2]),s.setPoint2(r[0]+i[0],r[3]-i[1],o[2])):n===sx.YZ_PLANE&&(s.setOrigin(o[0],r[2]+i[1],r[4]+i[2]),s.setPoint1(o[0],r[3]-i[1],r[4]+i[2]),s.setPoint2(o[0],r[2]+i[1],r[5]-i[2])),s}(n),{normal:o,viewUp:a}=t.widgetState.getPlanes()[n];!function(e,t,n,r){e.setNormal(n);const o=ta(jo(e.getPoint2(),e.getOrigin(),[]),r,n);e.rotate(o,n),e.setCenter(t)}(r,t.widgetState.getCenter(),o,a);const i=[...r.getOrigin()],s=[...r.getPoint1()],l=[...r.getPoint2()];return function(e,t,n,r){const o=[];jo(n,t,o),Qo(o);const a=[];jo(r,t,a),Qo(a);const i=[0,0,1];Yo(o,a,i),Qo(i);const s=[...e],l=[...i];Ko(l,1e-6),Ui.addBounds(s,e[0]+l[0],e[1]+l[0],e[2]+l[1],e[3]+l[1],e[4]+l[2],e[5]+l[2]),Ui.addBounds(s,e[0]-l[0],e[1]-l[0],e[2]-l[1],e[3]-l[1],e[4]-l[2],e[5]-l[2]);const c=ri.newInstance();c.setOrigin(...t),c.setNormal(...i);const u=eg.newInstance();u.setBounds(s);const d=zf.newInstance();d.setCutFunction(c),d.setInputConnection(u.getOutputPort());const p=d.getOutputData();if(0===p.getNumberOfPoints())return!1;const f=_i.computeLocalBounds(p.getPoints(),o,a,i);for(let e=0;e<3;e+=1)t[e]=f[0]*o[e]+f[2]*a[e]+f[4]*i[e],n[e]=f[1]*o[e]+f[2]*a[e]+f[4]*i[e],r[e]=f[0]*o[e]+f[3]*a[e]+f[4]*i[e]}(t.widgetState.getImage().getBounds(),i,s,l),r.setOrigin(...i),r.setPoint1(...s),r.setPoint2(...l),r},e.getResliceAxes=n=>{const r=e.getPlaneSource(n),{normal:o}=t.widgetState.getPlanes()[n],a=r.getOrigin(),i=[];jo(r.getPoint1(),a,i),Qo(i);const s=[];jo(r.getPoint2(),a,s),Qo(s);const l=g(new Float64Array(16));for(let e=0;e<3;e++)l[e]=i[e],l[4+e]=s[e],l[8+e]=o[e],l[12+e]=a[e];return l},e.updateReslicePlane=(n,r)=>{const o=t.widgetState.getImage().getSpacing(),a=e.getPlaneSource(r),i=e.getResliceAxes(r),s=a.getOrigin(),l=jo(a.getPoint1(),s,[]),c=Qo(l),u=jo(a.getPoint2(),s,[]),d=Qo(u),p=Math.abs(l[0]*o[0])+Math.abs(l[1]*o[1])+Math.abs(l[2]*o[2]),f=Math.abs(u[0]*o[0])+Math.abs(u[1]*o[1])+Math.abs(u[2]*o[2]);let g=0,m=0;const h=0===p?Number.MAX_SAFE_INTEGER:c/p,v=1073741823;if(h>v)lO("Invalid X extent: ",h," on view type : ",r),g=0;else for(g=1;gv)lO("Invalid Y extent:",y," on view type : ",r),m=0;else for(m=1;m{const n=cI.newInstance(),r=e.getWidgetState().getCenter(),o=e.getPlaneNormalFromViewType(t);return n.setNormal(o),n.setOrigin(r),n},e.getPlaneNormalFromViewType=t=>e.getWidgetState().getPlanes()[t].normal,e.getOtherPlaneNormals=t=>[sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE].filter((e=>e!==t)).map((t=>e.getPlaneNormalFromViewType(t))),e.getResliceMatrix=()=>{const t=g(new Float64Array(16));for(let n=0;n<3;n++)t[4*n+0]=e.getPlaneNormalFromViewType(sx.YZ_PLANE)[n],t[4*n+1]=e.getPlaneNormalFromViewType(sx.XZ_PLANE)[n],t[4*n+2]=e.getPlaneNormalFromViewType(sx.XY_PLANE)[n];const n=e.getWidgetState().getCenter();return qf().translate(...n).multiply(t).translate(...Ko([...n],-1)).getMatrix()},e.getDisplayScaleParams=()=>[sx.YZ_PLANE,sx.XZ_PLANE,sx.XY_PLANE].reduce(((t,n)=>(t[n]=function(t){const n=function(t){return e.getViewIds().map((t=>e.getWidgetForView({viewId:t}))).find((e=>e.getViewType()===t))}(t);return n?n.getRepresentations():[]}(n)[0]?.getDisplayScaleParams?.(),t)),{}),e.setScaleInPixels=jt.chain(e.setScaleInPixels,(n=>{e.getViewWidgets().forEach((e=>e.setScaleInPixels(n))),Ix(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)}))}const uO=e=>({behavior:fw,widgetState:sO(e.planes),rotationHandlePosition:.5,scaleInPixels:!0,manipulator:_P.newInstance(),...e});function dO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uO(n)),oI.extend(e,t,n),jt.setGet(e,t,["scaleInPixels","rotationHandlePosition","manipulator"]),cO(e,t)}var pO={newInstance:jt.newInstance(dO,"vtkResliceCursorWidget"),extend:dO};const fO={Aorta:JSON.parse('{"position":[176.85899353027344,215.45899963378906,145,165.48199462890625,217.89700317382812,130,163.85699462890625,217.0850067138672,115,165.48199462890625,209.77099609375,102.5,167.28799438476562,201.093994140625,98.57510375976562,174.79299926757812,191.25,88.81770324707031,178.03799438476562,181.38800048828125,82.13870239257812,184.55099487304688,171.56199645996094,79.0604019165039,184.55099487304688,150.468994140625,82.81320190429688,186.052001953125,143.43699645996094,90.31880187988281,187.42300415039062,133.38299560546875,107.5,187.42300415039062,129.31900024414062,127.5,189.0489959716797,127.69400024414062,135,189.0489959716797,128.5070037841797,147.5,189.7259979248047,133.00799560546875,165.4510040283203,190.6739959716797,145.57200622558594,195,191.48599243164062,155.32400512695312,215,194.73699951171875,166.7010040283203,240,197.1750030517578,175.63999938964844,257.5,197.98800659179688,187.01699829101562,282.5,200.42599487304688,192.7050018310547,302.5,197.1750030517578,200.0189971923828,330],"orientation":[1,0,0,0,0,0.9870474934577942,0.16042834520339966,0,0,0.16042834520339966,-0.9870474934577942,0,0,0,0,1,1,0,0,0,0,0.9985343813896179,0.05412080138921738,0,0,0.05412080138921738,-0.9985343813896179,0,0,0,0,1,1,0,0,0,0,0.9590081572532654,-0.2833784520626068,0,0,-0.2833784520626068,-0.9590081572532654,0,0,0,0,1,1,0,0,0,0,0.7165071368217468,-0.6975797414779663,0,0,-0.6975797414779663,-0.7165071368217468,0,0,0,0,1,1,0,0,0,0,0.5941906571388245,-0.804324209690094,0,0,-0.804324209690094,-0.5941906571388245,0,0,0,0,1,1,0,0,0,0,0.6405233144760132,-0.7679387331008911,0,0,-0.7679387331008911,-0.6405233144760132,0,0,0,0,1,1,0,0,0,0,0.4440542161464691,-0.8959999084472656,0,0,-0.8959999084472656,-0.4440542161464691,0,0,0,0,1,1,0,0,0,0,-0.021809855476021767,-0.9997621178627014,0,0,-0.9997621178627014,0.021809855476021767,0,0,0,0,1,1,0,0,0,0,-0.3716296851634979,-0.9283810257911682,0,0,-0.9283810257911682,0.3716296851634979,0,0,0,0,1,1,0,0,0,0,-0.8222679495811462,-0.5691004991531372,0,0,-0.5691004991531372,0.8222679495811462,0,0,0,0,1,1,0,0,0,0,-0.9348742365837097,-0.35497915744781494,0,0,-0.35497915744781494,0.9348742365837097,0,0,0,0,1,1,0,0,0,0,-0.9792650938034058,-0.20258307456970215,0,0,-0.20258307456970215,0.9792650938034058,0,0,0,0,1,1,0,0,0,0,-0.9991768598556519,-0.04056640341877937,0,0,-0.04056640341877937,0.9991768598556519,0,0,0,0,1,1,0,0,0,0,-0.9851123690605164,0.17191165685653687,0,0,0.17191165685653687,0.9851123690605164,0,0,0,0,1,1,0,0,0,0,-0.9411081671714783,0.33810555934906006,0,0,0.33810555934906006,0.9411081671714783,0,0,0,0,1,1,0,0,0,0,-0.9117909073829651,0.41065481305122375,0,0,0.41065481305122375,0.9117909073829651,0,0,0,0,1,1,0,0,0,0,-0.9051862955093384,0.42501509189605713,0,0,0.42501509189605713,0.9051862955093384,0,0,0,0,1,1,0,0,0,0,-0.9022176265716553,0.43128111958503723,0,0,0.43128111958503723,0.9022176265716553,0,0,0,0,1,1,0,0,0,0,-0.9022176265716553,0.43128111958503723,0,0,0.43128111958503723,0.9022176265716553,0,0,0,0,1,1,0,0,0,0,-0.9350248575210571,0.3545822501182556,0,0,0.3545822501182556,0.9350248575210571,0,0,0,0,1,1,0,0,0,0,-0.9645187854766846,0.2640141546726227,0,0,0.2640141546726227,0.9645187854766846,0,0,0,0,1,1,0,0,0,0,-0.9664039015769958,0.25702813267707825,0,0,0.25702813267707825,0.9664039015769958,0,0,0,0,1]}'),Spine:JSON.parse('{"position":[160.4759162404053,183.8086909344981,2.5000000000000564,159.36266071728213,177.68578555732046,15.000000000000057,161.03254400196693,165.99660256452688,27.500000000000057,163.81568280977493,151.52428076392528,42.50000000000006,166.04219385602133,139.83509777113167,57.50000000000006,167.71207714070613,128.14591477833807,72.50000000000006,166.59882161758293,119.79649835491408,90.00000000000006,166.04219385602133,112.00370969305168,112.50000000000006,166.59882161758293,109.77719864680527,132.50000000000006,166.04219385602133,109.77719864680527,150.00000000000006,167.71207714070613,113.67359297773648,172.50000000000006,172.16509923319893,118.68324283179088,195.00000000000006,173.83498251788373,122.57963716272208,207.50000000000006,177.7313768488149,124.80614820896851,217.50000000000006,180.5145156566229,133.7121923939541,240.00000000000006,189.4205598416085,146.5146309098709,267.50000000000006,191.0904431262933,159.31706942578768,297.50000000000006,187.7506765569237,170.44962465701968,330.00000000000006],"orientation":[1,0,0,0,0,-0.8951910891649871,-0.43849362667598396,0,0.07972611394108559,0.43849362667598396,-0.8951910891649871,0,0,0,0,1,1,0,0,0,0,-0.8142932282848118,-0.5801705176511281,0,-0.01813032867659868,0.5801705176511281,-0.8142932282848118,0,0,0,0,1,1,0,0,0,0,-0.7195837665033622,-0.6845597875137116,0,-0.11652081489595105,0.6845597875137116,-0.7195837665033622,0,0,0,0,1,1,0,0,0,0,-0.7477784430289229,-0.6521003107232924,0,-0.12487027226616237,0.6521003107232924,-0.7477784430289229,0,0,0,0,1,1,0,0,0,0,-0.7846711616302167,-0.6114776531642354,0,-0.10191294219403924,0.6114776531642354,-0.7846711616302167,0,0,0,0,1,1,0,0,0,0,-0.8511163169270675,-0.5247747363540923,0,-0.01457707600983591,0.5247747363540923,-0.8511163169270675,0,0,0,0,1,1,0,0,0,0,-0.9266413781634073,-0.3739508791706536,0,0.03868457370730903,0.3739508791706536,-0.9266413781634073,0,0,0,0,1,1,0,0,0,0,-0.9733185352162832,-0.22945812037151517,0,0,0.22945812037151517,-0.9733185352162832,0,0,0,0,1,1,0,0,0,0,-0.9982420327181917,-0.05926925100465373,0,0,0.05926925100465373,-0.9982420327181917,0,0,0,0,1,1,0,0,0,0,-0.9949075323347023,0.09691380171974212,0,-0.027689657634212037,-0.09691380171974212,-0.9949075323347023,0,0,0,0,1,1,0,0,0,0,-0.9723492573007179,0.19243967663906952,0,-0.13230227768936031,-0.19243967663906952,-0.9723492573007179,0,0,0,0,1,1,0,0,0,0,-0.9554829059915173,0.24313065653596855,0,-0.16715232636847838,-0.24313065653596855,-0.9554829059915173,0,0,0,0,1,1,0,0,0,0,-0.9385406161572778,0.25540423934973344,0,-0.23218567213611907,-0.25540423934973344,-0.9385406161572778,0,0,0,0,1,1,0,0,0,0,-0.9286472589653068,0.3180989815619539,0,-0.19085938893717125,-0.3180989815619539,-0.9286472589653068,0,0,0,0,1,1,0,0,0,0,-0.8968851226076998,0.3894003033765195,0,-0.20967708643351063,-0.3894003033765195,-0.8968851226076998,0,0,0,0,1,1,0,0,0,0,-0.9008921273230787,0.4011692545922503,0,-0.16570034428810357,-0.4011692545922503,-0.9008921273230787,0,0,0,0,1,1,0,0,0,0,-0.9335720675686494,0.35752066559629414,0,0.02494330225090427,-0.35752066559629414,-0.9335720675686494,0,0,0,0,1,1,0,0,0,0,-0.941598797565795,0.32253540367885714,0,0.09676062110365714,-0.32253540367885714,-0.941598797565795,0,0,0,0,1]}')},gO=Object.keys(fO),mO=nA.newInstance(),hO=mO.getRenderer(),vO=mO.getRenderWindow();mO.addController('
    ');const yO=document.getElementById("angle"),bO=document.getElementById("centerline"),xO=document.getElementById("mode"),TO=vO.getInteractor();TO.setInteractorStyle(LP.newInstance()),TO.setDesiredUpdateRate(15);const CO=pO.newInstance({planes:["Y","Z"],behavior:function(e,t){fw(e,t),e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("lineInY").includes(t.activeState)?hx:t.widgetState.getStatesWithLabel("lineInZ").includes(t.activeState)||t.widgetState.getStatesWithLabel("rotationInZ").includes(t.activeState)?gx:null,e[hx]=n=>{const r=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:o,worldDirection:a}=r.handleEvent(n,t._apiSpecificRenderWindow);e.updateCenterAndPlanes(o,a)},e.updateCenterAndPlanes=(n,r)=>{const o=e.getBoundedCenter(n);if(t.widgetState.setCenter(o),r){const e=e=>Vn([],r.slice(3*e,3*e+3)),n=t.widgetState.getPlanes();Object.keys(n).forEach((t=>{switch(Number.parseInt(t,10)){case sx.YZ_PLANE:n[t]={normal:e(0),viewUp:e(2)};break;case sx.XZ_PLANE:n[t]={normal:e(1),viewUp:e(2)};break;case sx.XY_PLANE:n[t]={normal:e(2),viewUp:e(1)}}}))}Ix(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.translateCenterOnPlaneDirection=n=>{const r=t._factory.getManipulator()?.handleScroll;if(r){const{worldCoords:t,worldDirection:o}=r(n);e.updateCenterAndPlanes(t,o)}}}}),SO=eI.newInstance();SO.setRenderer(hO);const AO=sx.XZ_PLANE,PO=sx.XY_PLANE,IO=SO.addWidget(CO,AO),wO=CO.getWidgetState();wO.getStatesWithLabel("sphere").forEach((e=>e.setScale1(20))),wO.getCenterHandle().setVisible(!1),wO.getStatesWithLabel("rotationInY").forEach((e=>e.setVisible(!1)));const OO=rT.newInstance();OO.setViewport(.7,0,1,.3),vO.addRenderer(OO),vO.setNumberOfLayers(2),OO.setLayer(1);const MO=eI.newInstance();MO.setRenderer(OO);const RO=MO.addWidget(CO,PO),VO=bP.newInstance();VO.setTransformInputSampling(!1),VO.setAutoCropOutput(!0),VO.setOutputDimensionality(2);const EO=zA.newInstance();EO.setBackgroundColor(0,0,0,0),EO.setInputConnection(VO.getOutputPort());const DO=RP.newInstance();DO.setMapper(EO);const LO=TA.newInstance({fetchGzip:!0}),BO=Pu.newInstance(),NO=RP.newInstance(),kO=BA.newInstance();kO.setBackgroundColor(0,0,0,0),NO.setMapper(kO),kO.setInputConnection(LO.getOutputPort(),0),kO.setInputData(BO,1),kO.setWidth(400);const FO=Bx.newInstance({cprActor:NO}),_O=_P.newInstance();function GO(){const e=wO.getPlanes(),t=e[AO].normal,n=e[AO].viewUp;e[PO].normal=n,e[PO].viewUp=t;const r=Dn([],t,n);Vn(r,r);const o=wO.getCenter(),a=FO.getCurrentDistance(),{orientation:i}=kO.getCenterlinePositionAndOrientation(a),s=Pe([],i),l=ge([],s),c=ue(...r,...t,...n),u=Ne([],l,c);kO.setDirectionMatrix(u),CO.updateReslicePlane(VO,PO),DO.setUserMatrix(VO.getResliceAxes()),CO.updateCameraPoints(OO,PO,!1,!0,!1),OO.getActiveCamera().setViewUp(s[3],s[4],s[5]),_O.setUserOrigin(o),_O.setUserNormal(n);const d=180*Math.atan2(u[1],u[0])/Math.PI,f=d>0?d:360+d;yO.value=f,Ix(wO,CO.getScaleInPixels(),CO.getRotationHandlePosition());const g=kO.getWidth(),m=kO.getHeight(),h=Mn([],o,r,-.5*g);Mn(h,h,n,a-m);const v=p(...r,0,...n,0,...On([],t,-1),0,...h,1);NO.setUserMatrix(v);const y=hO.getActiveCamera(),b=.5*m/Math.tan(Eo(.5*y.getViewAngle()));y.setParallelScale(.5*m),y.setParallelProjection(!0);const x=Mn([],o,n,a-.5*m),T=Mn([],x,t,-b);y.setPosition(...T),y.setFocalPoint(...x),y.setViewUp(...n),hO.resetCameraClippingRange(),TO.render(),vO.render()}let UO,WO=gO[0],zO=null;function HO(e){WO=e;const t=fO[e];if(!zO)return;const n=Float32Array.from(t.position),r=n.length/3;BO.getPoints().setData(n,3);const o=new Uint16Array(1+r);o[0]=r;for(let e=0;eHO(bO.value))),LO.setUrl("/vtk-js/data/volume/LIDC2.vti").then((()=>{LO.loadData().then((()=>{const e=LO.getOutputData();CO.setImage(e);const t=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}([],e.getDimensions(),e.getSpacing());kO.setWidth(2*Un(t)),NO.setUserMatrix(CO.getResliceAxes(AO)),hO.addVolume(NO),CO.updateCameraPoints(hO,AO,!0,!1,!0),VO.setInputData(e),OO.addActor(DO),CO.updateReslicePlane(VO,PO),DO.setUserMatrix(VO.getResliceAxes()),CO.updateCameraPoints(OO,PO,!0,!1,!0),zO=e,HO(WO),n.g.imageData=e}))})),yO.addEventListener("input",(()=>function(e){const t=[0,1,0];var n,r,o,a,i,s;n=t,a=e,s=[],(i=[])[0]=(r=t)[0]-(o=[0,0,0])[0],i[1]=r[1]-o[1],i[2]=r[2]-o[2],s[0]=i[0]*Math.cos(a)-i[1]*Math.sin(a),s[1]=i[0]*Math.sin(a)+i[1]*Math.cos(a),s[2]=i[2],n[0]=s[0]+o[0],n[1]=s[1]+o[1],n[2]=s[2]+o[2];const l=FO.getCurrentDistance(),{orientation:c}=kO.getCenterlinePositionAndOrientation(l),u=Pe([],c),d=Bn([],t,u),p=Bn([],[0,0,1],u),f=wO.getPlanes();f[AO].normal=d,f[AO].viewUp=p,f[PO].normal=p,f[PO].viewUp=d,wO.setPlanes(f),GO()}(Eo(Number.parseFloat(yO.value,10)))));const jO=document.createElement("option");jO.innerText="Stretched Mode",jO.value="stretched",xO.appendChild(jO);const KO=document.createElement("option");KO.innerText="Straightened Mode",KO.value="straightened",xO.appendChild(KO),xO.addEventListener("input",(()=>function(e){UO=e,"stretched"===UO?(kO.useStretchedMode(),GO()):(kO.useStraightenedMode(),GO())}(xO.value))),xO.value="straightened",IO.onInteractionEvent(GO),RO.onInteractionEvent(GO),n.g.source=LO,n.g.mapper=kO,n.g.actor=NO,n.g.renderer=hO,n.g.renderWindow=vO,n.g.centerline=BO,n.g.centerlines=fO},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),a=Object.prototype.toString,i=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),c=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===a.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},a=r(t);o&&(a=i.call(a,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var h=0;h=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),a=n(965),i=n(332),s=n(65),l=n(182),c=n(293);c.alea=r,c.xor128=o,c.xorwow=a,c.xorshift7=i,c.xor4096=s,c.tychei=l,e.exports=c},64:function(e,t,n){var r;!function(e,o,a){function i(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new i(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,a=t.i;return t.w=r=r+1640531527|0,n=o[a+34&127],e=o[a=a+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[a]=n^e,t.i=a,n+(r^r>>>16)|0},function(e,t){var n,r,o,a,i,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,a=-32;a>>15,r^=r<<4,r^=r>>>13,a>=0&&(i=i+1640531527|0,o=0==(n=s[127&a]^=r+i)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,a=512;a>0;--a)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=i,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,a,i){var s,l=256,c=i.pow(l,6),u=i.pow(2,52),d=2*u,p=255;function f(e,t,n){var r=[],p=v(h((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(a)]}}():e,3),r),f=new g(r),b=function(){for(var e=f.g(6),t=c,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),a),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(i.random=e,t):e})(b,p,"global"in t?t.global:this==i,t.state)}function g(e){var t,n=e.length,r=this,o=0,a=r.i=r.j=0,i=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|a>>>20)+n|0)&n|~a&r)+t[2]+606105819|0)<<17|o>>>15)+a|0)&a|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|a>>>20)+n|0)&n|~a&r)+t[6]-1473231341|0)<<17|o>>>15)+a|0)&a|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|a>>>20)+n|0)&n|~a&r)+t[10]-42063|0)<<17|o>>>15)+a|0)&a|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|a>>>20)+n|0)&n|~a&r)+t[14]-1502002290|0)<<17|o>>>15)+a|0)&a|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|a>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+a|0)&n|a&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|a>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+a|0)&n|a&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|a>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+a|0)&n|a&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|a>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+a|0)&n|a&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|a>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+a|0)^a^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|a>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+a|0)^a^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|a>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+a|0)^a^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|a>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+a|0)^a^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[14]-1416354905|0)<<15|o>>>17)+a|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[10]-1051523|0)<<15|o>>>17)+a|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[6]-1560198380|0)<<15|o>>>17)+a|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[2]+718787259|0)<<15|o>>>17)+a|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function a(e){var t,o,a,i,s,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}function i(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tc?new ArrayBuffer(0):(r=c-l,o=new ArrayBuffer(r),a=new Uint8Array(o),i=new Uint8Array(this,l,r),a.set(i),o)}}(),u.prototype.append=function(e){return this.appendBinary(l(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},u.prototype.end=function(e){var t,n,r=this._buff,o=r.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,t){var r,o,a,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(n(this._hash,e),i=0;i<16;i+=1)e[i]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),a=parseInt(r[1],16)||0,e[14]=o,e[15]=a,n(this._hash,e)},u.hash=function(e,t){return u.hashBinary(l(e),t)},u.hashBinary=function(e,t){var n=s(a(e));return t?c(n):n},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var t,r,a,i,s,l=(r=this._buff.buffer,a=e,i=!0,(s=new Uint8Array(r.byteLength+a.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(a),r.byteLength),i?s:s.buffer),c=l.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),a=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}(new Uint8Array(e)));return t?c(r):r},u}()},963:function(e,t,n){var r=n(702),o=n(903);void 0===o.ImageCPRMapper&&(o.ImageCPRMapper=r),e.exports=r},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n(963)}(); \ No newline at end of file diff --git a/examples/ImageCropFilter.html b/examples/ImageCropFilter.html index b7ecc84977f..7525797e22e 100644 --- a/examples/ImageCropFilter.html +++ b/examples/ImageCropFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageCroppingWidget.html b/examples/ImageCroppingWidget.html index 4efc7f9383f..8f4f98ba4c3 100644 --- a/examples/ImageCroppingWidget.html +++ b/examples/ImageCroppingWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageLabelOutline.html b/examples/ImageLabelOutline.html index ad63be58175..9c6928cb795 100644 --- a/examples/ImageLabelOutline.html +++ b/examples/ImageLabelOutline.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageMapper.html b/examples/ImageMapper.html index d54f0cc1543..f46e1c801dd 100644 --- a/examples/ImageMapper.html +++ b/examples/ImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageMarchingCubes.html b/examples/ImageMarchingCubes.html index b4c7d39f346..0f19c9ed723 100644 --- a/examples/ImageMarchingCubes.html +++ b/examples/ImageMarchingCubes.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageMarchingSquares.html b/examples/ImageMarchingSquares.html index f8f2c590cb5..5a173327369 100644 --- a/examples/ImageMarchingSquares.html +++ b/examples/ImageMarchingSquares.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageOutlineFilter.html b/examples/ImageOutlineFilter.html index 85d30c24153..3a8d0149eff 100644 --- a/examples/ImageOutlineFilter.html +++ b/examples/ImageOutlineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageResliceMapper.html b/examples/ImageResliceMapper.html index 68754e879e4..3faf64f0460 100644 --- a/examples/ImageResliceMapper.html +++ b/examples/ImageResliceMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImageStream.html b/examples/ImageStream.html index b94f0e00391..23546cc5cfc 100644 --- a/examples/ImageStream.html +++ b/examples/ImageStream.html @@ -48,8 +48,8 @@ - - + + @@ -127,7 +127,7 @@

    diff --git a/examples/ImageStreamline.html b/examples/ImageStreamline.html index 7bd77d3c83c..53535cfd002 100644 --- a/examples/ImageStreamline.html +++ b/examples/ImageStreamline.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImplicitBoolean.html b/examples/ImplicitBoolean.html index c170ce81232..535d4a20152 100644 --- a/examples/ImplicitBoolean.html +++ b/examples/ImplicitBoolean.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImplicitPlaneRepresentation.html b/examples/ImplicitPlaneRepresentation.html index 5ac3b4b6415..4b2a4e08bd8 100644 --- a/examples/ImplicitPlaneRepresentation.html +++ b/examples/ImplicitPlaneRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ImplicitPlaneWidget.html b/examples/ImplicitPlaneWidget.html index 43ce77c0681..b4c69f7df60 100644 --- a/examples/ImplicitPlaneWidget.html +++ b/examples/ImplicitPlaneWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/InteractiveOrientationWidget.html b/examples/InteractiveOrientationWidget.html index e828527cd52..bc47042cec7 100644 --- a/examples/InteractiveOrientationWidget.html +++ b/examples/InteractiveOrientationWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/InteractorStyleMPRSlice.html b/examples/InteractorStyleMPRSlice.html index 78cbfedb3e3..6426f9e02e9 100644 --- a/examples/InteractorStyleMPRSlice.html +++ b/examples/InteractorStyleMPRSlice.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/InteractorStyleManipulator.html b/examples/InteractorStyleManipulator.html index ca94bef1fc8..204fa83f626 100644 --- a/examples/InteractorStyleManipulator.html +++ b/examples/InteractorStyleManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/InteractorStyleTrackballCamera.html b/examples/InteractorStyleTrackballCamera.html index c5f53ea5cb1..427b7540ae4 100644 --- a/examples/InteractorStyleTrackballCamera.html +++ b/examples/InteractorStyleTrackballCamera.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/InteractorStyleUnicam.html b/examples/InteractorStyleUnicam.html index 67782396e45..2defd088bcc 100644 --- a/examples/InteractorStyleUnicam.html +++ b/examples/InteractorStyleUnicam.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ItkWasmGeometry.html b/examples/ItkWasmGeometry.html index 3d2fc0bdaa9..c78e15a0d9d 100644 --- a/examples/ItkWasmGeometry.html +++ b/examples/ItkWasmGeometry.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ItkWasmVolume.html b/examples/ItkWasmVolume.html index cbc90c6308f..07f52441564 100644 --- a/examples/ItkWasmVolume.html +++ b/examples/ItkWasmVolume.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/JSONNucleoReader.html b/examples/JSONNucleoReader.html index 95525723a2f..3a9980dddd4 100644 --- a/examples/JSONNucleoReader.html +++ b/examples/JSONNucleoReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/KeyboardCameraManipulator.html b/examples/KeyboardCameraManipulator.html index 88708590479..2d73fc200d1 100644 --- a/examples/KeyboardCameraManipulator.html +++ b/examples/KeyboardCameraManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/LabelWidget.html b/examples/LabelWidget.html index 18549deb053..637bfb8c2a3 100644 --- a/examples/LabelWidget.html +++ b/examples/LabelWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/LineSource.html b/examples/LineSource.html index b0937be6db5..4fb6d1efc69 100644 --- a/examples/LineSource.html +++ b/examples/LineSource.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/LineWidget.html b/examples/LineWidget.html index e54444f0ab5..a0720c0bf0a 100644 --- a/examples/LineWidget.html +++ b/examples/LineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/LookingGlass.html b/examples/LookingGlass.html index d30e160e08a..1dbe5d7e7d1 100644 --- a/examples/LookingGlass.html +++ b/examples/LookingGlass.html @@ -48,8 +48,8 @@ - - + + @@ -131,7 +131,7 @@

    diff --git a/examples/ManyRenderers.html b/examples/ManyRenderers.html index 6abea9862bd..d46ebbde092 100644 --- a/examples/ManyRenderers.html +++ b/examples/ManyRenderers.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/MouseBoxSelectorManipulator.html b/examples/MouseBoxSelectorManipulator.html index 7706f84f129..8ed948b73c1 100644 --- a/examples/MouseBoxSelectorManipulator.html +++ b/examples/MouseBoxSelectorManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/MouseCameraTrackballFirstPersonManipulator.html b/examples/MouseCameraTrackballFirstPersonManipulator.html index 9a5fc511df6..1d5d5ec09ba 100644 --- a/examples/MouseCameraTrackballFirstPersonManipulator.html +++ b/examples/MouseCameraTrackballFirstPersonManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/MouseRangeManipulator.html b/examples/MouseRangeManipulator.html index 25ca089b6a7..0c0bba62e62 100644 --- a/examples/MouseRangeManipulator.html +++ b/examples/MouseRangeManipulator.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/MultiSliceImageMapper.html b/examples/MultiSliceImageMapper.html index fc662407ae6..c25363335c2 100644 --- a/examples/MultiSliceImageMapper.html +++ b/examples/MultiSliceImageMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OBBTree.html b/examples/OBBTree.html index e05323e00ac..1b65d7a89f4 100644 --- a/examples/OBBTree.html +++ b/examples/OBBTree.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OBJReader.html b/examples/OBJReader.html index 5314305c789..d9f23fc774c 100644 --- a/examples/OBJReader.html +++ b/examples/OBJReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OBJViewer.html b/examples/OBJViewer.html index 5477b8399a7..1d5fc060993 100644 --- a/examples/OBJViewer.html +++ b/examples/OBJViewer.html @@ -48,8 +48,8 @@ - - + + @@ -129,7 +129,7 @@

    diff --git a/examples/OctreeViewer.html b/examples/OctreeViewer.html index 93279547f22..3d17481ba1d 100644 --- a/examples/OctreeViewer.html +++ b/examples/OctreeViewer.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OfflineLocalView.html b/examples/OfflineLocalView.html index 2bdc15af22b..78f244266f9 100644 --- a/examples/OfflineLocalView.html +++ b/examples/OfflineLocalView.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OrientationMarkerWidget.html b/examples/OrientationMarkerWidget.html index 8b507009f4b..9d9006896e8 100644 --- a/examples/OrientationMarkerWidget.html +++ b/examples/OrientationMarkerWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/OutlineFilter.html b/examples/OutlineFilter.html index 80706bd2765..3f4ab6b99b4 100644 --- a/examples/OutlineFilter.html +++ b/examples/OutlineFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PBR.html b/examples/PBR.html index 0801438c1a5..05584c12eb0 100644 --- a/examples/PBR.html +++ b/examples/PBR.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PDBReader.html b/examples/PDBReader.html index 7024ed2a608..a278247653a 100644 --- a/examples/PDBReader.html +++ b/examples/PDBReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PLYReader.html b/examples/PLYReader.html index 65825abad2b..1461739506b 100644 --- a/examples/PLYReader.html +++ b/examples/PLYReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PLYWriter.html b/examples/PLYWriter.html index 0f444a5292c..df440bab141 100644 --- a/examples/PLYWriter.html +++ b/examples/PLYWriter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PaintWidget.html b/examples/PaintWidget.html index e20619be10c..c7d0858f0fe 100644 --- a/examples/PaintWidget.html +++ b/examples/PaintWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/Picking.html b/examples/Picking.html index e9d4bb55d20..f426d919fd0 100644 --- a/examples/Picking.html +++ b/examples/Picking.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PiecewiseGaussianWidget.html b/examples/PiecewiseGaussianWidget.html index 92d80d1cb8e..4ea0df063db 100644 --- a/examples/PiecewiseGaussianWidget.html +++ b/examples/PiecewiseGaussianWidget.html @@ -48,8 +48,8 @@ - - + + @@ -169,7 +169,7 @@

    diff --git a/examples/PipelineExecution.html b/examples/PipelineExecution.html index 3fb7f2e1ae3..ccbddd3f885 100644 --- a/examples/PipelineExecution.html +++ b/examples/PipelineExecution.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PlaneSource.html b/examples/PlaneSource.html index 4f6dbf5eeb0..b1f20510435 100644 --- a/examples/PlaneSource.html +++ b/examples/PlaneSource.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PointPicker.html b/examples/PointPicker.html index 61dea34dfcd..daf626ec2ff 100644 --- a/examples/PointPicker.html +++ b/examples/PointPicker.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PointSource.html b/examples/PointSource.html index fa21d0823a1..583fdcde0c5 100644 --- a/examples/PointSource.html +++ b/examples/PointSource.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PolyDataNormals.html b/examples/PolyDataNormals.html index 530c34cf939..d797f561561 100644 --- a/examples/PolyDataNormals.html +++ b/examples/PolyDataNormals.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PolyDataReader.html b/examples/PolyDataReader.html index 3e6f6742d44..f076d1a7368 100644 --- a/examples/PolyDataReader.html +++ b/examples/PolyDataReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PolyDataSerialization.html b/examples/PolyDataSerialization.html index 9933a4ba89e..d59e5993975 100644 --- a/examples/PolyDataSerialization.html +++ b/examples/PolyDataSerialization.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/PolyLineWidget.html b/examples/PolyLineWidget.html index 64fdbcf614e..a59f703f39a 100644 --- a/examples/PolyLineWidget.html +++ b/examples/PolyLineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ProxyManager.html b/examples/ProxyManager.html index 9a05946020e..0ac8f475a31 100644 --- a/examples/ProxyManager.html +++ b/examples/ProxyManager.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/QuadView.html b/examples/QuadView.html index c176c47bd0f..8ccdd363ec4 100644 --- a/examples/QuadView.html +++ b/examples/QuadView.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/RemoteView.html b/examples/RemoteView.html index 9273a73b2fc..756f0cc2d3b 100644 --- a/examples/RemoteView.html +++ b/examples/RemoteView.html @@ -48,8 +48,8 @@ - - + + @@ -132,7 +132,7 @@

    diff --git a/examples/RenderWindowWithControlBar.html b/examples/RenderWindowWithControlBar.html index 710b8772203..98534817a00 100644 --- a/examples/RenderWindowWithControlBar.html +++ b/examples/RenderWindowWithControlBar.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ResliceCursorWidget.html b/examples/ResliceCursorWidget.html index 91785078fe9..ec053ac8a42 100644 --- a/examples/ResliceCursorWidget.html +++ b/examples/ResliceCursorWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ResliceCursorWidget/ResliceCursorWidget.html b/examples/ResliceCursorWidget/ResliceCursorWidget.html index ccfeae108c4..0a1a03050d5 100644 --- a/examples/ResliceCursorWidget/ResliceCursorWidget.html +++ b/examples/ResliceCursorWidget/ResliceCursorWidget.html @@ -7,7 +7,7 @@
    diff --git a/examples/ResliceCursorWidget/ResliceCursorWidget.js b/examples/ResliceCursorWidget/ResliceCursorWidget.js index 0dfc65723ad..e0e4666c741 100644 --- a/examples/ResliceCursorWidget/ResliceCursorWidget.js +++ b/examples/ResliceCursorWidget/ResliceCursorWidget.js @@ -1 +1 @@ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},860:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return Q},adjoint:function(){return v},clone:function(){return u},copy:function(){return d},create:function(){return c},determinant:function(){return y},equals:function(){return re},exactEquals:function(){return ne},frob:function(){return Z},fromQuat:function(){return _},fromQuat2:function(){return D},fromRotation:function(){return O},fromRotationTranslation:function(){return E},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return F},fromScaling:function(){return w},fromTranslation:function(){return I},fromValues:function(){return p},fromXRotation:function(){return M},fromYRotation:function(){return R},fromZRotation:function(){return V},frustum:function(){return G},getRotation:function(){return N},getScaling:function(){return B},getTranslation:function(){return L},identity:function(){return g},invert:function(){return h},lookAt:function(){return q},mul:function(){return oe},multiply:function(){return b},multiplyScalar:function(){return ee},multiplyScalarAndAdd:function(){return te},ortho:function(){return K},orthoNO:function(){return j},orthoZO:function(){return $},perspective:function(){return z},perspectiveFromFieldOfView:function(){return H},perspectiveNO:function(){return U},perspectiveZO:function(){return W},rotate:function(){return C},rotateX:function(){return S},rotateY:function(){return P},rotateZ:function(){return A},scale:function(){return T},set:function(){return f},str:function(){return Y},sub:function(){return ae},subtract:function(){return J},targetTo:function(){return X},translate:function(){return x},transpose:function(){return m}});var o={};n.r(o),n.d(o,{add:function(){return Re},adjoint:function(){return me},clone:function(){return le},copy:function(){return ce},create:function(){return ie},determinant:function(){return he},equals:function(){return Be},exactEquals:function(){return Le},frob:function(){return Me},fromMat2d:function(){return Pe},fromMat4:function(){return se},fromQuat:function(){return Ae},fromRotation:function(){return Ce},fromScaling:function(){return Se},fromTranslation:function(){return Te},fromValues:function(){return ue},identity:function(){return pe},invert:function(){return ge},mul:function(){return Ne},multiply:function(){return ve},multiplyScalar:function(){return Ee},multiplyScalarAndAdd:function(){return De},normalFromMat4:function(){return Ie},projection:function(){return we},rotate:function(){return be},scale:function(){return xe},set:function(){return de},str:function(){return Oe},sub:function(){return ke},subtract:function(){return Ve},translate:function(){return ye},transpose:function(){return fe}}),n(334);var a=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var s=Math.PI/180;function l(e){return e*s}function c(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function p(e,t,n,r,o,a,s,l,c,u,d,p,f,g,m,h){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=d,v[11]=p,v[12]=f,v[13]=g,v[14]=m,v[15]=h,v}function f(e,t,n,r,o,a,i,s,l,c,u,d,p,f,g,m,h){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=g,e[14]=m,e[15]=h,e}function g(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function m(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],a=t[6],i=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=o,e[13]=i,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function h(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,P=u*m-d*g,A=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*A+S*P;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(o*O-r*M-a*w)*R,e[2]=(m*S-h*C+v*T)*R,e[3]=(p*C-d*S-f*T)*R,e[4]=(l*I-i*M-c*A)*R,e[5]=(n*M-o*I+a*A)*R,e[6]=(h*x-g*S-v*b)*R,e[7]=(u*S-p*x+f*b)*R,e[8]=(i*O-s*I+c*P)*R,e[9]=(r*I-n*O-a*P)*R,e[10]=(g*C-m*x+v*y)*R,e[11]=(d*x-u*C-f*y)*R,e[12]=(s*A-i*w-l*P)*R,e[13]=(n*w-r*A+o*P)*R,e[14]=(m*b-g*T-h*y)*R,e[15]=(u*T-d*b+p*y)*R,e):null}function v(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15];return e[0]=s*(p*v-f*h)-d*(l*v-c*h)+m*(l*f-c*p),e[1]=-(r*(p*v-f*h)-d*(o*v-a*h)+m*(o*f-a*p)),e[2]=r*(l*v-c*h)-s*(o*v-a*h)+m*(o*c-a*l),e[3]=-(r*(l*f-c*p)-s*(o*f-a*p)+d*(o*c-a*l)),e[4]=-(i*(p*v-f*h)-u*(l*v-c*h)+g*(l*f-c*p)),e[5]=n*(p*v-f*h)-u*(o*v-a*h)+g*(o*f-a*p),e[6]=-(n*(l*v-c*h)-i*(o*v-a*h)+g*(o*c-a*l)),e[7]=n*(l*f-c*p)-i*(o*f-a*p)+u*(o*c-a*l),e[8]=i*(d*v-f*m)-u*(s*v-c*m)+g*(s*f-c*d),e[9]=-(n*(d*v-f*m)-u*(r*v-a*m)+g*(r*f-a*d)),e[10]=n*(s*v-c*m)-i*(r*v-a*m)+g*(r*c-a*s),e[11]=-(n*(s*f-c*d)-i*(r*f-a*d)+u*(r*c-a*s)),e[12]=-(i*(d*h-p*m)-u*(s*h-l*m)+g*(s*p-l*d)),e[13]=n*(d*h-p*m)-u*(r*h-o*m)+g*(r*p-o*d),e[14]=-(n*(s*h-l*m)-i*(r*h-o*m)+g*(r*l-o*s)),e[15]=n*(s*p-l*d)-i*(r*p-o*d)+u*(r*l-o*s),e}function y(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],h=e[15];return(t*i-n*a)*(d*h-p*m)-(t*s-r*a)*(u*h-p*g)+(t*l-o*a)*(u*m-d*g)+(n*s-r*i)*(c*h-p*f)-(n*l-o*i)*(c*m-d*f)+(r*l-o*s)*(c*g-u*f)}function b(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],m=t[12],h=t[13],v=t[14],y=t[15],b=n[0],x=n[1],T=n[2],C=n[3];return e[0]=b*r+x*s+T*d+C*m,e[1]=b*o+x*l+T*p+C*h,e[2]=b*a+x*c+T*f+C*v,e[3]=b*i+x*u+T*g+C*y,b=n[4],x=n[5],T=n[6],C=n[7],e[4]=b*r+x*s+T*d+C*m,e[5]=b*o+x*l+T*p+C*h,e[6]=b*a+x*c+T*f+C*v,e[7]=b*i+x*u+T*g+C*y,b=n[8],x=n[9],T=n[10],C=n[11],e[8]=b*r+x*s+T*d+C*m,e[9]=b*o+x*l+T*p+C*h,e[10]=b*a+x*c+T*f+C*v,e[11]=b*i+x*u+T*g+C*y,b=n[12],x=n[13],T=n[14],C=n[15],e[12]=b*r+x*s+T*d+C*m,e[13]=b*o+x*l+T*p+C*h,e[14]=b*a+x*c+T*f+C*v,e[15]=b*i+x*u+T*g+C*y,e}function x(e,t,n){var r,o,a,i,s,l,c,u,d,p,f,g,m=n[0],h=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*h+t[8]*v+t[12],e[13]=t[1]*m+t[5]*h+t[9]*v+t[13],e[14]=t[2]*m+t[6]*h+t[10]*v+t[14],e[15]=t[3]*m+t[7]*h+t[11]*v+t[15]):(r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=f,e[11]=g,e[12]=r*m+s*h+d*v+t[12],e[13]=o*m+l*h+p*v+t[13],e[14]=a*m+c*h+f*v+t[14],e[15]=i*m+u*h+g*v+t[15]),e}function T(e,t,n){var r=n[0],o=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function C(e,t,n,r){var o,i,s,l,c,u,d,p,f,g,m,h,v,y,b,x,T,C,S,P,A,I,w,O,M=r[0],R=r[1],V=r[2],E=Math.hypot(M,R,V);return E0?(n[0]=2*(l*s+d*r+c*a-u*o)/p,n[1]=2*(c*s+d*o+u*r-l*a)/p,n[2]=2*(u*s+d*a+l*o-c*r)/p):(n[0]=2*(l*s+d*r+c*a-u*o),n[1]=2*(c*s+d*o+u*r-l*a),n[2]=2*(u*s+d*a+l*o-c*r)),E(e,t,n),e}function L(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function B(e,t){var n=t[0],r=t[1],o=t[2],a=t[4],i=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(a,i,s),e[2]=Math.hypot(l,c,u),e}function N(e,t){var n=new i(3);B(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,c=t[2]*a,u=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,g=t[9]*o,m=t[10]*a,h=s+d+m,v=0;return h>0?(v=2*Math.sqrt(h+1),e[3]=.25*v,e[0]=(p-g)/v,e[1]=(f-c)/v,e[2]=(l-u)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-g)/v,e[0]=.25*v,e[1]=(l+u)/v,e[2]=(f+c)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-c)/v,e[0]=(l+u)/v,e[1]=.25*v,e[2]=(p+g)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-u)/v,e[0]=(f+c)/v,e[1]=(p+g)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],a=t[1],i=t[2],s=t[3],l=o+o,c=a+a,u=i+i,d=o*l,p=o*c,f=o*u,g=a*c,m=a*u,h=i*u,v=s*l,y=s*c,b=s*u,x=r[0],T=r[1],C=r[2];return e[0]=(1-(g+h))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*T,e[5]=(1-(d+h))*T,e[6]=(m+v)*T,e[7]=0,e[8]=(f+y)*C,e[9]=(m-v)*C,e[10]=(1-(d+g))*C,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function F(e,t,n,r,o){var a=t[0],i=t[1],s=t[2],l=t[3],c=a+a,u=i+i,d=s+s,p=a*c,f=a*u,g=a*d,m=i*u,h=i*d,v=s*d,y=l*c,b=l*u,x=l*d,T=r[0],C=r[1],S=r[2],P=o[0],A=o[1],I=o[2],w=(1-(m+v))*T,O=(f+x)*T,M=(g-b)*T,R=(f-x)*C,V=(1-(p+v))*C,E=(h+y)*C,D=(g+b)*S,L=(h-y)*S,B=(1-(p+m))*S;return e[0]=w,e[1]=O,e[2]=M,e[3]=0,e[4]=R,e[5]=V,e[6]=E,e[7]=0,e[8]=D,e[9]=L,e[10]=B,e[11]=0,e[12]=n[0]+P-(w*P+R*A+D*I),e[13]=n[1]+A-(O*P+V*A+L*I),e[14]=n[2]+I-(M*P+E*A+B*I),e[15]=1,e}function _(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[1]=u+v,e[2]=p-h,e[3]=0,e[4]=u-v,e[5]=1-c-g,e[6]=f+m,e[7]=0,e[8]=p+h,e[9]=f-m,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function G(e,t,n,r,o,a,i){var s=1/(n-t),l=1/(o-r),c=1/(a-i);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(i+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*a*2*c,e[15]=0,e}function U(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=(o+r)*a,e[14]=2*o*r*a):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var z=U;function W(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=o*a,e[14]=o*r*a):(e[10]=-1,e[14]=-r),e}function H(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(i+s),c=2/(o+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(i-s)*l*.5,e[9]=(o-a)*c*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function j(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(i+a)*c,e[15]=1,e}var K=j;function $(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=a*c,e[15]=1,e}function q(e,t,n,r){var o,i,s,l,c,u,d,p,f,m,h=t[0],v=t[1],y=t[2],b=r[0],x=r[1],T=r[2],C=n[0],S=n[1],P=n[2];return Math.abs(h-C)0&&(u*=f=1/Math.sqrt(f),d*=f,p*=f);var g=l*p-c*d,m=c*u-s*p,h=s*d-l*u;return(f=g*g+m*m+h*h)>0&&(g*=f=1/Math.sqrt(f),m*=f,h*=f),e[0]=g,e[1]=m,e[2]=h,e[3]=0,e[4]=d*h-p*m,e[5]=p*g-u*h,e[6]=u*m-d*g,e[7]=0,e[8]=u,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=a,e[14]=i,e[15]=1,e}function Y(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Z(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Q(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function J(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function te(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function re(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=e[9],f=e[10],g=e[11],m=e[12],h=e[13],v=e[14],y=e[15],b=t[0],x=t[1],T=t[2],C=t[3],S=t[4],P=t[5],A=t[6],I=t[7],w=t[8],O=t[9],M=t[10],R=t[11],V=t[12],E=t[13],D=t[14],L=t[15];return Math.abs(n-b)<=a*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=a*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-T)<=a*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-C)<=a*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(s-S)<=a*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-P)<=a*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-A)<=a*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(u-I)<=a*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-w)<=a*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-O)<=a*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(f-M)<=a*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(g-R)<=a*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(m-V)<=a*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(h-E)<=a*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(v-D)<=a*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-L)<=a*Math.max(1,Math.abs(y),Math.abs(L))}var oe=b,ae=J;function ie(){var e=new i(9);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function se(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function le(e){var t=new i(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ue(e,t,n,r,o,a,s,l,c){var u=new i(9);return u[0]=e,u[1]=t,u[2]=n,u[3]=r,u[4]=o,u[5]=a,u[6]=s,u[7]=l,u[8]=c,u}function de(e,t,n,r,o,a,i,s,l,c){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e}function pe(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function fe(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function ge(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*i-s*c,p=-u*a+s*l,f=c*a-i*l,g=n*d+r*p+o*f;return g?(g=1/g,e[0]=d*g,e[1]=(-u*r+o*c)*g,e[2]=(s*r-o*i)*g,e[3]=p*g,e[4]=(u*n-o*l)*g,e[5]=(-s*n+o*a)*g,e[6]=f*g,e[7]=(-c*n+r*l)*g,e[8]=(i*n-r*a)*g,e):null}function me(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=i*u-s*c,e[1]=o*c-r*u,e[2]=r*s-o*i,e[3]=s*l-a*u,e[4]=n*u-o*l,e[5]=o*a-n*s,e[6]=a*c-i*l,e[7]=r*l-n*c,e[8]=n*i-r*a,e}function he(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8];return t*(c*a-i*l)+n*(-c*o+i*s)+r*(l*o-a*s)}function ve(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1],g=n[2],m=n[3],h=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*i+g*c,e[1]=p*o+f*s+g*u,e[2]=p*a+f*l+g*d,e[3]=m*r+h*i+v*c,e[4]=m*o+h*s+v*u,e[5]=m*a+h*l+v*d,e[6]=y*r+b*i+x*c,e[7]=y*o+b*s+x*u,e[8]=y*a+b*l+x*d,e}function ye(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1];return e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=p*r+f*i+c,e[7]=p*o+f*s+u,e[8]=p*a+f*l+d,e}function be(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=Math.sin(n),f=Math.cos(n);return e[0]=f*r+p*i,e[1]=f*o+p*s,e[2]=f*a+p*l,e[3]=f*i-p*r,e[4]=f*s-p*o,e[5]=f*l-p*a,e[6]=c,e[7]=u,e[8]=d,e}function xe(e,t,n){var r=n[0],o=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Te(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Ce(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Se(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Pe(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Ae(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[3]=u-v,e[6]=p+h,e[1]=u+v,e[4]=1-c-g,e[7]=f-m,e[2]=p-h,e[5]=f+m,e[8]=1-c-d,e}function Ie(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,P=u*m-d*g,A=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*A+S*P;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(l*I-i*M-c*A)*R,e[2]=(i*O-s*I+c*P)*R,e[3]=(o*O-r*M-a*w)*R,e[4]=(n*M-o*I+a*A)*R,e[5]=(r*I-n*O-a*P)*R,e[6]=(m*S-h*C+v*T)*R,e[7]=(h*x-g*S-v*b)*R,e[8]=(g*C-m*x+v*y)*R,e):null}function we(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Oe(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Me(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Re(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}function Ve(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}function Ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}function De(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e}function Le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Be(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=t[0],f=t[1],g=t[2],m=t[3],h=t[4],v=t[5],y=t[6],b=t[7],x=t[8];return Math.abs(n-p)<=a*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(r-f)<=a*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-g)<=a*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(i-m)<=a*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-h)<=a*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(l-v)<=a*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=a*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=a*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(d-x)<=a*Math.max(1,Math.abs(d),Math.abs(x))}var Ne=ve,ke=Ve,Fe=n(152),_e=n.n(Fe),Ge=n(177);const Ue=n.n(Ge)()(),ze={vtkObject:()=>null};function We(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return Ue.console&&Ue.console.error&&Ue.console.error("Invalid VTK object"),null;const t=ze[e.vtkClass];if(!t)return Ue.console&&Ue.console.error&&Ue.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=We(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}We.register=function(e,t){ze[e]=t};class He extends Array{push(){for(let e=0;e{$e[e]=qe})),Ue.console=console.hasOwnProperty("log")?console:$e;const Xe={debug:qe,error:Ue.console.error||qe,info:Ue.console.info||qe,log:Ue.console.log||qe,warn:Ue.console.warn||qe};function Ye(e,t){Xe[e]&&(Xe[e]=t||qe)}function Ze(){Xe.log(...arguments)}function Qe(){Xe.info(...arguments)}function Je(){Xe.debug(...arguments)}function et(){Xe.error(...arguments)}function tt(){Xe.warn(...arguments)}const nt={};function rt(e){nt[e]||(Xe.error(e),nt[e]=!0)}const ot=Object.create(null);ot.Float32Array=Float32Array,ot.Float64Array=Float64Array,ot.Uint8Array=Uint8Array,ot.Int8Array=Int8Array,ot.Uint16Array=Uint16Array,ot.Int16Array=Int16Array,ot.Uint32Array=Uint32Array,ot.Int32Array=Int32Array,ot.Uint8ClampedArray=Uint8ClampedArray;try{ot.BigInt64Array=BigInt64Array,ot.BigUint64Array=BigUint64Array}catch{}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),a="B";for(;o>n;)o/=n,a=r.pop();return`${o.toFixed(t)} ${a}`}function dt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function pt(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function ft(e){return Object.values(ot).some((t=>e instanceof t))}function gt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function yt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++je),"classHierarchy"in t){if(!(t.classHierarchy instanceof He)){const e=new He;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?et("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return et("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!1;return Object.keys(n).forEach((i=>{const s=o?null:e[`set${st(i)}`];s&&Array.isArray(n[i])&&s.length>1?a=s(...n[i])||a:s?a=s(n[i])||a:(-1!==["mtime"].indexOf(i)||r||tt(`Warning: Set value to model directly ${i}, ${n[i]}`),a=t[i]!==n[i]||a,t[i]=n[i])})),a},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(mt):ft(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),a=Object.keys(t).sort(),i=Object.keys(o).sort();i.forEach((e=>{const n=a.indexOf(e);-1===n?r&&Je(`add ${e} in shallowCopy`):a.splice(n,1),t[e]=o[e]})),a.length&&r&&Je(`Untouched keys: ${a.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const bt={object:(e,t,n)=>function(){return{...t[n.name]}}};function xt(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=bt[n.type];e[`get${lt(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${lt(n)}`]=()=>t[n]}))}const Tt={enum(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw et(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}throw et(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw et(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if(!_e()(t[n.name],o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}return!1}}};function Ct(e){if("object"==typeof e){const t=Tt[e.type];if(t)return(n,r)=>t(n,r,e);throw et(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${lt(e)}Changed`;return function(o){if(n.deleted)return et("instance deleted - cannot call any method"),!1;if(n[e]!==o){const a=n[e.name];return n[e]=o,n[r]?.(t,n,o,a),t.modified(),!0}return!1}}}function St(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${lt(n.name)}`]=Ct(n)(e,t):e[`set${lt(n)}`]=Ct(n)(e,t)}))}function Pt(e,t,n){xt(e,t,n),St(e,t,n)}function At(e,t,n){n.forEach((n=>{e[`get${lt(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${lt(n)}ByReference`]=()=>t[n]}))}function It(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const a=`_on${lt(n)}Changed`;e[`set${lt(n)}`]=function(){if(t.deleted)return et("instance deleted - cannot call any method"),!1;for(var i=arguments.length,s=new Array(i),l=0;l=0)&&(u=u[0],d=!0),null==u)c=t[n]!==u;else{if(r&&u.length!==r){if(!(u.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function wt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;At(e,t,n),It(e,t,n,r,o)}function Ot(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?et("instance deleted - cannot call any method"):r>=t.numberOfInputs?et(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function a(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)et("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void et(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function i(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(et("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(We):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(We):t.inputConnection=[],t.output?t.output=t.output.map(We):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(We):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,a=r;for(;a--;){if(!t.output[a]||t.output[a].isDeleted())return!0;const e=t.output[a].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=a,e.addInputData=function(e){t.deleted?et("instance deleted - cannot call any method"):o(e,i())},e.addInputConnection=function(e){t.deleted?et("instance deleted - cannot call any method"):a(e,i())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===Rt)break}},e[`on${lt(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return et("instance deleted - cannot call any method"),null;const i=a++;return r.push([i,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(i)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return i(t)}))}}function Et(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&We.register(t,n),n}function Dt(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function Lt(e){return e&&e.isA&&e.isA("vtkObject")}function Bt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(Lt(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const a=e.get();Object.keys(a).forEach((e=>{const o=a[e];Array.isArray(o)?o.forEach((e=>{Bt(e,t,n,r)})):Bt(o,t,n,r)}))}return n}function Nt(e,t,n){var r=this;let o;const a=function(){for(var a=arguments.length,i=new Array(a),s=0;s{o=null,n||e.apply(l,i)},u=n&&!o;clearTimeout(o),o=setTimeout(c,t),u&&e.apply(l,i)};return a.cancel=()=>clearTimeout(o),a}function kt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(a(...r),r=null)}function a(){for(var a=arguments.length,i=new Array(a),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let _t=1;const Gt="__root__";function Ut(e,t){Ft(e,t);const n=e.delete;t.proxyId=""+_t++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),xt(e,t,["proxyId","proxyGroup","proxyName"]),Pt(e,t,["proxyManager"]);const r={},o={};function a(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:Gt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gt;const r=[],o=t.proxyId,a=i(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),a(t.ui,Gt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${lt(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let a=0,i=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i)return null;const l=[];let c=null;for(a=o.length;a--;){const e=o[a];e.instance===n?c=e:l.push(e)}if(!c)return null;const u=c.instance[`get${lt(c.propertyName)}`]();if(!gt(u,r)||s){for(r=u,i=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}i=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=u),u}function l(e,t){const n=[];for(a=o.length;a--;){const r=o[a];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(a))}for(;n.length;)o.splice(n.pop(),1)}function c(n,r){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=n.onModified(s),c=o[0];return o.push({instance:n,propertyName:r,subscription:i}),a&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):c&&s(c.instance,!0)),{unsubscribe:()=>l(n,r)}}function u(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:c,unbind:l,unsubscribe:u,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,ht((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function Wt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const a=Object.keys(r);let i=a.length;for(;i--;){const s=a[i];t[s]=r[s];const l=n[s];e[`set${lt(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}a.length&&xt(e,t,a)}function Ht(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var jt={algo:Mt,capitalize:st,chain:Dt,debounce:Nt,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:Vt,EVENT_ABORT:Rt,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,get:xt,getArray:At,getCurrentGlobalMTime:function(){return je},getStateArrayMapFunc:mt,isVtkObject:Lt,keystore:Ft,measurePromiseExecution:vt,moveToProtected:Ot,newInstance:Et,newTypedArray:at,newTypedArrayFrom:it,normalizeWheel:Ht,obj:yt,proxy:Ut,proxyPropertyMapping:zt,proxyPropertyState:Wt,safeArrays:pt,set:St,setArray:It,setGet:Pt,setGetArray:wt,setImmediate:ht,setLoggerFunction:Ye,throttle:kt,traverseInstanceTree:Bt,TYPED_ARRAYS:ot,uncapitalize:ct,VOID:Ke,vtkDebugMacro:Je,vtkErrorMacro:et,vtkInfoMacro:Qe,vtkLogMacro:Ze,vtkOnceErrorMacro:rt,vtkWarningMacro:tt},Kt=Object.freeze({__proto__:null,VOID:Ke,setLoggerFunction:Ye,vtkLogMacro:Ze,vtkInfoMacro:Qe,vtkDebugMacro:Je,vtkErrorMacro:et,vtkWarningMacro:tt,vtkOnceErrorMacro:rt,TYPED_ARRAYS:ot,newTypedArray:at,newTypedArrayFrom:it,capitalize:st,_capitalize:lt,uncapitalize:ct,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,setImmediateVTK:ht,measurePromiseExecution:vt,obj:yt,get:xt,set:St,setGet:Pt,getArray:At,setArray:It,setGetArray:wt,moveToProtected:Ot,algo:Mt,EVENT_ABORT:Rt,event:Vt,newInstance:Et,chain:Dt,isVtkObject:Lt,traverseInstanceTree:Bt,debounce:Nt,throttle:kt,keystore:Ft,proxy:Ut,proxyPropertyMapping:zt,proxyPropertyState:Wt,normalizeWheel:Ht,default:jt});const{vtkErrorMacro:$t}=jt;function qt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return $t("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xt,n),jt.obj(e,t),jt.event(e,t,"event"),t._renderableChildMap=new Map,jt.get(e,t,["visited"]),jt.setGet(e,t,["_parent","renderable","myFactory"]),jt.getArray(e,t,["children"]),jt.moveToProtected(e,t,["parent"]),qt(e,t)}var Zt={newInstance:jt.newInstance(Yt,"vtkViewNode"),extend:Yt,PASS_TYPES:["Build","Render"]};function Qt(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),a=!1;const i=Object.keys(t.overrides);for(;o&&!a;)-1!==i.indexOf(o)?a=!0:o=n.getClassName(r++);if(!a)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const Jt={};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jt,n),jt.obj(e,t),Qt(e,t)}var tn={newInstance:jt.newInstance(en,"vtkViewNodeFactory"),extend:en};const nn=Object.create(null);function rn(e,t){nn[e]=t}function on(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const an={};function sn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,an,n),t.overrides=nn,tn.extend(e,t,n),on(0,t)}var ln={newInstance:jt.newInstance(sn,"vtkOpenGLViewNodeFactory"),extend:sn};function cn(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){d(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),se(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();d(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),m(t.keyMatrices.vcpc,t.keyMatrices.vcpc),b(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const un={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const dn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,un,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},Pt(e,t,["context","keyMatrixTime"]),cn(e,t)}));rn("vtkCamera",dn);const{vtkDebugMacro:pn}=Kt;function fn(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(pn("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const gn={context:null,_openGLRenderWindow:null,selector:null};const mn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gn,n),Zt.extend(e,t,n),xt(e,t,["shaderCache"]),Pt(e,t,["selector"]),Ot(0,t,["openGLRenderWindow"]),fn(e,t)}),"vtkOpenGLRenderer");function hn(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=n=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(n,r)=>{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?pe(t.keyMatrices.normalMatrix):(se(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),fe(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkRenderer",mn);const vn={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};const yn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vn,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),xt(e,t,["activeTextures"]),hn(e,t)}));function bn(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=n=>{if(n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOverlayActorCount()}},e.traverseOpaquePass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&!t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOverlayPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable)&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xn,n),Zt.extend(e,t,n),Pt(e,t,["context"]),xt(e,t,["activeTextures"]),bn(e,t)}));function Cn(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sn(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function Pn(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function An(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function In(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function wn(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function On(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Mn(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Rn(e,t){var n=t[0],r=t[1],o=t[2],a=n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Vn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function En(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[0],s=n[1],l=n[2];return e[0]=o*l-a*s,e[1]=a*i-r*l,e[2]=r*s-o*i,e}function Dn(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[3]*r+n[7]*o+n[11]*a+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*o+n[8]*a+n[12])/i,e[1]=(n[1]*r+n[5]*o+n[9]*a+n[13])/i,e[2]=(n[2]*r+n[6]*o+n[10]*a+n[14])/i,e}function Ln(e,t,n){var r=t[0],o=t[1],a=t[2];return e[0]=r*n[0]+o*n[3]+a*n[6],e[1]=r*n[1]+o*n[4]+a*n[7],e[2]=r*n[2]+o*n[5]+a*n[8],e}function Bn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Nn(e,t){var n=e[0],r=e[1],o=e[2],i=t[0],s=t[1],l=t[2];return Math.abs(n-i)<=a*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-s)<=a*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-l)<=a*Math.max(1,Math.abs(o),Math.abs(l))}rn("vtkActor2D",Tn);var kn=wn,Fn=Sn,_n=(Cn(),Math.sqrt(50)),Gn=Math.sqrt(10),Un=Math.sqrt(2);function zn(e,t,n){var r=(t-e)/Math.max(0,n),o=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,o);return o>=0?(a>=_n?10:a>=Gn?5:a>=Un?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(a>=_n?10:a>=Gn?5:a>=Un?2:1)}function Wn(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function Hn(e){let t=e,n=e,r=e;function o(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<0?o=n+1:a=n}while(oe(t)-n,n=Wn,r=(t,n)=>Wn(e(t),n)),{left:o,center:function(e,n,r=0,a=e.length){const i=o(e,n,r,a-1);return i>r&&t(e[i-1],n)>-t(e[i],n)?i-1:i},right:function(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<=0?o=n+1:a=n}while(o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?gr(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?gr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=rr.exec(e))?new vr(t[1],t[2],t[3],1):(t=or.exec(e))?new vr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ar.exec(e))?gr(t[1],t[2],t[3],t[4]):(t=ir.exec(e))?gr(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=sr.exec(e))?Sr(t[1],t[2]/100,t[3]/100,1):(t=lr.exec(e))?Sr(t[1],t[2]/100,t[3]/100,t[4]):cr.hasOwnProperty(e)?fr(cr[e]):"transparent"===e?new vr(NaN,NaN,NaN,0):null}function fr(e){return new vr(e>>16&255,e>>8&255,255&e,1)}function gr(e,t,n,r){return r<=0&&(e=t=n=NaN),new vr(e,t,n,r)}function mr(e){return e instanceof Yn||(e=pr(e)),e?new vr((e=e.rgb()).r,e.g,e.b,e.opacity):new vr}function hr(e,t,n,r){return 1===arguments.length?mr(e):new vr(e,t,n,null==r?1:r)}function vr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function yr(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}`}function br(){const e=xr(this.opacity);return`${1===e?"rgb(":"rgba("}${Tr(this.r)}, ${Tr(this.g)}, ${Tr(this.b)}${1===e?")":`, ${e})`}`}function xr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Tr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Cr(e){return((e=Tr(e))<16?"0":"")+e.toString(16)}function Sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ar(e,t,n,r)}function Pr(e){if(e instanceof Ar)return new Ar(e.h,e.s,e.l,e.opacity);if(e instanceof Yn||(e=pr(e)),!e)return new Ar;if(e instanceof Ar)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),i=NaN,s=a-o,l=(a+o)/2;return s?(i=t===a?(n-r)/s+6*(n0&&l<1?0:i,new Ar(i,s,l,e.opacity)}function Ar(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ir(e){return(e=(e||0)%360)<0?e+360:e}function wr(e){return Math.max(0,Math.min(1,e||0))}function Or(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Mr(e,t,n,r,o){var a=e*e,i=a*e;return((1-3*e+3*a-i)*t+(4-6*a+3*i)*n+(1+3*e+3*a-3*i)*r+i*o)/6}qn(Yn,pr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ur,formatHex:ur,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Pr(this).formatHsl()},formatRgb:dr,toString:dr}),qn(vr,hr,Xn(Yn,{brighter(e){return e=null==e?Qn:Math.pow(Qn,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Zn:Math.pow(Zn,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vr(Tr(this.r),Tr(this.g),Tr(this.b),xr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:yr,formatHex:yr,formatHex8:function(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}${Cr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:br,toString:br})),qn(Ar,(function(e,t,n,r){return 1===arguments.length?Pr(e):new Ar(e,t,n,null==r?1:r)}),Xn(Yn,{brighter(e){return e=null==e?Qn:Math.pow(Qn,e),new Ar(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Zn:Math.pow(Zn,e),new Ar(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new vr(Or(e>=240?e-240:e+120,o,r),Or(e,o,r),Or(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ar(Ir(this.h),wr(this.s),wr(this.l),xr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=xr(this.opacity);return`${1===e?"hsl(":"hsla("}${Ir(this.h)}, ${100*wr(this.s)}%, ${100*wr(this.l)}%${1===e?")":`, ${e})`}`}}));var Rr=e=>()=>e;function Vr(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Rr(isNaN(e)?t:e)}var Er=function e(t){var n=function(e){return 1==(e=+e)?Vr:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Rr(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=hr(e)).r,(t=hr(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),i=Vr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=a(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function Dr(e){return function(t){var n,r,o=t.length,a=new Array(o),i=new Array(o),s=new Array(o);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),o=e[r],a=e[r+1],i=r>0?e[r-1]:2*o-a,s=ra&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:Nr(n,r)})),a=_r.lastIndex;return at&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Xr:qr,o=a=null,d}function d(t){return null==t||isNaN(t=+t)?n:(o||(o=r(i.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,i.map(e),Nr)))(n)))},d.domain=function(e){return arguments.length?(i=Array.from(e,Hr),u()):i.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Wr,u()},d.clamp=function(e){return arguments.length?(c=!!e||Kr,u()):c!==Kr},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}()(Kr,Kr)}function Qr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}var Jr,eo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function to(e){if(!(t=eo.exec(e)))throw new Error("invalid format: "+e);var t;return new no({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function no(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function ro(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function oo(e){return(e=ro(Math.abs(e)))?e[1]:NaN}function ao(e,t){var n=ro(e,t);if(!n)return e+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}to.prototype=no.prototype,no.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var io={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ao(100*e,t),r:ao,s:function(e,t){var n=ro(e,t);if(!n)return e+"";var r=n[0],o=n[1],a=o-(Jr=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ro(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function so(e){return e}var lo,co,uo,po=Array.prototype.map,fo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function go(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){var r,o,a,i,s=-1;if(n=+n,(e=+e)==(t=+t)&&n>0)return[e];if((r=t0){let n=Math.round(e/i),r=Math.round(t/i);for(n*it&&--r,a=new Array(o=r-n+1);++st&&--r,a=new Array(o=r-n+1);++s=_n?o*=10:a>=Gn?o*=5:a>=Un&&(o*=2),t0;){if((o=zn(l,c,n))===r)return a[i]=l,a[s]=c,t(a);if(o>0)l=Math.floor(l/o)*o,c=Math.ceil(c/o)*o;else{if(!(o<0))break;l=Math.ceil(l*o)/o,c=Math.floor(c*o)/o}r=o}return e},e}function mo(){var e=Zr();return e.copy=function(){return Yr(e,mo())},Qr.apply(e,arguments),go(e)}lo=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?so:(t=po.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var o=e.length,a=[],i=0,s=t[0],l=0;o>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(o-=s,o+s)),!((l+=s+1)>r));)s=t[i=(i+1)%t.length];return a.reverse().join(n)}),o=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?so:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(po.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=to(e)).fill,n=e.align,d=e.sign,p=e.symbol,f=e.zero,g=e.width,m=e.comma,h=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):io[y]||(void 0===h&&(h=12),v=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===p?o:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===p?a:/[%p]/.test(y)?l:"",T=io[y],C=/[defgprs%]/.test(y);function S(e){var o,a,l,p=b,S=x;if("c"===y)S=T(e)+S,e="";else{var P=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:T(Math.abs(e),h),v&&(e=function(e){e:for(var t,n=e.length,r=1,o=-1;r0&&(o=0)}return o>0?e.slice(0,o)+e.slice(t+1):e}(e)),P&&0==+e&&"+"!==d&&(P=!1),p=(P?"("===d?d:c:"-"===d||"("===d?"":d)+p,S=("s"===y?fo[8+Jr/3]:"")+S+(P&&"("===d?")":""),C)for(o=-1,a=e.length;++o(l=e.charCodeAt(o))||l>57){S=(46===l?i+e.slice(o+1):e.slice(o))+S,e=e.slice(0,o);break}}m&&!f&&(e=r(e,1/0));var A=p.length+e.length+S.length,I=A>1)+p+e+S+I.slice(A);break;default:e=I+p+e+S}return s(e)}return h=void 0===h?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h)),S.toString=function(){return e+""},S}return{format:d,formatPrefix:function(e,t){var n=d(((e=to(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(oo(t)/3))),o=Math.pow(10,-r),a=fo[8+r/3];return function(e){return n(o*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),co=lo.format,uo=lo.formatPrefix;var ho=n(640),vo=n.n(ho);const yo=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],bo=[1,0,0,0,1,0,0,0,1],xo=1e-6,To=1e-12,{vtkErrorMacro:Co,vtkWarningMacro:So}=jt;let Po=0;function Ao(e){return()=>Co(`vtkMath::${e} - NOT IMPLEMENTED`)}function Io(e,t,n,r){let o;for(let a=0;a0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r=0?o:-o}function Jo(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ea(e){const t=Jo(e);return 0!==t&&(e[0]/=t,e[1]/=t),t}function ta(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:xo;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const sa=ia;function la(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function ca(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function pa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=da(e[0],n),t[1]=da(e[1],n),t[2]=da(e[2],n),t}function fa(e,t,n,r){let o,a,i,s,l,c,u,d,p,f,g,m,h,v,y,b;const x=Oo(t),T=Oo(t),C=(e,t,n)=>{v=e[t],h=e[n],e[t]=v-m*(h+v*f),e[n]=h+m*(v-h*f)};for(ca(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>u){for(h=n[s]-n[l],Math.abs(h)+v===Math.abs(h)?p=e[l*t+s]/h:(d=.5*h/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),h=p*e[l*t+s],T[l]-=h,T[s]+=h,n[l]-=h,n[s]+=h,e[l*t+s]=0,a=0;a<=l-1;a++)C(e,a*t+l,a*t+s);for(a=l+1;a<=s-1;a++)C(e,l*t+a,a*t+s);for(a=s+1;a=20)return So("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a=b||Math.abs(n[o]-b)>1)+(1&t);for(c=0,o=0;o=0&&c++;if(cr?a:r,o=i>o?i:o,n[e]=1,0!==o&&(n[e]/=o)}const a=Math.abs(t[0])*n[0],i=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=a,i>=o&&(o=i,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(wo(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],c=Math.abs(t[7])*n[2];r[1]=1,o=l,c>=o&&(r[1]=2,wo(t,3,1,2)),r[2]=2;let u=0;if(aa(t)<0){u=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=Oo(4);if(ga(t,d),ua(d,t),u)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&wo(t,3,r[1],1),0!==r[0]&&wo(t,3,r[0],0)}function ha(e,t,n){let r,o,a,i,s,l;if(fa([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(oa(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),i=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,i=o);i!==r&&(s=t[i],t[i]=t[r],t[r]=s,Io(n,3,r,i)),n[3*i+i]<0&&(n[3*i]=-n[3*i],n[3*i+1]=-n[3*i+1],n[3*i+2]=-n[3*i+2]),o=(i+1)%3,a=(i+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=$o([n[3*i],n[3*i+1],n[3*i+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Xo(e);const c=$o(e,[n[3*i],n[3*i+1],n[3*i+2]],[]);for(let t=0;t<3;t++)n[3*a+t]=e[t],n[3*o+t]=c[t];return void oa(n,n)}for(l=Math.abs(n[0]),i=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,i=r);if(0!==i){const e=t[i];t[i]=t[0],t[0]=e,Io(n,3,i,0)}if(Math.abs(n[4])i&&(i=c);if(0===i)return So("Unable to factor linear system"),0;d[r]=1/i}for(o=0;o=i&&(i=l,u=r)}if(o!==u){for(a=0;a=0)for(a=i;a<=o-1;a++)l-=e[o*r+a]*n[a];else 0!==l&&(i=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],a=o+1;a3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=r||Oo(n),i=o||Oo(n);if(0===va(e,a,n))return null;for(let r=0;ri&&n<=a?(u=1,c=(a-n)/i,d=0):n>a&&n<=.5?(u=1,d=(n-a)/i,c=0):n>.5&&n<=s?(d=1,u=(s-n)/i,c=0):n>s&&n<=l?(d=1,c=(n-s)/i,u=0):n>l&&n<=1?(c=1,d=(1-n)/i,u=0):(c=1,u=n/i,d=0),c=r*c+(1-r),u=r*u+(1-r),d=r*d+(1-r),c*=o,u*=o,d*=o,t[0]=c,t[1]=u,t[2]=d}function Sa(e,t){const[n,r,o]=e;let a=(n+16)/116,i=r/500+a,s=a-o/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,i**3>.008856?i**=3:i=(i-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*i,t[1]=1*a,t[2]=1.089*s}function Pa(e,t){const[n,r,o]=e;let a=n/.9505,i=r/1,s=o/1.089;a>.008856?a**=1/3:a=7.787*a+16/116,i>.008856?i**=1/3:i=7.787*i+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*i-16,t[1]=500*(a-i),t[2]=200*(i-s)}function Aa(e,t){const[n,r,o]=e;let a=3.2406*n+-1.5372*r+-.4986*o,i=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=a;l1&&(a/=l,i/=l,s/=l),a<0&&(a=0),i<0&&(i=0),s<0&&(s=0),t[0]=a,t[1]=i,t[2]=s}function Ia(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function wa(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function Oa(e){return!(e[1]-e[0]<0)}function Ma(e,t,n){return en?n:e}function Ra(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=Ma(e[0],t[0],n[0]),r[1]=Ma(e[1],t[1],n[1]),r[2]=Ma(e[2],t[2],n[2]),r}const Va=Ao("GetScalarTypeFittingRange"),Ea=Ao("GetAdjustedScalarRange");const{isFinite:Da,isNaN:La}=Number,Ba=La;function Na(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function ka(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let a=-1/0,i=0,s=0;for(let l=0;l<=o;++l){const c=n[l];for(let n=0;n<=o;++n){const o=r[n],u=Math.abs(e[c+t*o]);u>a&&(a=u,i=l,s=n)}}[n[o],n[i]]=[n[i],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let a=0;a15?t.toString(16):`0${t.toString(16)}`}function _a(e){return Math.round(255*e)}var Ga={Pi:()=>Math.PI,radiansFromDegrees:Mo,degreesFromRadians:Ro,round:Vo,floor:Eo,ceil:Do,ceilLog2:No,min:Lo,max:Bo,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let a=t,i=e.length;a=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Go,add:Uo,subtract:zo,multiplyScalar:Wo,multiplyScalar2D:Ho,multiplyAccumulate:jo,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ko,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:$o,norm:qo,normalize:Xo,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],a=e[1]*e[1],i=e[2]*e[2],s=Math.sqrt(o+a+i);let l,c,u;o>a&&o>i?(l=0,c=1,u=2):a>i?(l=1,c=2,u=0):(l=2,c=0,u=1);const d=e[l]/s,p=e[c]/s,f=e[u]/s,g=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/g,t[c]=e*g,t[u]=(-d*o-p*f*e)/g),n&&(n[l]=(-f*e-d*p*o)/g,n[c]=o*g,n[u]=(d*e-p*f*o)/g)}else t&&(t[l]=f/g,t[c]=0,t[u]=-d/g),n&&(n[l]=-d*p/g,n[c]=g,n[u]=-p*f/g)},projectVector:function(e,t,n){const r=Ko(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ko(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Wo(n,o),!0},projectVector2D:function(e,t,n){const r=Yo(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Yo(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Ho(n,o),!0},distance2BetweenPoints:Zo,angleBetweenVectors:function(e,t){const n=[0,0,0];return $o(e,t,n),Math.atan2(qo(n),Ko(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Yo,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:Jo,normalize2D:ea,determinant2x2:ta,LUFactor3x3:function(e,t){let n,r,o;const a=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),a[t]=1/o;o=a[0]*Math.abs(e[0]),n=0,(r=a[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=a[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(Io(e,3,n,0),a[n]=a[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=a[1]*Math.abs(e[4]),n=1,(r=a[2]*Math.abs(e[7]))>=o&&(n=2,Io(e,3,1,2),a[2]=a[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],a=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=+ta(s,u,l,d),f=-ta(i,c,l,d),g=+ta(i,c,s,u),m=-ta(o,u,a,d),h=+ta(r,c,a,d),v=-ta(r,c,o,u),y=+ta(o,s,a,l),b=-ta(r,i,a,l),x=+ta(r,i,o,s),T=r*p+o*f+a*g,C=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+h*t[1]+b*t[2],P=g*t[0]+v*t[1]+x*t[2];n[0]=C/T,n[1]=S/T,n[2]=P/T},multiply3x3_vect3:na,multiply3x3_mat3:ra,multiplyMatrix:function(e,t,n,r,o,a,i){r!==o&&Co("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:xo;return sa(e,yo,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xo;return sa(e,bo,t)},determinant3x3:aa,quaternionToMatrix3x3:ua,areEquals:ia,areMatricesEqual:sa,roundNumber:da,roundVector:pa,matrix3x3ToQuaternion:ga,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],a=e[0]*t[2],i=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],c=e[1]*t[2],u=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],g=e[2]*t[3],m=e[3]*t[0],h=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+g-v,n[2]=a-u+d+h,n[3]=i+c-p+m},orthogonalize3x3:ma,diagonalize3x3:ha,singularValueDecomposition3x3:function(e,t,n,r){let o;const a=[...e],i=aa(a);if(i<0)for(o=0;o<9;o++)a[o]=-a[o];ma(a,t),oa(a,a),ra(a,t,r),ha(r,n,r),ra(t,r,t),oa(r,r),i<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:ba,invertMatrix:xa,luFactorLinearSystem:va,luSolveLinearSystem:ya,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(eTo&&(p=0,s[u]=0);if(p&&1===o)return So("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),Ta(e,t,n,a);if(p)g=1;else for(u=0;u1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:function(e,t){let n,r;const[o,a,i]=e,s=1/6;let l=o,c=o;a>l?l=a:al?l=i:i0?(l-c)/l:0,r>0?(n=o===l?s*(a-i)/(l-c):a===l?.3333333333333333+s*(i-o)/(l-c):.6666666666666666+s*(o-a)/(l-c),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=u},hsv2rgb:Ca,lab2xyz:Sa,xyz2lab:Pa,xyz2rgb:Aa,rgb2xyz:Ia,rgb2lab:function(e,t){const n=[0,0,0];Ia(e,n),Pa(n,t)},lab2rgb:function(e,t){const n=[0,0,0];Sa(e,n),Aa(n,t)},uninitializeBounds:wa,areBoundsInitialized:Oa,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:Ma,clampVector:Ra,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Va,getAdjustedScalarRange:Ea,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=Oo(3),a=Oo(3),i=Oo(3),s=Oo(3),l=Oo(3),c=Oo(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],a[r]=t[r]-n[r],i[r]=n[r]-e[r],s[r]=-o[r],l[r]=-a[r],c[r]=-i[r];const u=qo(s),d=qo(l),p=qo(i),f=Oo(3);$o(o,a,f);const g=qo(f),m=u*d*p/(2*g),h=2*g*g,v=d*d*Ko(o,c)/h,y=p*p*Ko(s,a)/h,b=u*u*Ko(i,l)/h;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:e=>!Number.isFinite(e),isNan:La,isNaN:La,isFinite:Da,createUninitializedBounds:Na,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:ka,floatToHex2:Fa,floatRGB2HexCode:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Fa).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(_a).join(", ")})`:`rgba(${_a(e[0]||0)}, ${_a(e[1]||0)}, ${_a(e[2]||0)}, ${e[3]||0})`}};const Ua=1e-6,za="coincide",Wa="disjoint";function Ha(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function ja(e,t,n,r){const o=[];zo(e,t,o);const a=Ko(n,o);r[0]=e[0]-a*n[0],r[1]=e[1]-a*n[1],r[2]=e[2]-a*n[2]}function Ka(e,t,n){const r=Ko(e,t);let o=Ko(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function $a(e,t,n,r){const o=[];zo(e,t,o);const a=Ko(n,o),i=Ko(n,n);0!==i?(r[0]=e[0]-a*n[0]/i,r[1]=e[1]-a*n[1]/i,r[2]=e[2]-a*n[2]/i):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function qa(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},a=[],i=[];zo(t,e,a),zo(n,e,i);const s=Ko(r,i),l=Ko(r,a);let c,u;return c=l<0?-l:l,u=s<0?-s*Ua:s*Ua,c<=u||(o.t=s/l,o.x[0]=e[0]+o.t*a[0],o.x[1]=e[1]+o.t*a[1],o.x[2]=e[2]+o.t*a[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function Xa(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},a=[];$o(t,r,a);const i=a.map((e=>Math.abs(e)));if(i[0]+i[1]+i[2]i[1]&&i[0]>i[2]?"x":i[1]>i[2]?"y":"z";const l=[],c=-Ko(t,e),u=-Ko(r,n);switch(s){case"x":l[0]=0,l[1]=(u*t[2]-c*r[2])/a[0],l[2]=(c*r[1]-u*t[1])/a[0];break;case"y":l[0]=(c*r[2]-u*t[2])/a[1],l[1]=0,l[2]=(u*t[0]-c*r[0])/a[1];break;case"z":l[0]=(u*t[1]-c*r[1])/a[2],l[1]=(c*r[0]-u*t[0])/a[2],l[2]=0}return o.l0=l,Uo(l,a,o.l1),o.intersection=!0,o}const Ya={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:Ha,projectPoint:ja,projectVector:Ka,generalizedProjectPoint:$a,intersectWithLine:qa,intersectWithPlane:Xa,DISJOINT:Wa,COINCIDE:za};function Za(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>Ha(e,t.origin,t.normal),e.projectPoint=(e,n)=>{ja(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>Ka(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{$a(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>qa(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>Xa(e,n,t.origin,t.normal)}const Qa={normal:[0,0,1],origin:[0,0,0]};function Ja(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qa,n),jt.obj(e,t),jt.setGetArray(e,t,["normal","origin"],3),Za(e,t)}var ei={newInstance:jt.newInstance(Ja,"vtkPlane"),extend:Ja,...Ya};const ti=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function ni(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function ri(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function oi(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ai(e){return oi(e,ti)}function ii(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=ot?a:t,e[2]=in?s:n,e[4]=lr?c:r,e}function si(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;na?t:a,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>c?r:c,o!==t||i!==n||l!==r}function ui(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function fi(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function gi(e,t){return e[2*t+1]-e[2*t]}function mi(e){return[gi(e,0),gi(e,1),gi(e,2)]}function hi(e){return e.slice(0,2)}function vi(e){return e.slice(2,4)}function yi(e){return e.slice(4,6)}function bi(e){const t=mi(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function xi(e){if(ri(e)){const t=mi(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function Ti(e){return[e[0],e[2],e[4]]}function Ci(e){return[e[1],e[3],e[5]]}function Si(e,t){return e<=0&&t>=0||e>=0&&t<=0}function Pi(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let a=4;a<6;a++)t[n++]=[e[r],e[o],e[a]];return t}function Ai(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function Ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=Pi(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function Oi(e,t,n,r){const o=[].concat(ti),a=e.getData();for(let e=0;ee[2*n+1]?(i[n]=0,c[n]=e[2*n+1],a=!1):i[n]=2;if(a)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==i[e]&&0!==n[e]?l[e]=(c[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=c[o];return 1}function Ri(e,t,n){const r=[];let o=0,a=1,i=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=ei.evaluate(n,t,r),i&&(a=o>=0?1:-1,i=0),0===o||a>0&&o<0||a<0&&o>0)return 1}}return 0}function Vi(e,t){if(!ri(e)||!ri(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function Ei(e,t){if(!ri(e)||!ri(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function Di(e,t,n,r){return!(te[1]||ne[3]||re[5])}function Li(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let a=0;for(let r=0;r<2;r++)for(let i=2;i<4;i++)for(let s=4;s<6;s++){const l=[e[r],e[i],e[s]];o[a++]=ei.evaluate(n,t,l)}let i=2;for(;i--&&!(Si(o[r[i][0]],o[r[i][4]])&&Si(o[r[i][1]],o[r[i][5]])&&Si(o[r[i][2]],o[r[i][6]])&&Si(o[r[i][3]],o[r[i][7]])););if(i<0)return!1;const s=Math.sign(n[i]),l=Math.abs((e[2*i+1]-e[2*i])*n[i]);let c=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[i][e]])/l;s>0&&tc&&(c=t)}const u=(1-c)*e[2*i]+c*e[2*i+1];return s>0?e[2*i]=u:e[2*i+1]=u,!0}class Bi{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(ti))}getBounds(){return this.bounds}equals(e){return ni(this.bounds,e)}isValid(){return ri(this.bounds)}setBounds(e){return oi(this.bounds,e)}reset(){return ai(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return Ii(this.bounds,e,t)}computeScale3(e){return wi(this.bounds,e)}cutWithPlane(e,t){return Li(this.bounds,e,t)}intersectBox(e,t,n,r){return Mi(this.bounds,e,t,n,r)}intersectPlane(e,t){return Ri(this.bounds,e,t)}intersect(e){return Vi(this.bounds,e)}intersects(e){return Ei(this.bounds,e)}containsPoint(e,t,n){return Di(this.bounds,e,t,n)}contains(e){return Ei(this.bounds,e)}}const Ni={equals:ni,isValid:ri,setBounds:oi,reset:ai,addPoint:ii,addPoints:si,addBounds:li,setMinPoint:ci,setMaxPoint:ui,inflate:di,scale:pi,scaleAboutCenter:function(e,t,n,r){if(!ri(e))return!1;const o=fi(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],pi(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:fi,getLength:gi,getLengths:mi,getMaxLength:bi,getDiagonalLength:xi,getMinPoint:Ti,getMaxPoint:Ci,getXRange:hi,getYRange:vi,getZRange:yi,getCorners:Pi,computeCornerPoints:Ai,computeLocalBounds:Oi,transformBounds:Ii,computeScale3:wi,cutWithPlane:Li,intersectBox:Mi,intersectPlane:Ri,intersect:Vi,intersects:Ei,containsPoint:Di,contains:function(e,t){return!!Ei(e,t)&&!!Di(e,...Ti(t))&&!!Di(e,...Ci(t))},INIT_BOUNDS:ti};var ki,Fi={newInstance:function(e){const t=e&&e.bounds;return new Bi(t)},...Ni};function _i(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Gi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*a+n[12]*i,e[1]=n[1]*r+n[5]*o+n[9]*a+n[13]*i,e[2]=n[2]*r+n[6]*o+n[10]*a+n[14]*i,e[3]=n[3]*r+n[7]*o+n[11]*a+n[15]*i,e}function Ui(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function zi(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Wi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=r*u+i*s+o*c-a*l,e[1]=o*u+i*l+a*s-r*c,e[2]=a*u+i*c+r*l-o*s,e[3]=i*u-r*s-o*l-a*c,e}ki=new i(4),i!=Float32Array&&(ki[0]=0,ki[1]=0,ki[2]=0,ki[3]=0);var Hi=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Cn(),Pn(1,0,0),Pn(0,1,0),Ui(),Ui(),ie();var ji={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:Ki}=ji;function $i(e){return()=>jt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function qi(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=$i("pick"),e.hasKey=$i("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(Ki.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(Ki.DISPLAY)}const Xi={allocatedRenderTime:10,coordinateSystem:Ki.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Yi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xi,n),jt.obj(e,t),jt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),jt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),jt.moveToProtected(e,t,["parentProp"]),qi(e,t)}var Zi={newInstance:jt.newInstance(Yi,"vtkProp"),extend:Yi,...ji};function Qi(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ui();N(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>a?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[Ro(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(S(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateY=n=>{0!==n&&(P(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateZ=n=>{0!==n&&(A(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateWXYZ=(n,r,o,a)=>{if(0===n||0===r&&0===o&&0===a)return;const i=Mo(n),s=Ui();zi(s,[r,o,a],i);const l=new Float64Array(16);_(l,s),b(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],g(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!sa(t.userMatrix,n)&&(d(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){g(t.matrix),t.userMatrix&&b(t.matrix,t.matrix,t.userMatrix),x(t.matrix,t.matrix,t.origin),x(t.matrix,t.matrix,t.position),b(t.matrix,t.matrix,t.rotation),T(t.matrix,t.matrix,t.scale),x(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),m(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>Fi.getCenter(t.bounds),e.getLength=()=>Fi.getLength(t.bounds),e.getXRange=()=>Fi.getXRange(t.bounds),e.getYRange=()=>Fi.getYRange(t.bounds),e.getZRange=()=>Fi.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Ji={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function es(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ji,n),Zi.extend(e,t,n),t.matrixMTime={},jt.obj(t.matrixMTime),jt.get(e,t,["bounds","isIdentity"]),jt.getArray(e,t,["orientation"]),jt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=g(new Float64Array(16)),t.rotation=g(new Float64Array(16)),t.userMatrix=g(new Float64Array(16)),t.transform=null,Qi(e,t)}var ts={newInstance:jt.newInstance(es,"vtkProp3D"),extend:es};const ns={FLAT:0,GOURAUD:1,PHONG:2},rs={POINTS:0,WIREFRAME:1,SURFACE:2};var os={Shading:ns,Representation:rs,Interpolation:ns};const{Representation:as,Interpolation:is}=os;function ss(e){return()=>jt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function ls(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=ss("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=ss("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(is.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(is.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(is.PHONG),e.getInterpolationAsString=()=>jt.enumToString(is,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(as.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(as.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(as.POINTS),e.getRepresentationAsString=()=>jt.enumToString(as,t.representation)}const cs={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:is.GOURAUD,representation:as.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function us(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cs,n),jt.obj(e,t),jt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),jt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),ls(e,t)}var ds={newInstance:jt.newInstance(us,"vtkProperty"),extend:us,...os};const{vtkDebugMacro:ps}=jt;function fs(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=ds.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){ps("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];Fi.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);m(o,t.matrix),r.forEach((e=>Dn(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const gs={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function ms(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gs,n),ts.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),fs(e,t)}var hs={newInstance:jt.newInstance(ms,"vtkActor"),extend:ms};const vs={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ys={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var bs={DefaultDataType:ys.FLOAT,DataTypeByteSize:vs,VtkDataTypes:ys};const{vtkErrorMacro:xs}=Kt,{DefaultDataType:Ts}=bs,Cs=1e-6;function Ss(e,t,n){const r=e.length;let o,a,i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(a=t;as&&(s=o);return{min:i,max:s}}function Ps(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,a=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Is(e){return Object.prototype.toString.call(e).slice(8,-1)}const ws={computeRange:Ps,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Ss,getDataType:Is,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=a)}return n}};function Os(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=at(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,a=n%t.numberOfComponents;e.setComponent(o,a,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=As(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=Ps(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=As(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const a=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cs;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,a=(r??e.getNumberOfTuples())*t.numberOfComponents,i=e.getData().subarray(o,a);return i.length>0?i:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Vs({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Is(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,a,i,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===a.getNumberOfComponents()||xs("numberOfComponents must match");const c=r.getTuple(o),u=a.getTuple(i),d=[];switch(d.length=l,l){case 4:d[3]=c[3]+(u[3]-c[3])*s;case 3:d[2]=c[2]+(u[2]-c[2])*s;case 2:d[1]=c[1]+(u[1]-c[1])*s;case 1:d[0]=c[0]+(u[0]-c[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ms,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=it(t.dataType,t.values)):t.values=at(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Is(t.values)),yt(e,t),St(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Os(e,t)}const Vs=Et(Rs,"vtkDataArray");var Es={newInstance:Vs,extend:Rs,...ws,...bs};function Ds(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,a=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),jt.obj(e,t),jt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Ds(e,t)};function Ns(e,t){e.getBounds=()=>(jt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Na()),e.getCenter=()=>{const n=e.getBounds();return t.center=Fi.isValid(n)?Fi.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return Fi.getDiagonalLength(t)}}const ks=e=>({bounds:[...Fi.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Fs=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ks(n)),Bs(e,t,n),jt.setGet(e,t,["viewSpecificProperties"]),Ns(e,t)};const{vtkErrorMacro:_s,vtkWarningMacro:Gs}=jt;function Us(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:We(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:a}=e.getArrayWithIndex(r);return null!=o?(t.arrays[a]={data:n},a):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((a=>{const i=e.getFlag(a.getName());if(!1!==i&&(!t.doCopyAllOff||!0===i)&&a){let t=e.getArrayByName(a.getName());if(t)if(a.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,a.getTuple(r))}else t.insertTuples(0,a.getTuples());else _s("Unhandled case in passData");else if(r<0||r>a.getNumberOfTuples())e.addArray(a),n.getAttributes(a).forEach((t=>{e.setAttribute(a,t)}));else{const i=a.getNumberOfComponents();let s=a.getNumberOfValues();const l=o>-1?o:r;s<=l*i&&(s=(l+1)*i),t=Es.newInstance({name:a.getName(),dataType:a.getDataType(),numberOfComponents:i,values:jt.newTypedArray(a.getDataType(),s),size:0}),t.insertTuple(l,a.getTuple(r)),e.addArray(t),n.getAttributes(a).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?a:r;t.interpolateTuple(e,s,r,s,o,i),Gs("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else _s("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let c=s.getNumberOfValues();const u=a>-1?a:r;c<=u*l&&(c=(u+1)*l),t=Es.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:jt.newTypedArray(s.getDataType(),c),size:0}),t.interpolateTuple(u,s,r,s,o,i),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const zs={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Ws(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),jt.obj(e,t),Us(e,t)}var Hs={newInstance:jt.newInstance(Ws,"vtkFieldData"),extend:Ws},js={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:Ks,AttributeCopyOperations:$s}=js,{vtkWarningMacro:qs}=jt;function Xs(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>Ks[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const a=r(o);if(n&&"PEDIGREEIDS"===a.toUpperCase()&&!n.isA("vtkDataArray"))return qs(`Cannot set attribute ${a}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,a))return qs(`Cannot set attribute ${a}. Incorrect number of components.`),-1;let i=t[`active${a}`];if(i>=0&&in.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const a=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[$s.PASSDATA][Ks[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[$s.PASSDATA][Ks[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys($s).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[$s[e]]=Object.keys(Ks).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[Ks[t]]=!0,e)),[])})),t.copyAttributeFlags[$s.COPYTUPLE][Ks.GLOBALIDS]=!1,t.copyAttributeFlags[$s.INTERPOLATE][Ks.GLOBALIDS]=!1,t.copyAttributeFlags[$s.COPYTUPLE][Ks.PEDIGREEIDS]=!1},e.initialize=jt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Es.newInstance(t.dataArrays[n]))}));const a=e.shallowCopy;e.shallowCopy=(e,n)=>{a(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const Ys={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function Zs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ys,n),Hs.extend(e,t,n),jt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),Xs(e,t)}var Qs={newInstance:jt.newInstance(Zs,"vtkDataSetAttributes"),extend:Zs,...js};const Js={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};var el={FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:Js};const tl=["pointData","cellData","fieldData"];function nl(e,t){t.classHierarchy.push("vtkDataSet"),tl.forEach((e=>{t[e]?t[e]=We(t[e]):t[e]=Qs.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),tl.forEach((n=>{t[n]=Qs.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const rl={};function ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rl,n),jt.obj(e,t),jt.setGet(e,t,tl),nl(e,t)}var al={newInstance:jt.newInstance(ol,"vtkDataSet"),extend:ol,...el};const il={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var sl={StructuredType:il};const{StructuredType:ll}=sl;var cl={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?ll.EMPTY:3===t?ll.XYZ_GRID:2===t?e[0]===e[1]?ll.YZ_PLANE:e[2]===e[3]?ll.XZ_PLANE:ll.XY_PLANE:1===t?e[0]e!==a[t]));return i&&(t.extent=a.slice(),t.dataDescription=cl.getDataDescriptionFromExtent(t.extent),e.modified()),i},e.setDimensions=function(){let n,r,o;if(t.deleted)ul("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void ul("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return ul("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case il.EMPTY:return null;case il.SINGLE_POINT:break;case il.X_LINE:o[0]=n;break;case il.Y_LINE:o[1]=n;break;case il.Z_LINE:o[2]=n;break;case il.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case il.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case il.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case il.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:ul("Invalid dataDescription")}const a=[0,0,0];return e.indexToWorld(o,a),a},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>Fi.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>Fi.inflate([...t.extent],.5),e.computeTransforms=()=>{I(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],T(t.indexToWorld,t.indexToWorld,t.spacing),h(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Dn(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Dn(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fi.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fi.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>Fi.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],a=[0,0,0];Fi.computeCornerPoints(r,o,a),pa(o,o),pa(a,a);const i=e.getDimensions();Ra(o,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],o),Ra(a,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],a);const s=i[0],l=i[0]*i[1],c=e.getPointData().getScalars().getData();let u=-1/0,d=1/0,p=0,f=0,g=0;for(let e=o[2];e<=a[2];e++)for(let t=o[1];t<=a[1];t++){let i=o[0]+t*s+e*l;for(let s=o[0];s<=a[0];s++){if(!n||n([s,t,e],r)){const e=c[i];e>u&&(u=e),e0?f/g:0,h=g?Math.abs(p/g-m*m):0,v=Math.sqrt(h);return{minimum:d,maximum:u,average:m,variance:h,sigma:v,count:g}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const a=e.getExtent(),i=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(a,i);return Math.floor((Math.round(n)-a[0])*s[0]+(Math.round(r)-a[2])*s[1]+(Math.round(o)-a[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return ul(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return ul(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const pl={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:il.EMPTY};function fl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pl,n),al.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=pe(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),jt.get(e,t,["indexToWorld","worldToIndex"]),jt.setGetArray(e,t,["origin","spacing"],3),jt.setGetArray(e,t,["direction"],9),jt.getArray(e,t,["extent"],6),dl(e,t)}var gl={newInstance:jt.newInstance(fl,"vtkImageData"),extend:fl};const ml={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var hl={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:ml};const vl={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5};var yl={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:vl};const{ScalarMappingTarget:bl,VectorMode:xl}=hl,{VtkDataTypes:Tl}=Es,{ColorMode:Cl}=yl,{vtkErrorMacro:Sl}=jt;function Pl(e){return e}function Al(e){return Math.floor(255*e+.5)}function Il(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(xl.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(xl.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(xl.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)Sl("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),a=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,a=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,a=!0),a&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let a=null;if(n===Cl.DEFAULT&&t.getDataType()===Tl.UNSIGNED_CHAR||n===Cl.DIRECT_SCALARS&&t)a=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:Tl.UNSIGNED_CHAR},i=jt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=i,n.size=i.length,a=Es.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,a,bl.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,a,bl.RGBA,s))}return a},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),a=t.getData(),i=e.getData();for(let e=0;e{let i=e.getVectorMode(),s=a,l=o;const c=t.getNumberOfComponents();i===xl.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=c&&(l=c-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=c):(l<0&&(l=0),l>=c&&(l=c-1),l+s>c&&(s=c-l)),i!==xl.MAGNITUDE||1!==c&&1!==s||(i=xl.COMPONENT));let u=0;switch(l>0&&(u=l),i){case xl.COMPONENT:e.mapScalarsThroughTable(t,n,r,u);break;case xl.RGBCOLORS:break;case xl.MAGNITUDE:default:{const o=Es.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{const o=Al(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{let{alpha:a}=t;if(4===r&&a>=1&&n.getDataType()===Tl.UNSIGNED_CHAR)return n;const i=Es.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:Tl.UNSIGNED_CHAR});if(o<=0)return i;a=a>0?a:0,a=a<1?a:1;let s=Pl;switch(n.getDataType()!==Tl.FLOAT&&n.getDataType()!==Tl.DOUBLE||(s=Al),r){case 1:e.luminanceToRGBA(i,n,a,s);break;case 2:e.luminanceAlphaToRGBA(i,n,s);break;case 3:e.rGBToRGBA(i,n,a,s);break;case 4:e.rGBAToRGBA(i,n,a,s);break;default:return Sl("Cannot convert colors"),null}return i},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const a=n.getNumberOfComponents();return(r!==Cl.DEFAULT||n.getDataType()!==Tl.UNSIGNED_CHAR)&&r!==Cl.DIRECT_SCALARS||(3===a||1===a?t.alpha>=1:255===n.getRange(a-1)[0])}}const wl={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:xl.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wl,n),jt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],jt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),jt.setArray(e,t,["mappingRange"],2),jt.getArray(e,t,["mappingRange"]),Il(e,t)}var Ml={newInstance:jt.newInstance(Ol,"vtkScalarsToColors"),extend:Ol,...hl};const{vtkErrorMacro:Rl}=jt;function Vl(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Ba(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const a=4*o;return n.slice(a,a+4)},e.indexedLookupFunction=(n,r,o)=>{let a=e.getAnnotatedValueIndexInternal(n);-1===a&&(a=t.numberOfColors+2);const i=4*a;return[r[i],r[i+1],r[i+2],r[i+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,a)=>{let i=e.linearLookup;t.indexedLookup&&(i=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const c=e.getAlpha(),u=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(c>=1){if(o===ml.RGBA)for(let e=0;e{let n=0,r=0,o=0,a=0;const i=t.numberOfColors-1;i&&(n=(t.hueRange[1]-t.hueRange[0])/i,r=(t.saturationRange[1]-t.saturationRange[0])/i,o=(t.valueRange[1]-t.valueRange[0])/i,a=(t.alphaRange[1]-t.alphaRange[0])/i),t.table.length=4*i+16;const s=[],l=[];for(let e=0;e<=i;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,Ca(s,l),l[3]=t.alphaRange[0]+e*a,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let a=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const El={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Dl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,El,n),Ml.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},jt.obj(t.buildTime),t.opaqueFlagBuildTime={},jt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},jt.obj(t.insertTime,{mtime:0}),jt.get(e,t,["buildTime"]),jt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),jt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),jt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),jt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Vl(e,t)}var Ll={newInstance:jt.newInstance(Dl,"vtkLookupTable"),extend:Dl};let Bl=1,Nl=0;const kl=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function Fl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;Nl=e}var _l={getResolveCoincidentTopologyAsString:function(){return kl[Nl]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return Bl},getResolveCoincidentTopology:function(){return Nl},setResolveCoincidentTopology:Fl,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){Bl=e},setResolveCoincidentTopologyToDefault:function(){Fl(0)},setResolveCoincidentTopologyToOff:function(){Fl(0)},setResolveCoincidentTopologyToPolygonOffset:function(){Fl(1)}};function Gl(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const Ul=["Polygon","Line","Point"],zl={};Gl(zl,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},Ul.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var Wl={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),jt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(_l).forEach((t=>{e[t]=_l[t]})),Object.keys(zl).forEach((t=>{e[t]=zl[t]})),Gl(e,t.topologyOffset,Ul.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=zl.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=zl.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=zl.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:zl,otherStaticMethods:_l,CATEGORIES:Ul};const Hl={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var jl={PassTypes:Hl};const{FieldAssociations:Kl}=al,{staticOffsetAPI:$l,otherStaticMethods:ql}=Wl,{ColorMode:Xl,ScalarMode:Yl,GetArray:Zl}=yl,{VectorMode:Ql}=hl,{VtkDataTypes:Jl}=Es;function ec(e){return()=>jt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function tc(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Na(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Ll.newInstance()},e.getColorModeAsString=()=>jt.enumToString(Xl,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(Yl,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===Yl.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===Yl.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===Yl.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===Yl.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===Yl.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===Yl.USE_FIELD_DATA){const t=e.getFieldData();i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==a){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Ba(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,a,i,s,l,c)=>{const u=(i[1]-i[0])/l,d=[];d[0]=i[0]-u,d[1]=i[1]+u;const p=1/(d[1]-d[0]),f=n.getData(),g=t.getData();let m=0,h=0;if(a<0||a>=o)for(let t=0;t{const o=t.lookupTable.getRange(),a=t.lookupTable.usingLogScale();a&&Ll.getLogRange(o,o);const i=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),i=n.getNumberOfTuples();t.colorCoordinates=Es.newInstance({numberOfComponents:2,values:new Float32Array(2*i)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===Ql.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,i,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,a)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===Xl.DEFAULT&&o.getDataType()===Jl.UNSIGNED_CHAR||t.colorMode===Xl.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=ec("AcquireInvertibleLookupTable"),e.valueToColor=ec("ValueToColor"),e.colorToValue=ec("ColorToValue"),e.useInvertibleColorFor=ec("UseInvertibleColorFor"),e.clearInvertibleColor=ec("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(Hl.ID_LOW24),o=e.getRawPixelBuffer(Hl.ID_HIGH24),a=e.getCurrentPass(),i=e.getFieldAssociation();let s=null;i===Kl.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:i===Kl.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(a===Hl.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const a=s[n],i=e.getPixelBuffer(Hl.ID_LOW24);i[t]=255&a,i[t+1]=(65280&a)>>8,i[t+2]=(16711680&a)>>16}else if(a===Hl.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const a=s[n];e.getPixelBuffer(Hl.ID_HIGH24)[t]=(4278190080&a)>>24}}))}}const nc={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function rc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nc,n),Fs(e,t,n),jt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),jt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),Wl.implementCoincidentTopologyMethods(e,t),tc(e,t)}var oc={newInstance:jt.newInstance(rc,"vtkMapper"),extend:rc,...$l,...ql,...yl};function ac(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function ic(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=ic(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=ac(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const a=e.getNumberOfTuples();a{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function cc(e){return{empty:!0,numberOfComponents:1,dataType:ys.UNSIGNED_INT,...e}}function uc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Es.extend(e,t,cc(n)),lc(e,t)}var dc={newInstance:jt.newInstance(uc,"vtkCellArray"),extend:uc,...sc};const{vtkErrorMacro:pc}=jt,fc=[1,-1,1,-1,1,-1];function gc(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=jt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return pc(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),fc;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const mc={empty:!0,numberOfComponents:3,dataType:ys.FLOAT,bounds:[1,-1,1,-1,1,-1]};function hc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),Es.extend(e,t,n),gc(e,t)}var vc={newInstance:jt.newInstance(hc,"vtkPoints"),extend:hc};function yc(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=jt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,a=3*t;r[a]=o[n],r[++a]=o[++n],r[++a]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else wa(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,a,i)=>{},e.evaluatePosition=(e,t,n,r,o,a)=>{jt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const bc={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function xc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bc,n),jt.obj(e,t),t.points||(t.points=vc.newInstance()),jt.get(e,t,["points","pointsIds"]),yc(e,t)}var Tc={newInstance:jt.newInstance(xc,"vtkCell"),extend:xc};function Cc(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const Sc={array:null,maxId:0,extend:0};function Pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sc,n),jt.obj(e,t),Cc(e,t)}var Ac={newInstance:jt.newInstance(Pc,"vtkCellLinks"),extend:Pc};const Ic=0,wc=1,Oc=2,Mc=3,Rc=4,Vc=5,Ec=6,Dc=7,Lc=9,Bc=21,Nc=41,kc=42,Fc=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],_c={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=Ic},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Uc={size:0,maxId:-1,extend:1e3};function zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uc,n),jt.obj(e,t),jt.get(e,t,["size","maxId","extend"]),jt.getArray(e,t,["typeArray","locationArray"]),Gc(e,t)}var Wc={newInstance:jt.newInstance(zc,"vtkCellTypes"),extend:zc,..._c},Hc={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};const{IntersectionState:jc}=Hc;function Kc(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},a=[];let i;a[0]=n[0]-t[0],a[1]=n[1]-t[1],a[2]=n[2]-t[2];const s=a[0]*(e[0]-t[0])+a[1]*(e[1]-t[1])+a[2]*(e[2]-t[2]),l=Ko(a,a);let c=1e-5*s;return 0!==l&&(o.t=s/l),c<0&&(c=-c),-c1?i=n:(i=a,a[0]=t[0]+o.t*a[0],a[1]=t[1]+o.t*a[1],a[2]=t[2]+o.t*a[2]),r&&(r[0]=i[0],r[1]=i[1],r[2]=i[2]),o.distance=Zo(i,e),o}function $c(e,t,n,r,o,a){const i=[],s=[],l=[];o[0]=0,a[0]=0,zo(t,e,i),zo(r,n,s),zo(n,e,l);const c=[Ko(i,i),-Ko(i,s),-Ko(i,s),Ko(s,s)],u=[];if(u[0]=Ko(i,l),u[1]=-Ko(s,l),0===ba(c,u,2)){let i=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],c=[r,r,t,t];let u;a[0],a[0],o[0],o[0],o[0],o[0],a[0],a[0];for(let e=0;e<4;e++)u=Kc(s[e],l[e],c[e]),u.distance=0&&o[0]<=1&&a[0]>=0&&a[0]<=1?jc.YES_INTERSECTION:jc.NO_INTERSECTION}const qc={distanceToLine:Kc,intersection:$c};function Xc(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,a)=>{const i={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};a[1]=0,a[2]=0;const s=[],l=[],c=[];t.points.getPoint(0,l),t.points.getPoint(1,c);const u=[],d=[],p=$c(e,n,l,c,u,d);var f;if(i.t=u[0],i.betweenPoints=(f=i.t)>=0&&f<=1,a[0]=d[0],p===jc.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+a[0]*(c[t]-l[t]),s[t]=e[t]+i.t*(n[t]-e[t]);if(Zo(o,s)<=r*r)return i.intersect=1,i}else{let t;if(i.t<0)return t=Kc(e,l,c,o),t.distance<=r*r?(i.t=0,i.intersect=1,i.betweenPoints=!0,i):i;if(i.t>1)return t=Kc(n,l,c,o),t.distance<=r*r?(i.t=1,i.intersect=1,i.betweenPoints=!0,i):i;if(a[0]<0)return a[0]=0,t=Kc(l,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i;if(a[0]>1)return a[0]=1,t=Kc(c,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i}return i},e.evaluateLocation=(e,n,r)=>{const o=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,a);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(a[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var o,i,s,l,c,u=t[0],d=t[1],p=t[2],f=t[3],g=n[0],m=n[1],h=n[2],v=n[3];(i=u*g+d*m+p*h+f*v)<0&&(i=-i,g=-g,m=-m,h=-h,v=-v),1-i>a?(o=Math.acos(i),s=Math.sin(o),l=Math.sin((1-r)*o)/s,c=Math.sin(r*o)/s):(l=1-r,c=r),e[0]=l*u+c*g,e[1]=l*d+c*m,e[2]=l*p+c*h,e[3]=l*f+c*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Yc={orientations:null};function Zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yc,n),Tc.extend(e,t,n),jt.setGet(e,t,["orientations"]),Xc(e,t)}var Qc={newInstance:jt.newInstance(Zc,"vtkLine"),extend:Zc,...qc,...Hc};function Jc(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=We(t.points):t.points=vc.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=vc.newInstance(),t.points.shallowCopy(e.getPoints())}}const eu={};function tu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eu,n),al.extend(e,t,n),jt.setGet(e,t,["points"]),Jc(e,t)}var nu={newInstance:jt.newInstance(tu,"vtkPointSet"),extend:tu};function ru(e,t,n,r){const o=n[0]-t[0],a=n[1]-t[1],i=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],c=e[2]-t[2];r[0]=a*c-i*l,r[1]=i*s-o*c,r[2]=o*l-a*s}function ou(e,t,n,r){ru(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const au={computeNormalDirection:ru,computeNormal:ou,intersectWithTriangle:function(e,t,n,r,o,a){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],c=[],u=[],d=[],p=[];ou(e,t,n,d),ou(r,o,a,p);const f=-Ko(d,e),g=-Ko(p,r),m=[Ko(p,e)+g,Ko(p,t)+g,Ko(p,n)+g];if(m[0]*m[1]>i&&m[0]*m[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const h=[Ko(d,r)+f,Ko(d,o)+f,Ko(d,a)+f];if(h[0]*h[1]>i&&h[0]*h[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-g)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const v=[e,t,n],y=[r,o,a],b=Ko(d,p),x=(f-g*b)/(b*b-1),T=(g-f*b)/(b*b-1),C=[x*d[0]+T*p[0],x*d[1]+T*p[1],x*d[2]+T*p[2]],S=$o(d,p,[]);Xo(S);let P=0,A=0;const I=[],w=[];let O,M,R=50,V=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,a=ei.intersectWithLine(v[n],v[o],r,p);a.intersection&&a.t>0-i&&a.t<1+i&&(a.t<1+i&&a.t>1-i&&(R=P),I[P++]=Ko(a.x,S)-Ko(C,S));const s=ei.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-i&&s.t<1+i&&(s.t<1+i&&s.t>1-i&&(V=A),w[A++]=Ko(s.x,S)-Ko(C,S))}if(P>2){P--;const e=I[2];I[2]=I[R],I[R]=e}if(A>2){A--;const e=w[2];w[2]=w[V],w[V]=e}if(2!==P||2!==A)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Number.isNaN(I[0])||Number.isNaN(I[1])||Number.isNaN(w[0])||Number.isNaN(w[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(I[0]>I[1]){const e=I[1];I[1]=I[0],I[0]=e}if(w[0]>w[1]){const e=w[1];w[1]=w[0],w[0]=e}return I[1]2,e.intersectWithLine=(n,r,o,a,i)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};i[2]=0;const l=[],c=o*o,u=[],d=[],p=[];t.points.getPoint(0,u),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],g=[];if(ou(u,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=ei.intersectWithLine(n,r,u,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,a[0]=t.x[0],a[1]=t.x[1],a[2]=t.x[2],!t.intersection)return i[0]=0,i[1]=0,s.intersect=0,s;const o=e.evaluatePosition(a,l,i,g);if(o.evaluation>=0)return o.dist2<=c?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=Zo(u,d),h=Zo(d,p),v=Zo(p,u);t.line||(t.line=Qc.newInstance()),m>h&&m>v?(t.line.getPoints().setPoint(0,u),t.line.getPoints().setPoint(1,d)):h>v&&h>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,u));const y=t.line.intersectWithLine(n,r,o,a,i);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=u[r]-p[r],t[r]=d[r]-p[r],n[r]=a[r]-p[r];return i[0]=Ko(n,e)/v,i[1]=Ko(n,t)/h,s.intersect=1,s}return i[0]=0,i[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const a={subId:0,dist2:0,evaluation:-1};let i,s;const l=[],c=[],u=[],d=[];let p;const f=[],g=[],m=[];let h=0,v=0;const y=[];let b,x,T,C=[];const S=[],P=[],A=[];a.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,c),t.points.getPoint(0,u),ru(l,c,u,d),ei.generalizedProjectPoint(e,l,d,A);let I=0;for(i=0;i<3;i++)p=d[i]<0?-d[i]:d[i],p>I&&(I=p,v=i);for(s=0,i=0;i<3;i++)i!==v&&(y[s++]=i);for(i=0;i<2;i++)f[i]=A[y[i]]-u[y[i]],g[i]=l[y[i]]-u[y[i]],m[i]=c[y[i]]-u[y[i]];if(h=ta(g,m),0===h)return r[0]=0,r[1]=0,a.evaluation=-1,a;if(r[0]=ta(f,m)/h,r[1]=ta(g,f)/h,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(a.dist2=Zo(A,e),n[0]=A[0],n[1]=A[1],n[2]=A[2]),a.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=Zo(e,u),x=Qc.distanceToLine(e,l,u,t,S),T=Qc.distanceToLine(e,u,c,t,P),b{const o=[],a=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,a),t.points.getPoint(2,i);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+a[t]*e[0]+i[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const su={};function lu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,su,n),Tc.extend(e,t,n),iu(e,t)}var cu={newInstance:jt.newInstance(lu,"vtkTriangle"),extend:lu,...au};const uu=["verts","lines","polys","strips"],{vtkWarningMacro:du}=jt,pu={[Mc]:Qc,[Rc]:Qc,[Vc]:cu};function fu(e,t){t.classHierarchy.push("vtkPolyData"),uu.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=We(t[n]):t[n]=dc.newInstance()})),e.getNumberOfCells=()=>uu.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),uu.forEach((n=>{t[n]=dc.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),a=e.getNumberOfStrips(),i=n+r+o+a,s=new Uint8Array(i);let l=s;const c=new Uint32Array(i);let u=c;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>1?Oc:wc,e+=t+1})),u=u.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>2?Rc:Mc,1===t&&du("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),u=u.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(u[n]=e,t){case 3:l[n]=Vc;break;case 4:l[n]=Lc;break;default:l[n]=Dc}t<3&&du("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),u+=u.subarray(o),l+=l.subarray(o)}if(a){let e=0;l.fill(Ec,0,a),t.strips.getCellSizes().forEach(((t,n)=>{u[n]=e,e+=t+1}))}t.cells=Wc.newInstance(),t.cells.setCellTypes(i,s,c)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=Ac.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case wc:case Oc:o=t.verts;break;case Mc:case Rc:o=t.lines;break;case Vc:case Lc:case Dc:o=t.polys;break;case Ec:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const a=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(a)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),a=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==a.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||pu[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const gu={};function mu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gu,n),nu.extend(e,t,n),jt.get(e,t,["cells","links"]),jt.setGet(e,t,["verts","lines","polys","strips"]),fu(e,t)}var hu={newInstance:jt.newInstance(mu,"vtkPolyData"),extend:mu};function vu(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const yu={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function bu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yu,n),jt.obj(e,t),jt.algo(e,t,6,0),jt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),jt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),vu(e,t)}const xu={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],a=e.length/(t*n);let i=t,s=n,l=e;const c=[l];for(let e=0;ea&&(u+=t),d<-a&&(u-=t),r[u]?c+=r[u]*o[l]:s-=o[l],i+=1}l[e+n]=c/s}r=[...l];for(let e=0;e{t.renderable!==n&&(t.renderable=n,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),e.modified())},e.createPolyDataForOneLabel=(e,n,r,o,a,i,s)=>{const l=t.renderable.get_tmAtlas().get(e);if(!l)return;const c=t.renderable.getTextPolyData().getPoints().getData(),u=t.lastSize;wu[0]=c[3*n],wu[1]=c[3*n+1],wu[2]=c[3*n+2],Dn(Mu,wu,r),Mu[0]+=.1,Dn(Ou,Mu,o),wn(Vu,Ou,wu),Mu[0]-=.1,Mu[1]+=.1,Dn(Ou,Mu,o),wn(Eu,Ou,wu);for(let e=0;e<3;e++)Vu[e]/=.05*u[0],Eu[e]/=.05*u[1];let d=s.ptIdx,p=s.cellIdx;wu[0]=c[3*n],wu[1]=c[3*n+1],wu[2]=c[3*n+2],a[0]<-.5?On(Mu,Vu,a[0]*i-l.width):a[0]>.5?On(Mu,Vu,a[0]*i):On(Mu,Vu,a[0]*i-l.width/2),In(wu,wu,Mu),On(Mu,Eu,a[1]*i-l.height/2),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,On(Mu,Vu,l.width),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,On(Mu,Eu,l.height),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,On(Mu,Vu,l.width),wn(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{const n=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);m(n,n);const r=t.renderable.getTextValues().length,o=4*r,a=2*r,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o);h(Du,n);const c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l};let u=0,d=0,p=0;const f=t.renderable.getTextPolyData().getPoints().getData(),g=t.renderable.getTextValues();for(;u{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0),t.camera=r,e.updateTexturePolyData()}}const Nu=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),t.tmPolyData=hu.newInstance(),t.tmMapper=oc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=hs.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),jt.setGet(e,t,["renderable"]),jt.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},jt.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],Bu(e,t)}),"vtkCubeAxesActorHelper");function ku(e,t){t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=n=>{t.camera!==n&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=n,n&&(t.cameraModifiedSub=n.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{const e=t.camera.getViewMatrix();m(e,e);let n=!1;const r=Fi.getDiagonalLength(t.dataBounds),o=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let a=0;a<6;a++){let i=!1;const s=Math.floor(a/2),l=(s+1)%3,c=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*c]!==t.dataBounds[2*c+1]&&(wu[s]=t.dataBounds[a]-.1*r*Cu[a][s],wu[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),wu[c]=.5*(t.dataBounds[2*c]+t.dataBounds[2*c+1]),Dn(Mu,wu,e),wu[s]=t.dataBounds[a],Dn(Ru,wu,e),wn(Mu,Ru,Mu),Rn(Mu,Mu),i=Mu[2]>o,t.camera.getParallelProjection()||(Rn(Ru,Ru),i=Vn(Ru,Mu)>o)),i!==t.lastFacesToDraw[a]&&(t.lastFacesToDraw[a]=i,n=!0)}return n},e.updatePolyData=(e,n,r)=>{let o=0,a=0;o+=8;let i=0;for(let e=0;e<12;e++)n[e]>0&&i++;if(a+=i,t.gridLines)for(let t=0;t<6;t++)e[t]&&(o+=2*r[Iu[t][0]].length+2*r[Iu[t][1]].length,a+=r[Iu[t][0]].length+r[Iu[t][1]].length);const s=new Float64Array(3*o),l=new Uint32Array(3*a);let c=0,u=0;for(let e=0;e<2;e++)for(let n=0;n<2;n++)for(let r=0;r<2;r++)s[3*c]=t.dataBounds[r],s[3*c+1]=t.dataBounds[2+n],s[3*c+2]=t.dataBounds[4+e],c++;for(let e=0;e<12;e++)n[e]>0&&(l[3*u]=2,l[3*u+1]=Pu[e][0],l[3*u+2]=Pu[e][1],u++);if(t.gridLines)for(let n=0;n<6;n++)if(e[n]){const e=Math.floor(n/2);let o=r[Iu[n][0]];for(let r=0;r{let a=0;for(let e=0;e<12;e++)1===n[e]&&(a+=2,a+=r[Au[e]].length);const i=t.polyData.getPoints().getData(),s=new Float64Array(3*a);let l=0,c=0,u=0;for(let a=0;a<6;a++)if(e[a])for(let e=0;e<4;e++){const d=Su[a][e];if(1===n[d]){const e=Au[d],n=3*Pu[d][0],p=3*Pu[d][1];s[3*l]=.5*(i[n]+i[p]),s[3*l+1]=.5*(i[n+1]+i[p+1]),s[3*l+2]=.5*(i[n+2]+i[p+2]),l++,s[3*l+Math.floor(a/2)]=t.dataBounds[a],s[3*l+Iu[a][0]]=.5*(t.dataBounds[2*Iu[a][0]]+t.dataBounds[2*Iu[a][0]+1]),s[3*l+Iu[a][1]]=.5*(t.dataBounds[2*Iu[a][1]]+t.dataBounds[2*Iu[a][1]+1]),l++,t.textValues[c]=t.axisLabels[e],c++;const f=(e+1)%3,g=(e+2)%3,m=r[e],h=o[e];t.tickCounts[u]=m.length;for(let r=0;r{if(!t.camera)return;const n=e.computeFacesToDraw(),r=t.lastFacesToDraw;let o=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(o=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(n||o||t.forceUpdate){const n=new Array(12).fill(0);for(let e=0;e<6;e++)if(r[e])for(let t=0;t<4;t++)n[Su[e][t]]++;const a=[],i=[];for(let e=0;e<3;e++){const n=mo().domain([t.dataBounds[2*e],t.dataBounds[2*e+1]]);a[e]=n.ticks(5);const r=n.tickFormat(5);i[e]=a[e].map(r)}e.updatePolyData(r,n,a),e.updateTextData(r,n,a,i),(o||t.forceUpdate)&&e.updateTextureAtlas(i)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let n=0,r=1;for(let o=0;o<3;o++){if(!t._tmAtlas.has(t.axisLabels[o])){Lu(t.tmContext,t.axisTextStyle);const e=t.tmContext.measureText(t.axisLabels[o]),a={height:e.actualBoundingBoxAscent+2,startingHeight:r,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[o],a),r+=a.height,n{e.tcoords=[0,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight)/r,0,(r-e.startingHeight)/r]})),t.tmCanvas.width=n,t.tmCanvas.height=r,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,n,r),t._tmAtlas.forEach(((e,n)=>{Lu(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified((()=>{t.forceUpdate=!0,e.update()})),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.getBounds=()=>(e.update(),Fi.setBounds(t.bounds,t.gridActor.getBounds()),Fi.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor),t.bounds);const n=jt.chain(e.setProperty,t.gridActor.setProperty);e.setProperty=e=>n(e)[0]}function Fu(e){return{boundsScaleFactor:1.3,camera:null,dataBounds:[...Fi.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:12,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},...e}}function _u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fu(n)),hs.extend(e,t,n),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=Tu.newInstance(),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=oc.newInstance(),t.polyData=hu.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=hs.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=hu.newInstance(),jt.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset"]),jt.setGetArray(e,t,["dataBounds"],6),jt.setGetArray(e,t,["axisLabels"],3),jt.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),ku(e,t)}var Gu={newInstance:jt.newInstance(_u,"vtkCubeAxesActor"),extend:_u,newCubeAxesActorHelper:Nu};function Uu(e,t){t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const zu={};const Wu=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zu,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Gu.newCubeAxesActorHelper(),Uu(e,t)}),"vtkOpenGLCubeAxesActor");rn("vtkCubeAxesActor",Wu);const Hu={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var ju={ObjectType:Hu};const{ObjectType:Ku}=ju;function $u(e,t){function n(e){switch(e){case Ku.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case Ku.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case Ku.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,a=!0,i="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===a,e.generateBuffer=e=>{const a=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===a},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,a=!1,!0):(i="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>i}const qu={objectType:Ku.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function Xu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qu,n),jt.obj(e,t),jt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),$u(e,t)}var Yu={newInstance:jt.newInstance(Xu),extend:Xu,...ju};const{vtkErrorMacro:Zu}=jt;function Qu(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(Hu.ARRAY_BUFFER),e.createVBO=function(n,r,o,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=a.points.getData();let l=null,c=null,u=null;const d=a.colors?a.colors.getNumberOfComponents():0,p=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),a.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,c=a.tcoords.getData()),a.colors?(t.colorComponents=a.colors.getNumberOfComponents(),t.colorOffset=0,u=a.colors.getData(),t.colorBO||(t.colorBO=Yu.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,g=0,m=0,h=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let C=null,S=null;o===rs.POINTS||"verts"===r?(C=x.anythingToPoints,S=T.anythingToPoints):o===rs.WIREFRAME||"lines"===r?(C=x[`${r}ToWireframe`],S=T[`${r}ToWireframe`]):(C=x[`${r}ToSurface`],S=T[`${r}ToSurface`]);const P=n.getData(),A=P.length;let I=0;for(let e=0;e0&&(Math.abs(E)/V>1e6||Math.abs(Math.log10(V))>3||0===V&&E>1e6);if(D){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=a.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(i)if(i.points||i.cells){const e=new Int32Array(I+i.points.length);e.set(i.points),i.points=e;const t=new Int32Array(I+i.cells.length);t.set(i.cells),i.cells=t}else i.points=new Int32Array(I),i.cells=new Int32Array(I);let L=a.vertexOffset;f=function(e){if(i&&(i.points[L]=e,i.cells[L]=b+a.cellOffset),++L,g=3*e,t.coordShiftAndScaleEnabled?(O[M++]=(s[g++]-t.coordShift[0])*t.coordScale[0],O[M++]=(s[g++]-t.coordShift[1])*t.coordScale[1],O[M++]=(s[g++]-t.coordShift[2])*t.coordScale[2]):(O[M++]=s[g++],O[M++]=s[g++],O[M++]=s[g++]),null!==l&&(m=a.haveCellNormals?3*(b+a.cellOffset):3*e,O[M++]=l[m++],O[M++]=l[m++],O[M++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&Nn(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&Nn(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Bn(e,[0,0,0])&&Bn(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Mn(n,t);const r=new Float64Array(16);return k(r,Ui(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):Zu("Wrong type for coordScale, expected vec3 or null"):Zu("Wrong type for coordShift, expected vec3 or null")}}const Ju={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ed(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ju,n),Yu.extend(e,t,n),jt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),jt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),Qu(e,t)}var td={newInstance:jt.newInstance(ed),extend:ed};const{vtkErrorMacro:nd}=jt;function rd(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return nd(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const od={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ad(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,od,n),jt.obj(e,t),jt.setGet(e,t,["shaderType","source","error","handle","context"]),rd(e,t)}var id={newInstance:jt.newInstance(ad,"vtkShader"),extend:ad};const{vtkErrorMacro:sd}=jt;function ld(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(sd(`Links failed: ${t.error}`),0):(sd(t.error),0):(sd(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),sd(t.fragmentShader.getError()),0):(sd(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),sd(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return sd(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,a),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,a),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(a,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(a,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,a)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(i,r,o,a),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(sd("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return sd("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const cd={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function ud(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cd,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=id.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=id.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=id.newInstance(),t.geometryShader.setShaderType("Geometry"),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),ld(e,t)}var dd={newInstance:jt.newInstance(ud,"vtkShaderProgram"),extend:ud,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),a=!1===r?t:new RegExp(t,"g"),i=e.replace(a,o);return{replace:i!==o,result:i}}};function pd(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,a,i,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,a,i,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,a,i,s,l,c,u,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==Hu.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=a,f.stride=i,f.type=s,f.size=l,f.normalize=c,f.isMatrix=d,f.divisor=u,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),u>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,a,i,s,l,c,u,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const fd={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function gd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fd,n),t.buffers=[],jt.obj(e,t),jt.get(e,t,["supported"]),jt.setGet(e,t,["forceEmulation"]),pd(e,t)}var md={newInstance:jt.newInstance(gd,"vtkOpenGLVertexArrayObject"),extend:gd};const hd={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function vd(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,a)=>{if(t.CABO.getElementCount()){const i=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,c=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),i===l.LINES&&s?(e.updateShaders(n,r,a),l.drawArraysInstanced(i,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,a),l.drawArrays(i,0,t.CABO.getElementCount()),l.lineWidth(1));const u=(i===l.POINTS?1:0)||(i===l.LINES?2:3);return t.pointPicking&&l.depthMask(c),t.CABO.getElementCount()/u}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===rs.POINTS||n===hd.Points?t.context.POINTS:e===rs.WIREFRAME||n===hd.Lines||n===hd.TrisEdges||n===hd.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(a,n,r);const i=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==e.getProgram()&&(e.setProgram(i),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===hd.Points||r.getProperty().getRepresentation()===rs.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let a=n.Vertex;a=dd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(a=dd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=a},e.getPointPickingPrimitiveSize=()=>t.primitiveType===hd.Points?2:t.primitiveType===hd.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const yd={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function bd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yd,n),jt.obj(e,t),t.shaderSourceTime={},jt.obj(t.shaderSourceTime),t.attributeUpdateTime={},jt.obj(t.attributeUpdateTime),jt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=dd.newInstance(),t.VAO=md.newInstance(),t.CABO=td.newInstance(),vd(e,t)}var xd={newInstance:jt.newInstance(bd),extend:bd,primTypes:hd};const Td={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Cd={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Sd={Wrap:Td,Filter:Cd};const Pd=new Float32Array(1),Ad=new Int32Array(Pd.buffer);var Id={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){Pd[0]=e;const t=Ad[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:wd,Filter:Od}=Sd,{VtkDataTypes:Md}=Es,{vtkDebugMacro:Rd,vtkErrorMacro:Vd,vtkWarningMacro:Ed}=Kt,{toHalf:Dd}=Id;function Ld(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let a=t.width*t.height*t.components;if(r&&(a*=t.depth),e!==Md.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==Md.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Uint8Array(t))}else o.push(null);let i=!1;if(t._openGLRenderWindow.getWebgl2())i=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");i=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(i)for(let e=0;e=o&&(c=o-1);const m=i-l,h=1-m;l=l*r*a,c=c*r*a;for(let t=0;t=r&&(p=r-1);const v=i-s;s*=a,p*=a;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||a);t.useHalfFloat=s}(a,c.offset,c.scale,r),t.useHalfFloat||e.getOpenGLDataType(a,!0),{numComps:o,dataType:a,data:i,scaleOffsets:c}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(Od.LINEAR),e.setMagnificationFilter(Od.LINEAR)):(e.setMinificationFilter(Od.NEAREST),e.setMagnificationFilter(Od.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(wd.REPEAT),e.setWrapS(wd.REPEAT),e.setWrapT(wd.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,Md.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,Md.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),a=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:Ed("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||Rd(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(Rd("Unsupported internal texture type!"),Rd(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case Md.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&Md.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&Md.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&Md.SHORT:case t.useHalfFloat&&Md.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case Md.FLOAT:case Md.VOID:default:return t.context.FLOAT}switch(e){case Md.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Md.FLOAT:case Md.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case Od.NEAREST:return t.context.NEAREST;case Od.LINEAR:return t.context.LINEAR;case Od.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case Od.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case Od.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case Od.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case wd.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case wd.REPEAT:return t.context.REPEAT;case wd.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(a,i,s,l,c){let u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[c],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),u&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(a,i,s,l,c)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=c.length/6-1,e.createTexture(),e.bind();const u=r(n(l,c)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&a>=1;){let i=null;n<=t.maxLevel&&(i=d[6*n+e]),o(l)?null!=i&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,a,t.format,t.openGLDataType,i):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,a,0,t.format,t.openGLDataType,i),n++,r/=2,a/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,a,i)=>(e.getOpenGLDataType(a),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?a===Md.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=i&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(a,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(Vd("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(Md.UNSIGNED_CHAR),e.getInternalFormat(Md.UNSIGNED_CHAR,4),e.getFormat(Md.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||_o(n.width)&&_o(n.height)),a=document.createElement("canvas");a.width=r?Fo(n.width):n.width,a.height=r?Fo(n.height):n.height,t.width=a.width,t.height=a.height;const i=a.getContext("2d");i.translate(0,a.height),i.scale(1,-1),i.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);const s=a;return o(Md.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(Md.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,a){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Es.newInstance({numberOfComponents:r,dataType:o,values:a}),i)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:i,dataType:s,data:l}=a(r,o);e.create2DFromRaw(t,n,i,s,l)},e.create3DFromRaw=(a,i,s,l,c,u)=>{if(e.getOpenGLDataType(c),e.getInternalFormat(c,l),e.getFormat(c,l),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=a,t.height=i,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(c,[u],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(c)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(c,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,a,i){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Es.newInstance({numberOfComponents:o,dataType:a,values:i}),s)},e.create3DFilterableFromDataArray=function(n,r,i,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:c,dataType:u,data:d,scaleOffsets:p}=a(s,l),f=n*r*i,g=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=Md.UNSIGNED_CHAR;if(u===Md.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=Md.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,c),e.getFormat(y,c),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===Md.FLOAT||c>=3)&&(b=4096);let x=1,T=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),T=x);let C=Math.sqrt(f)/x;C=Fo(C);const S=Math.floor(C*x/n),P=Math.ceil(i/S),A=Fo(r*P/T);let I;t.width=C,t.height=A,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=P,t.volumeInfo.xstride=x,t.volumeInfo.ystride=T,t.volumeInfo.offset=h.offset,t.volumeInfo.scale=h.scale;const w=C*A*c;I=y===Md.FLOAT?new Float32Array(w):new Uint8Array(w);let O=0;const M=Math.floor(n/x),R=Math.floor(r/T);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const Bd={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:wd.CLAMP_TO_EDGE,wrapT:wd.CLAMP_TO_EDGE,wrapR:wd.CLAMP_TO_EDGE,minificationFilter:Od.NEAREST,magnificationFilter:Od.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function Nd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bd,n),Zt.extend(e,t,n),t.sendParametersTime={},yt(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},yt(t.textureBuildTime,{mtime:0}),St(e,t,["format","openGLDataType"]),Pt(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),xt(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ot(0,t,["openGLRenderWindow"]),Ld(e,t)}const kd=Et(Nd,"vtkOpenGLTexture");var Fd={newInstance:kd,extend:Nd,...Sd};rn("vtkTexture",kd);var _d="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Gd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",Ud=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const a=e.getCoincidentParameters(r,o);if(a&&(0!==a.factor||0!==a.offset)){let e=n.Fragment;e=dd.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==a.factor?(e=dd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==a.factor?(e=dd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},zd=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const a=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,a,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,a)},e.getReplacedShaderTemplate=(n,r,o)=>{const a=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let i=n.Vertex;if(a){const e=a.VertexShaderCode;void 0!==e&&""!==e&&(i=e)}n.Vertex=i;let s=n.Fragment;if(a){const e=a.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(a){const e=a.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};const{FieldAssociations:Wd}=al,{primTypes:Hd}=xd,{Representation:jd,Shading:Kd}=ds,{ScalarMode:$d}=oc,{Filter:qd,Wrap:Xd}=Fd,{vtkErrorMacro:Yd}=Kt,Zd={type:"StartEvent"},Qd={type:"EndEvent"},{CoordinateSystem:Jd}=Zi;function ep(e,t){function n(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Hd.Start;e{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;const s=t.lastBoundBO.getReferenceByName("lastLightComplexity");let l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let c=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(c=c.concat([" vec3 specularColor;"," float specularPower;"])),c=c.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(c=c.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),o=dd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=dd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=dd.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=dd.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?t.renderable.getInterpolateScalarsBeforeMapping()&&t.renderable.getColorCoordinates()&&!t.drawingEdges?i=dd.substitute(i,"//VTK::Color::Impl",c.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(r.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),i=dd.substitute(i,"//VTK::Color::Impl",c).result):i=dd.substitute(i,"//VTK::Color::Impl",c.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,i=dd.substitute(i,"//VTK::Color::Dec",l).result,e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderLight=(e,n,r)=>{let o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),i=t.lastBoundBO.getReferenceByName("lastLightCount");let s=[];switch(a){case 0:o=dd.substitute(o,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:o=dd.substitute(o,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5,\n dot(reflect(lightDirectionVC${e},\n normalVCVSOutput),\n normalize(-vertexVC.xyz))),\n specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),o=dd.substitute(o,"//VTK::Light::Impl",s,!1).result;break;default:Yd("bad light complexity")}e.Fragment=o},e.replaceShaderNormal=(e,n,r)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex,o=e.Geometry,a=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(n=dd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=dd.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=dd.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,a=dd.substitute(a,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(a=dd.substitute(a,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(r.getProperty().getRepresentation())===t.context.LINES?(a=dd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(a=dd.substitute(a,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,a=dd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=n,e.Geometry=o,e.Fragment=a}},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r);let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=dd.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=dd.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,o=dd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=dd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=dd.substitute(o,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;n=dd.substitute(n,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const a=t.openGLActor.getActiveTextures();let i=2,s=2;if(a&&a.length>0&&(i=a[0].getComponents(),a[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(i=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(n=dd.substitute(n,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=dd.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,a&&a.length>=1)switch(i){case 1:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(n=dd.substitute(n,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=dd.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,i){case 1:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes();o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,o=dd.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,a=dd.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getCoincidentParameters=(e,n)=>{let r={factor:0,offset:0};const o=n.getProperty();if(t.renderable.getResolveCoincidentTopology()||o.getEdgeVisibility()&&o.getRepresentation()===jd.SURFACE){const e=t.lastBoundBO.getPrimitiveType();e===Hd.Points||o.getRepresentation()===jd.POINTS?r=t.renderable.getCoincidentTopologyPointOffsetParameter():e===Hd.Lines||o.getRepresentation()===jd.WIREFRAME?r=t.renderable.getCoincidentTopologyLineOffsetParameters():e!==Hd.Tris&&e!==Hd.TriStrips||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),e!==Hd.TrisEdges&&e!==Hd.TriStripsEdges||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),r.factor/=2,r.offset/=2)}const a=t._openGLRenderer.getSelector();return a&&a.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(r.offset-=2),r},e.replaceShaderPicking=(e,n,r)=>{let o=e.Fragment,a=e.Vertex;if(o=dd.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch(t.lastSelectionState!==Hl.ID_LOW24&&t.lastSelectionState!==Hl.ID_HIGH24||(a=dd.substitute(a,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,a=dd.substitute(a,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,o=dd.substitute(o,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,o=dd.substitute(o,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case Hl.ID_LOW24:o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case Hl.ID_HIGH24:o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=dd.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=o,e.Vertex=a}},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderColor(n,r,o),e.replaceShaderNormal(n,r,o),e.replaceShaderLight(n,r,o),e.replaceShaderTCoord(n,r,o),e.replaceShaderPicking(n,r,o),e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=dd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=dd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}},e.getNeedToRebuildShaders=(e,n,r)=>{let o=0,a=0;const i=e.getPrimitiveType(),s=t.currentInput;let l=!1;const c=s.getPointData().getNormals(),u=s.getCellData().getNormals(),d=r.getProperty().getInterpolation()===Kd.FLAT,p=r.getProperty().getRepresentation(),f=e.getOpenGLMode(p,i);if(f===t.context.TRIANGLES||u&&!c||!d&&c?l=!0:d||f!==t.context.LINES||(l=!0),r.getProperty().getLighting()&&l){o=0;const e=n.getLightsByReference();for(let t=0;t0&&(a++,0===o&&(o=1)),1===o&&(a>1||1!==n.getIntensity()||!n.lightTypeIsHeadLight())&&(o=2),o<3&&n.getPositional()&&(o=3)}}let g=!1;const m=t.lastBoundBO.getReferenceByName("lastLightComplexity"),h=t.lastBoundBO.getReferenceByName("lastLightCount");return m===o&&h===a||(t.lastBoundBO.set({lastLightComplexity:o},!0),t.lastBoundBO.set({lastLightCount:a},!0),g=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(g=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(n,r,o)=>{if(n.getProgram().isUniformUsed("PrimitiveIDOffset")&&n.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),n.getProgram().isUniformUsed("VertexIDOffset")&&n.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){const e=t.lastBoundBO.getReferenceByName("lastLightComplexity");n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||Yd("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("normalMC")&&n.getCABO().getNormalOffset()&&e>0?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"normalMC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||Yd("Error setting normalMC in shader VAO."):n.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach(((e,r)=>{n.getProgram().isAttributeUsed(`${e}MC`)&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),`${e}MC`,n.getCABO().getCustomData()[r].offset,n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getCustomData()[r].components,!1)||Yd(`Error setting ${e}MC in shader VAO.`))})),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),!1)||Yd("Error setting tcoordMC in shader VAO."):n.getVAO().removeAttributeArray("tcoordMC"),n.getProgram().isAttributeUsed("scalarColor")&&n.getCABO().getColorComponents()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO().getColorBO(),"scalarColor",n.getCABO().getColorOffset(),n.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||Yd("Error setting scalarColor in shader VAO."):n.getVAO().removeAttributeArray("scalarColor"),n.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes(),r=[],a=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=a?d(t.tmpMat4,o.getMatrix()):o.getMatrix();a&&(m(i,i),b(i,i,a),m(i,i));for(let n=0;n{const o=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const a=e.getProgram();let i=0;const s=n.getLightsByReference();for(let e=0;e0){const e=r.getColorByReference(),o=r.getIntensity();t.lightColor[0]=e[0]*o,t.lightColor[1]=e[1]*o,t.lightColor[2]=e[2]*o;const s=r.getDirection(),l=n.getActiveCamera().getViewMatrix(),c=[...s];r.lightTypeIsSceneLight()&&(c[0]=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],c[1]=l[4]*s[0]+l[5]*s[1]+l[6]*s[2],c[2]=l[8]*s[0]+l[9]*s[1]+l[10]*s[2],Xo(c)),t.lightDirection[0]=c[0],t.lightDirection[1]=c[1],t.lightDirection[2]=c[2],Xo(t.lightDirection),a.setUniform3fArray(`lightColor${i}`,t.lightColor),a.setUniform3fArray(`lightDirectionVC${i}`,t.lightDirection),i++}}if(o<3)return;const l=n.getActiveCamera().getViewMatrix();m(l,l),i=0;for(let e=0;e0){const e=t.getTransformedPosition(),n=new Float64Array(3);Dn(n,e,l),a.setUniform3fArray(`lightAttenuation${i}`,t.getAttenuationValuesByReference()),a.setUniformi(`lightPositional${i}`,t.getPositional()),a.setUniformf(`lightExponent${i}`,t.getExponent()),a.setUniformf(`lightConeAngle${i}`,t.getConeAngle()),a.setUniform3fArray(`lightPositionVC${i}`,[n[0],n[1],n[2]]),i++}}},e.setCameraShaderParameters=(e,a,i)=>{const s=e.getProgram(),l=t.openGLCamera.getKeyMatrices(a),c=a.getActiveCamera(),u=t.openGLCamera.getKeyMatrixTime().getMTime(),d=s.getLastCameraMTime(),p=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,f=i.getIsIdentity(),m=f?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(i.getCoordinateSystem()===Jd.DISPLAY){const e=t._openGLRenderer.getTiledSizeAndOrigin();g(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b(t.tmpMat4,t.tmpMat4,p),s.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else s.setUniformMatrix("MCPCMatrix",n([l.wcpc,m.mcwc,p],r,t.tmpMat4));s.isUniformUsed("MCVCMatrix")&&s.setUniformMatrix("MCVCMatrix",n([l.wcvc,m.mcwc,p],r,t.tmpMat4)),s.isUniformUsed("normalMatrix")&&s.setUniformMatrix3x3("normalMatrix",n([l.normalMatrix,m.normalMatrix],o,t.tmpMat3)),d!==u&&(s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",c.getParallelProjection()),s.setLastCameraMTime(u)),f||s.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram();let a=r.getProperty(),i=a.getOpacity(),s=t.drawingEdges?a.getEdgeColorByReference():a.getAmbientColorByReference(),l=t.drawingEdges?a.getEdgeColorByReference():a.getDiffuseColorByReference(),c=t.drawingEdges?1:a.getAmbient(),u=t.drawingEdges?0:a.getDiffuse(),d=t.drawingEdges?0:a.getSpecular();const p=a.getSpecularPower();o.setUniformf("opacityUniform",i),o.setUniform3fArray("ambientColorUniform",s),o.setUniform3fArray("diffuseColorUniform",l),o.setUniformf("ambient",c),o.setUniformf("diffuse",u);const f=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(f<1)return;let g=a.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",g),o.setUniformf("specularPowerUniform",p),o.setUniformf("specular",d),o.isUniformUsed("ambientIntensityBF")){if(a=r.getBackfaceProperty(),i=a.getOpacity(),s=a.getAmbientColor(),c=a.getAmbient(),l=a.getDiffuseColor(),u=a.getDiffuse(),g=a.getSpecularColor(),d=a.getSpecular(),o.setUniformf("ambientIntensityBF",c),o.setUniformf("diffuseIntensityBF",u),o.setUniformf("opacityUniformBF",i),o.setUniform3fArray("ambientColorUniformBF",s),o.setUniform3fArray("diffuseColorUniformBF",l),f<1)return;o.setUniformf("specularIntensityBF",d),o.setUniform3fArray("specularColorUniformBF",g),o.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,n)=>{const r=t._openGLRenderer.getSelector();if(r){if(t.selectionWebGLIdsToVTKIds?.points?.length){const e=t.selectionWebGLIdsToVTKIds.points.length;r.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){const e=t.selectionWebGLIdsToVTKIds.cells.length;r.setMaximumCellId(e-1)}r.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;const o=function(e){const t=e.getSelector();return t?t.getCurrentPass():Hl.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==o&&(t.selectionStateChanged.modified(),t.lastSelectionState=o),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(r),e.updateBufferObjects(n,r),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=r.getProperty().getEdgeVisibility()&&o===jd.SURFACE,i=t._openGLRenderer.getSelector(),s=i&&i.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===Hl.ID_LOW24||t.lastSelectionState===Hl.ID_HIGH24);for(let i=Hd.Start;i=0)||(t.lastBoundBO=t.primitives[i],t.primitiveIDOffset+=t.primitives[i].drawArrays(n,r,o,e),t.vertexIDOffset+=t.primitives[i].getCABO().getElementCount()))},e.renderPieceFinish=(e,n)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(n,r)=>{if(e.invokeEvent(Zd),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(Qd),!t.currentInput)return void Yd("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context,a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const o=t.currentInput;if(null===o)return;t.renderable.mapScalars(o,1);const a=t.renderable.getColorMapColors();t.haveCellScalars=!1;const i=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(i!==$d.USE_CELL_DATA&&i!==$d.USE_CELL_FIELD_DATA&&i!==$d.USE_FIELD_DATA&&o.getPointData().getScalars()||i===$d.USE_POINT_FIELD_DATA||!a||(t.haveCellScalars=!0));let s=r.getProperty().getInterpolation()!==Kd.FLAT?o.getPointData().getNormals():null;null===s&&o.getCellData().getNormals()&&(t.haveCellNormals=!0,s=o.getCellData().getNormals());const l=r.getProperty().getRepresentation();let c=o.getPointData().getTCoords();if(t.openGLActor.getActiveTextures()||(c=null),t.renderable.getColorCoordinates()){c=t.renderable.getColorCoordinates(),t.internalColorTexture||(t.internalColorTexture=Fd.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(qd.NEAREST),e.setMagnificationFilter(qd.NEAREST),e.setWrapS(Xd.CLAMP_TO_EDGE),e.setWrapT(Xd.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t.renderable.getColorTextureMap(),r=n.getExtent(),o=n.getPointData().getScalars();e.create2DFromRaw(r[1]-r[0]+1,r[3]-r[2]+1,o.getNumberOfComponents(),o.getDataType(),o.getData()),e.activate(),e.sendParameters(),e.deactivate()}const u=`${o.getMTime()}A${l}B${o.getMTime()}C${s?s.getMTime():1}D${a?a.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${c?c.getMTime():1}`;if(t.VBOBuildString!==u){const n={points:o.getPoints(),normals:s,tcoords:c,colors:a,cellOffset:0,vertexOffset:0,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:t.renderable.getCustomShaderAttributes().map((e=>o.getPointData().getArrayByName(e)))};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});const i=[{inRep:"verts",cells:o.getVerts()},{inRep:"lines",cells:o.getLines()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()}],d=r.getProperty().getEdgeVisibility()&&l===jd.SURFACE;for(let e=Hd.Start;e{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const tp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:Hl.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function np(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tp,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.primitives=[],t.primTypes=Hd,t.tmpMat3=pe(new Float64Array(9)),t.tmpMat4=g(new Float64Array(16));for(let e=Hd.Start;e{t.lookupTable=Ll.newInstance()},e.getColorModeAsString=()=>jt.enumToString(ap,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(ip,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===ip.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===ip.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===ip.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===ip.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ip.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ip.USE_FIELD_DATA){const t=e.getFieldData();i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString===a)return;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]);const i=e.getLookupTable();i&&(i.build(),t.colorMapColors=i.mapScalars(o,t.colorMode,t.fieldDataTupleId)),t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}}}const cp={static:!1,lookupTable:null,scalarVisibility:!1,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,transformCoordinate:null,viewSpecificProperties:null,customShaderAttributes:[]};function up(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cp,n),Bs(e,t,n),jt.get(e,t,["colorMapColors"]),jt.setGet(e,t,["arrayAccessMode","colorByArrayName","colorMode","lookupTable","renderTime","scalarMode","scalarVisibility","static","transformCoordinate","useLookupTableScalarRange","viewSpecificProperties","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),t.viewSpecificProperties||(t.viewSpecificProperties={}),lp(e,t)}var dp={newInstance:jt.newInstance(up,"vtkMapper2D"),extend:up};const pp={BACKGROUND:0,FOREGROUND:1};var fp={DisplayLocation:pp};const{primTypes:gp}=xd,{ScalarMode:mp}=dp,{vtkErrorMacro:hp}=Kt,vp={type:"StartEvent"},yp={type:"EndEvent"};function bp(e,t){t.classHierarchy.push("vtkOpenGLPolyDataMapper2D"),e.buildPass=n=>{n&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=gp.Start;e{e.invokeEvent(vp),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(yp),t.currentInput?t.currentInput.getPoints&&t.currentInput.getPoints().getNumberOfValues()&&(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):hp("No input!")},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(r)),e.updateBufferObjects(n,r),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,n,r)=>e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return!!(o{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,n.getProperty().getOpacity());const o=t.renderable.getColorMapColors();t.haveCellScalars=!1;const a=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(a!==mp.USE_CELL_DATA&&a!==mp.USE_CELL_FIELD_DATA&&a!==mp.USE_FIELD_DATA&&r.getPointData().getScalars()||a===mp.USE_POINT_FIELD_DATA||!o||(t.haveCellScalars=!0));const i=n.getProperty().getRepresentation();let s=r.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(s=null);const l=t.renderable.getTransformCoordinate(),c=e.getRenderWindow().getViews()[0].getViewportSize(e),u=`${r.getMTime()}A${i}B${r.getMTime()}C${o?o.getMTime():1}D${s?s.getMTime():1}E${l?e.getMTime():1}F${c}`;if(t.VBOBuildString!==u){let n=r.getPoints();if(l){const t=vc.newInstance(),r=n.getNumberOfPoints();t.setNumberOfPoints(r);const o=[];for(let a=0;ar.getPointData().getArrayByName(e)))};a.cellOffset+=t.primitives[gp.Points].getCABO().createVBO(r.getVerts(),"verts",i,a),a.cellOffset+=t.primitives[gp.Lines].getCABO().createVBO(r.getLines(),"lines",i,a),a.cellOffset+=t.primitives[gp.Tris].getCABO().createVBO(r.getPolys(),"polys",i,a),a.cellOffset+=t.primitives[gp.TriStrips].getCABO().createVBO(r.getStrips(),"strips",i,a),t.VBOBuildTime.modified(),t.VBOBuildString=u}},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation();t.context.depthMask(!0);for(let a=gp.Start;a{t.lastBoundBO&&t.lastBoundBO.getVAO().release()},e.replaceShaderValues=(t,n,r)=>{e.replaceShaderColor(t,n,r),e.replaceShaderTCoord(t,n,r),e.replaceShaderPicking(t,n,r),e.replaceShaderPositionVC(t,n,r)},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.haveCellScalars&&(i=dd.substitute(i,"//VTK::Color::Dec",["uniform samplerBuffer texture1;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = texelFetchBuffer(texture1, gl_PrimitiveID + PrimitiveIDOffset);"]).result),0!==t.lastBoundBO.getCABO().getColorComponents()?(o=dd.substitute(o,"//VTK::Color::Dec",["in vec4 diffuseColor;","out vec4 fcolorVSOutput;"]).result,o=dd.substitute(o,"//VTK::Color::Impl",["fcolorVSOutput = diffuseColor;"]).result,a=dd.substitute(a,"//VTK::Color::Dec",["in vec4 fcolorVSOutput[];\n","out vec4 fcolorGSOutput;"]).result,a=dd.substitute(a,"//VTK::Color::Impl",["fcolorGSOutput = fcolorVSOutput[i];"]).result,i=dd.substitute(i,"//VTK::Color::Dec",["in vec4 fcolorVSOutput;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = fcolorVSOutput;"]).result):(i=dd.substitute(i,"//VTK::Color::Dec",["uniform vec4 diffuseColor;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = diffuseColor;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getCABO().getTCoordComponents();1===a?(n=dd.substitute(n,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,r=dd.substitute(r,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=dd.substitute(o,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===a&&(n=dd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=dd.substitute(o,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.haveCellScalars&&(r=dd.substitute(r,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderPicking=(e,t,n)=>{let r=e.Fragment;r=dd.substitute(r,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,r=dd.substitute(r,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=r},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r)},e.invokeShaderCallbacks=(e,n,r)=>{const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(e,n,r)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)||hp("Error setting vertexWC in shader VAO.")),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach(((n,r)=>{e.getProgram().isAttributeUsed(`${n}MC`)&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${n}MC`,e.getCABO().getCustomData()[r].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[r].components,!1)||hp(`Error setting ${n}MC in shader VAO.`))})),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||hp("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());const o=t.openGLActor2D.getActiveTextures();if(o)for(let t=0;t{const o=t.renderable.getColorMapColors();if(!o||0===o.getNumberOfComponents()){const t=e.getProgram(),n=r.getProperty(),o=n.getOpacity(),a=n.getColor(),i=[a[0],a[1],a[2],o];t.setUniform4f("diffuseColor",i)}},e.setLightingShaderParameters=(e,t,n)=>{},e.setCameraShaderParameters=(e,n,o)=>{const a=e.getProgram(),i=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=n.getRenderWindow().getViews()[0].getViewportSize(n),l=n.getViewport(),c=o.getActualPositionCoordinate().getComputedDoubleViewportValue(n),u=[0,0,1,1],d=[0,0,1,1];if(d[0]=l[0]>=u[0]?l[0]:u[0],d[1]=l[1]>=u[1]?l[1]:u[1],d[2]=l[2]<=u[2]?l[2]:u[2],d[3]=l[3]<=u[3]?l[3]:u[3],d[0]>=d[2])return;if(d[1]>=d[3])return;s[0]=Vo(s[0]*(d[2]-d[0])/(l[2]-l[0])),s[1]=Vo(s[1]*(d[3]-d[1])/(l[3]-l[1]));const p=t._openGLRenderer.getParent().getSize(),f=Vo(c[0]-(d[0]-l[0])*p[0]),h=Vo(c[1]-(d[1]-l[1])*p[1]),v=-f;let y=-f+s[0];const b=-h;let x=-h+s[1];v===y&&(y=v+1),b===x&&(x=b+1);const T=g(new Float64Array(16));var C,S,P;T[0]=2/(y-v),T[5]=2/(x-b),T[3]=-1*(y+v)/(y-v),T[7]=-1*(x+b)/(x-b),T[10]=0,T[11]=o.getProperty().getDisplayLocation()===pp.FOREGROUND?-1:1,T[15]=1,m(T,T),a.setUniformMatrix("WCVCMatrix",(C=[T,i],S=r,P=t.tmpMat4,S.identity(P),C.reduce(((e,t,n)=>0===n?t?S.copy(e,t):S.identity(e):t?S.multiply(e,e,t):e),P)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const xp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null};const Tp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.primitives=[],t.primTypes=gp,t.tmpMat4=g(new Float64Array(16));for(let e=gp.Start;e{const n=e.getLastSize(),r=(n[0]/700)**.8,o=(n[1]/700)**.8,a=Math.min(r,o),i=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(i,t.axisTextStyle),Object.assign(s,t.tickTextStyle),i.fontSize=Math.max(24*a,12),e.getLastAspectRatio()>1?s.fontSize=Math.max(20*a,10):s.fontSize=Math.max(16*a,10);const l=e.updateTextureAtlas();e.setTopTitle(!1);const c=e.getBoxSizeByReference();if(e.getLastAspectRatio()>1)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.98-c[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.99-c[0],-.92])),c[1]=Math.max(1.2,Math.min(1.84/o,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);const t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/n[1],r=2*l.tickWidth/n[0];c[0]=Math.min(1.9,Math.max(1.4,1.4*r*(e.getTicks().length+3))),c[1]=t,e.setBoxPosition([-.5*c[0],-.97])}e.recomputeBarSegments(l)}}function Ap(e,t){return e=>{const t=e.getLastTickBounds(),n=mo().domain([t[0],t[1]]),r=n.ticks(5),o=n.tickFormat(5);e.setTicks(r),e.setTickStrings(r.map(o))}}function Ip(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=n=>{t.renderable!==n&&(t.renderable=n,t.barActor.setProperty(n.getProperty()),t.barActor.setParentProp(n),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=n.generateTicks,t.axisTextStyle={...n.getAxisTextStyle()},t.tickTextStyle={...n.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(n,r,o)=>{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0);const a=t.renderable.getScalarsToColors();if(a&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(a),t.camera=r,t.renderWindow=o,t.forceUpdate||Math.max(a.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){const n=a.getMappingRange();if(t.lastTickBounds=[...n],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();const n=e.updateTextureAtlas();e.recomputeBarSegments(n)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";const n={},r=new Map;let o=0,a=1;Sp(t.tmContext,t.axisTextStyle);let i=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:i.actualBoundingBoxAscent+2,startingHeight:a,width:i.width+2,textStyle:t.axisTextStyle};r.set(t.renderable.getAxisLabel(),s),a+=s.height,o=s.width,n.titleWidth=s.width,n.titleHeight=s.height,n.tickWidth=0,n.tickHeight=0,Sp(t.tmContext,t.tickTextStyle);const l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight)/a,0,(a-e.startingHeight)/a]})),t.tmCanvas.width=o,t.tmCanvas.height=a,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,o,a),r.forEach(((e,n)=>{Sp(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=r,n},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];const n=2*e.tickHeight/t.lastSize[1],r=[1,1];if(t.vertical){const o=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-o,t.barSize[1]=t.boxSize[1]-n}else{const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-n-o,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+o,t.barPosition[1]=t.boxPosition[1],r[1]=n}else{const n=(2*e.tickWidth-8)/t.lastSize[0],o=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-o,t.barPosition[1]=t.boxPosition[1],r[0]=n}return r},e.recomputeBarSegments=n=>{const r=e.computeBarSize(n);t.barSegments=[];const o=[0,0],a=t.vertical?1:0,i=t.vertical?.01:.02;function s(e,n){t.barSegments.push({corners:[[...o],[o[0]+r[0],o[1]],[o[0]+r[0],o[1]+r[1]],[o[0],o[1]+r[1]]],scalars:n,title:e}),o[a]+=r[a]+i}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);const l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();o[a]+=i;const c=r[a];r[a]=l?1-2*i-r[a]-o[a]:1-i-o[a],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(r[a]=c,o[a]+=i,s("Above",[1.1,1.1,1.1,1.1]))};const n=new Float64Array(3);e.createPolyDataForOneLabel=(e,r,o,a,i,s)=>{const l=t._tmAtlas.get(e);if(!l)return;let c=s.ptIdx,u=s.cellIdx;n[0]=(.5*r[0]+.5)*t.lastSize[0],n[1]=(.5*r[1]+.5)*t.lastSize[1],n[2]=r[2],n[0]+=i[0],n[1]+=i[1];const d=[],p="vertical"===a?[1,0]:[0,1];"vertical"===a?(d[0]=l.width,d[1]=-l.height,"middle"===o[0]?n[1]-=l.width/2:"right"===o[0]&&(n[1]-=l.width),"middle"===o[1]?n[0]+=l.height/2:"top"===o[1]&&(n[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===o[0]?n[0]-=l.width/2:"right"===o[0]&&(n[0]-=l.width),"middle"===o[1]?n[1]-=l.height/2:"top"===o[1]&&(n[1]-=l.height)),s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[0],s.tcoords[2*c+1]=l.tcoords[1],c++,n[p[0]]+=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[2],s.tcoords[2*c+1]=l.tcoords[3],c++,n[p[1]]+=d[1],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[4],s.tcoords[2*c+1]=l.tcoords[5],c++,n[p[0]]-=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[6],s.tcoords[2*c+1]=l.tcoords[7],c++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-3,s.polys[4*u+3]=c-2,u++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-2,s.polys[4*u+3]=c-1,s.ptIdx+=4,s.cellIdx+=2};const r=new Float64Array(3);e.updatePolyDataForLabels=()=>{const n=e.getTickStrings().length+t.barSegments.length,o=4*n,a=2*n,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o),c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l},u=t.vertical?0:1,d=t.vertical?1:0;r[2]=-.99;const p=t.vertical?["right","middle"]:["middle","bottom"];let f=[0,1];const g=[0,0];t.vertical?(g[0]=-t.tickLabelPixelOffset,t.topTitle?(r[0]=t.boxPosition[0]+.5*t.boxSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)):(r[0]=t.barPosition[0]+t.barSize[0],r[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],c)),f=[-1,0]):(g[1]=t.tickLabelPixelOffset,r[0]=t.barPosition[0]+.5*t.barSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)),r[u]=t.barPosition[u]+(.5*f[u]+.5)*t.barSize[u],r[d]=t.barPosition[d]+.5*t.barSize[d];let m=null;for(let n=0;n{const e=t.renderable.getScalarsToColors();let n=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(n+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(n+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(n+=1);const o=4*(1+n),a=o;let i=1;e.getVectorMode()===Cp.COMPONENT&&(i=e.getVectorComponent()+1);const s=new Float64Array(3*o),l=new Uint16Array(5*a),c=new Float32Array(o*i);let u=0,d=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),jt.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings"]),jt.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),jt.getArray(e,t,["boxPosition","boxSize"]),jt.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=oc.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=hu.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=hs.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=hu.newInstance(),t.tmMapper=oc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=Tu.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=hs.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],Ip(e,t)}),"vtkScalarBarActorHelper");function Op(e,t){t.classHierarchy.push("vtkScalarBarActor"),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(Pp(0,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(Ap())}}function Mp(e){return{automated:!0,autoLayout:null,axisLabel:"Scalar Value",barPosition:[0,0],barSize:[0,0],boxPosition:[.88,-.92],boxSize:[.1,1.1],scalarToColors:null,axisTitlePixelOffset:36,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:14,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},generateTicks:null,drawNanAnnotation:!0,drawBelowRangeSwatch:!0,drawAboveRangeSwatch:!0,...e}}function Rp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mp(n)),t.autoLayout||(t.autoLayout=Pp(0,t)),t.generateTicks||(t.generateTicks=Ap()),hs.extend(e,t,n),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),jt.setGet(e,t,["automated","autoLayout","axisTitlePixelOffset","axisLabel","scalarsToColors","tickLabelPixelOffset","generateTicks","drawNanAnnotation","drawBelowRangeSwatch","drawAboveRangeSwatch"]),jt.get(e,t,["axisTextStyle","tickTextStyle"]),jt.getArray(e,t,["barPosition","barSize","boxPosition","boxSize"]),jt.setArray(e,t,["barPosition","barSize","boxPosition","boxSize"],2),Op(e,t)}var Vp={newInstance:jt.newInstance(Rp,"vtkScalarBarActor"),extend:Rp,newScalarBarActorHelper:wp};function Ep(e,t){t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Dp={};const Lp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dp,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Vp.newScalarBarActorHelper(),Ep(e,t)}),"vtkOpenGLScalarBarActor");rn("vtkScalarBarActor",Lp);const{vtkErrorMacro:Bp}=Kt;function Np(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=n=>{if(n){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera())}},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOpaqueActorCount()}},e.opaquePass=(n,r)=>{if(n&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);const n=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",n);const r=t._openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(r),a=new Float64Array(16);if(h(a,o.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",a),"box"===t.lastFormat){const e=r.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){const e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;const n=Es.newInstance({numberOfComponents:3,values:e});n.setName("points");const r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;const o=Es.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(o,"polys",rs.SURFACE,{points:n,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = texture2D(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Bp("Error setting vertexMC in shader VAO."));const e=t.renderable.getTextures();e.length||Bp("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}const kp={context:null};const Fp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kp,n),Zt.extend(e,t,n),t.openGLTexture=Fd.newInstance(),t.tris=xd.newInstance(),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),xt(e,t,["activeTextures"]),Np(e,t)}));rn("vtkSkybox",Fp);const{FieldAssociations:_p}=al;function Gp(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,a)=>{const i=await e.getSourceDataAsync(t,n,r,o,a);return i?i.generateSelection(n,r,o,a):[]}}const Up={fieldAssociation:_p.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function zp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Up,n),jt.obj(e,t),jt.setGet(e,t,["fieldAssociation","captureZValues"]),Gp(e,t)}var Wp={newInstance:jt.newInstance(zp,"vtkHardwareSelector"),extend:zp};function Hp(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):et("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void et("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void et("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else et("Attaching depth buffer textures to fbo requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else et("Attaching depth buffer textures to framebuffers requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=Fd.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Cd.LINEAR),r.setMagnificationFilter(Cd.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,ys.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}const jp={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Kp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jp,n),yt(e,t),t.colorBuffers&&et("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],At(e,t,["colorBuffers"]),Hp(e,t)}var $p={newInstance:Et(Kp,"vtkFramebuffer"),extend:Kp};function qp(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const Xp={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Yp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xp,n),jt.obj(e,t),t.properties={},jt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),qp(e,t)}var Zp={newInstance:jt.newInstance(Yp,"vtkSelectionNode"),extend:Yp,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Qp}=jl,{SelectionContent:Jp,SelectionField:ef}=Zp,{FieldAssociations:tf}=al,{vtkErrorMacro:nf}=jt;function rf(e){return`${e.propID} ${e.compositeID}`}function of(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function af(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),a=n[o],i=n[o+1];return 256*(256*n[o+2]+i)+a}function sf(e,t){let n=t;return n<<=24,n|=e,n}function lf(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=af(n[0],n[1],e.pixBuffer[Qp.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const a={valid:!0};a.propID=o-1,a.prop=e.props[a.propID];let i=af(n[0],n[1],e.pixBuffer[Qp.COMPOSITE_INDEX_PASS],e.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);a.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,a.displayPosition=t}if(e.pixBuffer[Qp.ID_LOW24]&&0===of(n[0],n[1],e.pixBuffer[Qp.ID_LOW24],e.area))return a;const s=af(n[0],n[1],e.pixBuffer[Qp.ID_LOW24],e.area),l=af(n[0],n[1],e.pixBuffer[Qp.ID_HIGH24],e.area);return a.attributeID=sf(s,l),a}const a=[t[0],t[1]],i=[0,0];let s=lf(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=lf(e,i,0,r),s&&s.valid))return s;if(i[0]=a[0]+t,s=lf(e,i,0,r),s&&s.valid)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=lf(e,i,0,r),s&&s.valid))return s;if(i[1]=a[1]+t,s=lf(e,i,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function cf(e,t,n,r,o){const a=[];let i=0;return t.forEach(((t,s)=>{const l=Zp.newInstance();switch(l.setContentType(Jp.INDICES),e){case tf.FIELD_ASSOCIATION_CELLS:l.setFieldType(ef.CELL);break;case tf.FIELD_ASSOCIATION_POINTS:l.setFieldType(ef.POINT);break;default:nf("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),a[i]=l,i++})),a}function uf(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=lf(e,[n,t],0,u);if(r&&r.valid){const t=rf(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=$p.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===tf.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,a,i)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,a,i);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return nf("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Qp.MIN_KNOWN_PASS;t.currentPass<=Qp.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Qp.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Qp.ID_HIGH24){if(t.fieldAssociation===tf.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===tf.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Qp.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let a=af(o,r,e,t.area);a>0&&(a--,a in t.hitProps||(t.hitProps[a]=!0,t.propPixels[a]=[]),t.propPixels[a].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Qp.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Qp.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>jt.enumToString(Qp,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const a=r<0?0:r;if(0===a){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=af(e[0],e[1],t.pixBuffer[Qp.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const a={valid:!0};a.propID=r-1,a.prop=t.props[a.propID];let i=af(e[0],e[1],t.pixBuffer[Qp.COMPOSITE_INDEX_PASS],t.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);a.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,a.displayPosition=n}if(t.pixBuffer[Qp.ID_LOW24]&&0===of(e[0],e[1],t.pixBuffer[Qp.ID_LOW24],t.area))return a;const s=af(e[0],e[1],t.pixBuffer[Qp.ID_LOW24],t.area),l=af(e[0],e[1],t.pixBuffer[Qp.ID_HIGH24],t.area);return a.attributeID=sf(s,l),a}const i=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(s[1]=n,i[0]>=t&&(s[0]=i[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=i[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(s[0]=n,i[1]>=t&&(s[1]=i[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=i[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,a)=>{const i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=Math.floor(a),u=new Map,d=[0,0];for(let n=s;n<=c;n++)for(let r=i;r<=l;r++){const o=[r,n],a=e.getPixelInformation(o,0,d);if(a&&a.valid){const e=rf(a);if(u.has(e)){const n=u.get(e);n.pixelCount++,t.captureZValues&&a.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const pf={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ff(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pf,n),Wp.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),jt.setGetArray(e,t,["area"],4),jt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),jt.setGetArray(e,t,["propColorValue"],3),jt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),jt.event(e,t,"event"),df(e,t)}var gf={newInstance:jt.newInstance(ff,"vtkOpenGLHardwareSelector"),extend:ff,...jl};const{vtkErrorMacro:mf}=Kt,{Representation:hf}=ds,{ObjectType:vf}=Yu,{PassTypes:yf}=gf,bf={type:"StartEvent"},xf={type:"EndEvent"};function Tf(e,t){t.classHierarchy.push("vtkOpenGLGlyph3DMapper");const n={...e};e.renderPiece=(n,r)=>{if(e.invokeEvent(bf),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(xf),!t.currentInput)return void mf("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context;t._openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);const a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.multiply4x4WithOffset=(e,t,n,r)=>{const o=t[0],a=t[1],i=t[2],s=t[3],l=t[4],c=t[5],u=t[6],d=t[7],p=t[8],f=t[9],g=t[10],m=t[11],h=t[12],v=t[13],y=t[14],b=t[15];let x=n[r],T=n[r+1],C=n[r+2],S=n[r+3];e[0]=x*o+T*l+C*p+S*h,e[1]=x*a+T*c+C*f+S*v,e[2]=x*i+T*u+C*g+S*y,e[3]=x*s+T*d+C*m+S*b,x=n[r+4],T=n[r+5],C=n[r+6],S=n[r+7],e[4]=x*o+T*l+C*p+S*h,e[5]=x*a+T*c+C*f+S*v,e[6]=x*i+T*u+C*g+S*y,e[7]=x*s+T*d+C*m+S*b,x=n[r+8],T=n[r+9],C=n[r+10],S=n[r+11],e[8]=x*o+T*l+C*p+S*h,e[9]=x*a+T*c+C*f+S*v,e[10]=x*i+T*u+C*g+S*y,e[11]=x*s+T*d+C*m+S*b,x=n[r+12],T=n[r+13],C=n[r+14],S=n[r+15],e[12]=x*o+T*l+C*p+S*h,e[13]=x*a+T*c+C*f+S*v,e[14]=x*i+T*u+C*g+S*y,e[15]=x*s+T*d+C*m+S*b},e.replaceShaderNormal=(e,r,o)=>{if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(n=dd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=n}n.replaceShaderNormal(e,r,o)},e.replaceShaderColor=(e,r,o)=>{if(t.hardwareSupport&&t.renderable.getColorArray()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];a&&(i=i.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let s=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];a&&(s=s.concat([" vec3 specularColor;"," float specularPower;"])),s=s.concat([" opacity = opacityUniform;"]),a&&(s=s.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(i=i.concat(["varying vec4 vertexColorVSOutput;"]),n=dd.substitute(n,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,n=dd.substitute(n,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,r=dd.substitute(r,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,r=dd.substitute(r,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,s=s.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),o=dd.substitute(o,"//VTK::Color::Impl",s).result,o=dd.substitute(o,"//VTK::Color::Dec",i).result,e.Vertex=n,e.Geometry=r,e.Fragment=o}n.replaceShaderColor(e,r,o)},e.replaceShaderPositionVC=(e,r,o)=>{if(t.hardwareSupport){let n=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(n=dd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result,n=dd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(n=dd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,n=dd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result),e.Vertex=n}n.replaceShaderPositionVC(e,r,o)},e.replaceShaderPicking=(e,r,o)=>{if(t.hardwareSupport){let t=e.Fragment,n=e.Vertex;n=dd.substitute(n,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,n=dd.substitute(n,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,e.Vertex=n,t=dd.substitute(t,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,t=dd.substitute(t,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,e.Fragment=t}else n.replaceShaderPicking(e,r,o)},e.updateGlyphShaderParameters=(n,r,o,a,i,s,l,c)=>{const u=o.getProgram();if(n){const e=t.normalMatrix,n=s,r=9*l,o=t.tmpMat3,a=e[0],i=e[1],c=e[2],d=e[3],p=e[4],f=e[5],g=e[6],m=e[7],h=e[8],v=n[r],y=n[r+1],b=n[r+2],x=n[r+3],T=n[r+4],C=n[r+5],S=n[r+6],P=n[r+7],A=n[r+8];o[0]=v*a+y*d+b*g,o[1]=v*i+y*p+b*m,o[2]=v*c+y*f+b*h,o[3]=x*a+T*d+C*g,o[4]=x*i+T*p+C*m,o[5]=x*c+T*f+C*h,o[6]=S*a+P*d+A*g,o[7]=S*i+P*p+A*m,o[8]=S*c+P*f+A*h,u.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcpcMatrix,i,16*l),u.setUniformMatrix("MCPCMatrix",t.tmpMat4),r&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,i,16*l),u.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a){const e=a.getData();t.tmpColor[0]=e[4*l]/255,t.tmpColor[1]=e[4*l+1]/255,t.tmpColor[2]=e[4*l+2]/255,u.setUniform3fArray("ambientColorUniform",t.tmpColor),u.setUniform3fArray("diffuseColorUniform",t.tmpColor)}c&&u.setUniform3fArray("mapperIndex",c.getPropColorValue())},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=t.context,i=r.getProperty().getEdgeVisibility()&&o===hf.SURFACE,s=t.openGLCamera.getKeyMatrices(n),l=t.openGLActor.getKeyMatrices();ve(t.normalMatrix,s.normalMatrix,l.normalMatrix),b(t.mcpcMatrix,s.wcpc,l.mcwc),b(t.mcvcMatrix,s.wcvc,l.mcwc);const c=t.renderable.getMatrixArray(),u=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),p=c.length/16;let f=!1;t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().getCurrentPass()===yf.COMPOSITE_INDEX_PASS&&(f=!0);for(let s=t.primTypes.Start;s{if(e.getCABO().getElementCount()&&(t.glyphBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime()))return e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||mf("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||mf("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||mf("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||mf("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(e,r,o),void e.getAttributeUpdateTime().modified();n.setMapperShaderParameters(e,r,o)},e.getNeedToRebuildBufferObjects=(e,r)=>(t.renderable.buildArrays(),t.VBOBuildTime.getMTime()!!(n.getNeedToRebuildShaders(e,r,o)||e.getShaderSourceTime().getMTime(){if(t.hardwareSupport){const e=t.renderable.getMatrixArray(),n=t.renderable.getNormalArray(),r=t.renderable.getColorArray();if(t.matrixBuffer||(t.matrixBuffer=Yu.newInstance(),t.matrixBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.normalBuffer=Yu.newInstance(),t.normalBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorBuffer=Yu.newInstance(),t.colorBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.pickBuffer=Yu.newInstance(),t.pickBuffer.setOpenGLRenderWindow(t._openGLRenderWindow)),t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(e,vf.ARRAY_BUFFER),t.normalBuffer.upload(n,vf.ARRAY_BUFFER),r?t.colorBuffer.upload(r.getData(),vf.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();const o=e.length/16,a=new Uint8Array(4*o);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cf,n),op.extend(e,t,n),t.tmpMat3=pe(new Float64Array(9)),t.normalMatrix=pe(new Float64Array(9)),t.mcpcMatrix=g(new Float64Array(16)),t.mcvcMatrix=g(new Float64Array(16)),t.tmpColor=[],t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),Tf(e,t)}),"vtkOpenGLGlyph3DMapper");rn("vtkGlyph3DMapper",Sf);const{vtkErrorMacro:Pf}=jt;class Af{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const a=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Pf("Invalid or missing input");const r=hu.newInstance();r.shallowCopy(n);const o=new Af,a=n.getLines().getData();let i=0;for(;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wf,n),jt.obj(e,t),jt.algo(e,t,1,1),If(e,t)}var Mf={newInstance:jt.newInstance(Of,"vtkClosedPolyLineToSurfaceFilter"),extend:Of};const{vtkErrorMacro:Rf}=Kt;function Vf(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Rf("Invalid or missing input");if(!t.cutFunction)return void Rf("Missing cut function");const o=hu.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),a=r.getNumberOfPoints(),i=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const a=[];for(let e=0;e0;if(g[r]>0===i)continue;let s=e,l=r,c=g[l]-g[s];c<=0&&(s=r,l=e,c*=-1);let u=0;0!==c&&(u=(t.cutValue-g[s])/c);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const h=[p[0]+u*(f[0]-p[0]),p[1]+u*(f[1]-p[1]),p[2]+u*(f[2]-p[2])];a.push({pointEdge1:d,pointEdge2:m,intersectedPoint:h,newPointID:-1})}for(let e=0;e2&&(l.push(c),a.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(it(r.getDataType(),i),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Ef={cutFunction:null,cutScalars:null,cutValue:0};function Df(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ef,n),yt(e,t),Mt(e,t,1,1),Pt(e,t,["cutFunction","cutValue"]),Vf(e,t)}var Lf={newInstance:Et(Df,"vtkCutter"),extend:Df};const Bf=e=>e,Nf=1e-6;class kf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=g(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?l:Bf}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);An(n,e[0],e[1],e[2]),An(r,t[0],t[1],t[2]),Rn(n,n),Rn(r,r);const a=Vn(n,r);return a>=1||(En(this.tmp,n,r),Sn(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(sa(yo,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wf,n),jt.obj(e,t),jt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),jt.setGetArray(e,t,["center","rotations"],3),jt.setGetArray(e,t,["matrix"],16),t._polys=dc.newInstance({values:Uint16Array.from(Uf)}),t._lineCells=dc.newInstance({values:Uint16Array.from(Gf)}),jt.moveToProtected(e,t,["polys","lineCells"]),jt.algo(e,t,0,1),zf(e,t)}var jf={newInstance:jt.newInstance(Hf,"vtkCubeSource"),extend:Hf};const{vtkErrorMacro:Kf}=jt;function $f(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Kf("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Kf("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qf={};function Xf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qf,n),jt.obj(e,t),jt.algo(e,t,1,1),t._cubeSource=jf.newInstance(),jt.moveToProtected(e,t,["cubeSource","tmpOut"]),$f(e,t)}var Yf={newInstance:jt.newInstance(Xf,"vtkImageDataOutlineFilter"),extend:Xf};let Zf;function Qf(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Dn(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let a=0;a{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?b(n,t.matrix,e):b(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),a=t.preMultiplyFlag?()=>b(o,t.matrix,r):()=>b(o,r,t.matrix);for(let t=0;tZf({matrix:Ga.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const Jf={preMultiplyFlag:!1,matrix:[...yo]};function eg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jf,n),jt.obj(e,t),jt.setGet(e,t,["preMultiplyFlag"]),jt.setGetArray(e,t,["matrix"],16),Qf(e,t)}Zf=jt.newInstance(eg,"vtkTransform");var tg={newInstance:Zf,extend:eg};const ng={NEAREST:0,LINEAR:1};var rg={InterpolationType:ng};const{vtkErrorMacro:og}=Kt;function ag(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ig(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function sg(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):og("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===ng.NEAREST?(t.openGLTexture.setMinificationFilter(Cd.NEAREST),t.openGLTexture.setMagnificationFilter(Cd.NEAREST),t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST),t.pwfTexture.setMinificationFilter(Cd.NEAREST),t.pwfTexture.setMagnificationFilter(Cd.NEAREST)):(t.openGLTexture.setMinificationFilter(Cd.LINEAR),t.openGLTexture.setMagnificationFilter(Cd.LINEAR),t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR),t.pwfTexture.setMinificationFilter(Cd.LINEAR),t.pwfTexture.setMagnificationFilter(Cd.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const a=o.getNumberOfComponents();let i=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===i&&t.openGLTextureString===i)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=Fd.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=i,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),c=l.getIndependentComponents(),u=c?a:1,d=c?2*u:1,p=l.getRGBTransferFunction();i=ag(l,p,u);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===i&&t.colorTextureString===i)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=Fd.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:og("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",rs.SURFACE,r)}t.VBOBuildString=h,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){a.isUniformUsed("texture1")&&a.setUniformi("texture1",t.openGLTexture.getTextureUnit()),a.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||og("Error setting vertexWC in shader VAO.")),a.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||og("Error setting normalWC in shader VAO.")),a.isUniformUsed("slabThickness")&&a.setUniformf("slabThickness",t.renderable.getSlabThickness()),a.isUniformUsed("spacing")&&a.setUniform3fv("spacing",t.currentInput.getSpacing()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabTrapezoid")&&a.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(a.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();d(t.tmpMat4,n.getIndexToWorld()),T(t.tmpMat4,t.tmpMat4,r),h(t.tmpMat4,t.tmpMat4),e&&b(t.tmpMat4,t.tmpMat4,e),a.setUniformMatrix("WCTCMatrix",t.tmpMat4)}a.isUniformUsed("vboScaling")&&a.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const a=t._openGLCamera.getKeyMatrices(n),i=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",ig([a.wcpc,i.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",ig([a.wcvc,i.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.openGLTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let c=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(c=!0),!(!c&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a&&t.lastSlabThickness===i&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,t.lastSlabThickness=i,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=dd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=dd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const a=e.Geometry;let i=e.Fragment;const s=t.renderable.getSlabThickness();o=dd.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),c=r.getProperty().getIndependentComponents();let u=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(c){for(let e=1;e0&&(u=u.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),u=u.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),i=dd.substitute(i,"//VTK::TCoord::Dec",u).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),c){const e=["r","g","b","a"];for(let t=0;t{let a=n.Vertex;const i=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let c=["attribute vec4 vertexWC;"];c=c.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(c=c.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),a=dd.substitute(a,"//VTK::PositionVC::Dec",c).result;let u=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(u=u.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),a=dd.substitute(a,"//VTK::PositionVC::Impl",u).result,a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=dd.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=a,n.Geometry=i,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const i=t.renderable.getSlicePolyData(),s=t.renderable.getSlicePlane();if(i)e=e.concat(`PolyData${i.getMTime()}`);else if(s){e=e.concat(`Plane${s.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=ue(n?.getDirection());ge(t,t);const r=[...s.getNormal()];Ln(r,r,t),[o,a]=function(e){Ga.normalize(e);const t=[0,0,0];for(let r=0;r<3;++r){(n=t)[0]=0,n[1]=0,n[2]=0,t[r]=1;const o=Ga.dot(e,t);if(o<-.999||o>.999)return[!0,r]}var n;return[!1,2]}(r)}else{const o=ei.newInstance();o.setNormal(0,0,1);let a=[0,1,0,1,0,1];n&&(a=r),o.setOrigin(a[0],a[2],.5*(a[5]+a[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${s?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(i)t.resliceGeom||(t.resliceGeom=hu.newInstance()),t.resliceGeom.getPoints().setData(i.getPoints().getData(),3),t.resliceGeom.getPolys().setData(i.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(i.getPointData().getNormals());else if(s)if(o){const e=new Float32Array(12),r=n.worldToIndex(s.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),l=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let c=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[c+a]=r[a],e[c+o[0]]=l[2*o[0]+n],e[c+o[1]]=l[2*o[1]+t],c+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const u=new Uint16Array(8);u[0]=3,u[1]=0,u[2]=1,u[3]=3,u[4]=3,u[5]=0,u[6]=3,u[7]=2;const d=s.getNormal();Ga.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=hu.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(u,1);const f=Es.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(s),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=hu.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=s.getNormal(),o=t.resliceGeom.getNumberOfPoints();Ga.normalize(r);const a=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const lg={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const cg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lg,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.tris=xd.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},yt(t.VBOBuildTime),t.tmpMat4=g(new Float64Array(16)),t.outlineFilter=Yf.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=hu.newInstance(),t.cutter=Lf.newInstance(),t.lineToSurfaceFilter=Mf.newInstance(),t.transform=tg.newInstance(),xt(e,t,["openGLTexture"]),sg(e,t)}),"vtkOpenGLImageResliceMapper");rn("vtkImageResliceMapper",cg);var ug={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}};const{vtkErrorMacro:dg}=Kt,{SlicingMode:pg}=ug;function fg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function gg(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function mg(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,a=dd.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,a=dd.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=a,n.Fragment=i,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(et("OpenGL has a limit of 6 clipping planes"),e=6),o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=dd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=dd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents();let i=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(i=!0),!(!i&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||dg("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||dg("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const a=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",a);const i=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(et("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const a=n.getProgram(),i=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();b(t.imagemat,i.mcwc,l);const c=t.openGLCamera.getKeyMatrices(r);if(b(t.imagemat,c.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,e)}if(a.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();a.setUniform3i("imageDimensions",o[0],o[1],1),a.setUniformMatrix("vWCtoIDX",n);const i=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,i.wcpc),t.openGLCamera.getKeyMatrices(r),a.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();a.setUniformf("vpWidth",l[0]),a.setUniformf("vpHeight",l[1]);const c=e.getRenderTargetOffset();a.setUniformf("vpOffsetX",c[0]/l[0]),a.setUniformf("vpOffsetY",c[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):dg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;const i=a.getDataType(),s=a.getNumberOfComponents(),l=r.getProperty(),c=l.getInterpolationType(),u=l.getIndependentComponents(),d=u?s:1,p=u?2*d:1,f=l.getRGBTransferFunction(),g=fg(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===g&&t.colorTextureString===g)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=Fd.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),c===ng.NEAREST?(t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST)):(t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[pg.X,pg.Y,pg.Z].includes(t.renderable.getSlicingMode())?x:T,p=o.getSpatialExtent(),f=a.getData();let g=null;if(b===pg.I){g=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=Fd.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const hg={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const vg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hg,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.tris=xd.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),Pt(e,t,[]),t.VBOBuildTime={},yt(t.VBOBuildTime),mg(e,t)}),"vtkOpenGLImageMapper");rn("vtkAbstractImageMapper",vg);const{vtkErrorMacro:yg}=jt;function bg(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function xg(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===ng.NEAREST?(t.volumeTexture.setMinificationFilter(Cd.NEAREST),t.volumeTexture.setMagnificationFilter(Cd.NEAREST),t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST),t.pwfTexture.setMinificationFilter(Cd.NEAREST),t.pwfTexture.setMagnificationFilter(Cd.NEAREST)):(t.volumeTexture.setMinificationFilter(Cd.LINEAR),t.volumeTexture.setMagnificationFilter(Cd.LINEAR),t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR),t.pwfTexture.setMinificationFilter(Cd.LINEAR),t.pwfTexture.setMagnificationFilter(Cd.LINEAR));const a=r.getMTime();if(t.volumeTextureTime!==a){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=a}const i=r.getPointData()&&r.getPointData().getScalars();if(!i)return;const s=i.getNumberOfComponents(),l=n.getProperty(),c=l.getIndependentComponents(),u=c?s:1,d=c?2*u:1,p=bg(l,l.getRGBTransferFunction,u);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==i||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==a)&&(t.lastUseCenterPoint=i,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),a=dd.substitute(a,"//VTK::Color::Dec",s).result;const c=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?c.push("centerlineDirVSOutput = centerlineDirection;"):c.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),a=dd.substitute(a,"//VTK::Color::Impl",c).result;const u=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=dd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=dd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getShaderTemplate=(e,t,n)=>{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||yg("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&yg(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const a=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",a),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const i=t.currentImageDataInput,s=i.getWorldToIndex(),l=w(new Float32Array(16),Mn([],i.getDimensions())),c=oe(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",c),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentImageDataInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,a=t.openGLCamera.getKeyMatrices(n).wcpc;if(b(t.imagemat,a,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.volumeTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const Tg={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const Cg=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tg,n),Zt.extend(e,t,n),Ud(e,t,n),jt.algo(e,t,2,0),t.tris=xd.newInstance(),t.volumeTexture=Fd.newInstance(),t.colorTexture=Fd.newInstance(),t.pwfTexture=Fd.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),xg(e,t)}),"vtkOpenGLImageCPRMapper");function Sg(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkImageCPRMapper",Cg);const Pg={context:null,keyMatrixTime:null,keyMatrices:null};const Ag=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),Sg(e,t)}),"vtkOpenGLImageSlice");function Ig(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.MCWCMatrix,t.renderable.getMatrix()),m(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?pe(t.normalMatrix):(se(t.normalMatrix,t.MCWCMatrix),ge(t.normalMatrix,t.normalMatrix),fe(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}rn("vtkImageSlice",Ag);const wg={};const Og=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),Pt(e,t,["context"]),Ig(e,t)}),"vtkOpenGLVolume");rn("vtkVolume",Og);const Mg=0,Rg=1,Vg=1,Eg=0,Dg=1,Lg=2,Bg=3,Ng=4,{vtkWarningMacro:kg,vtkErrorMacro:Fg}=Kt;function _g(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Gg(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Fragment;o.getProperty().getInterpolationType()===Rg&&(a=dd.substitute(a,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(a=dd.substitute(a,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const i=t.scalarTexture.getComponents();a=dd.substitute(a,"//VTK::NumComponents",`#define vtkNumComponents ${i}`).result;const s=o.getProperty().getIndependentComponents();if(s){a=dd.substitute(a,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(a=dd.substitute(a,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),c=t.currentInput.getSpacing(),u=new Float64Array(3);An(u,(l[1]-l[0])*c[0],(l[3]-l[2])*c[1],(l[5]-l[4])*c[2]);const d=Sn(u)/e.getCurrentSampleDistance(r);a=dd.substitute(a,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,a=dd.substitute(a,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(a=dd.substitute(a,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(a=dd.substitute(a,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(a=dd.substitute(a,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,a=0;n.getLights().forEach((e=>{e.getSwitch()&&(a+=1)})),o=dd.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${a}];`,`uniform vec3 lightDirectionVC[${a}]; // normalized`,`uniform vec3 lightHalfAngleVC[${a}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=dd.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${a}];`,`uniform vec3 lightAttenuation[${a}];`,`uniform float lightConeAngle[${a}];`,`uniform float lightExponent[${a}];`,`uniform int lightPositional[${a}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=dd.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=dd.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=dd.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=dd.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let a=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===Eg&&(a=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===a&&(a=1)),1===a&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(a=2),a<3&&e.getPositional()&&(a=3)})));let i=!1;t.lastLightComplexity!==a&&(t.lastLightComplexity=a,i=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=!1;const u=[];if(l){for(let e=0;e0&&(c=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);An(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const g=Sn(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:c,iComps:l,maxSamples:g,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:u};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(a.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Fg("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),a.setUniformi("texture1",t.scalarTexture.getTextureUnit()),a.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const i=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],c=[];for(let e=0;e<4;e++)l[e]=s[0]*i.dataComputedScale[e]+i.dataComputedOffset[e],c[e]=s[1]*i.dataComputedScale[e]+i.dataComputedOffset[e],l[e]=(l[e]-i.offset[e])/i.scale[e],c[e]=(c[e]-i.offset[e])/i.scale[e];if(a.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),a.setUniform4f("ipScalarRangeMax",c[0],c[1],c[2],c[3]),null!==t.zBufferTexture){a.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();a.setUniformf("vpZWidth",e[0]),a.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const a=t.openGLCamera.getKeyMatrices(r),i=t.openGLVolume.getKeyMatrices();b(t.modelToView,a.wcvc,i.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),c=l.getClippingRange();s.setUniformf("camThick",c[1]-c[0]),s.setUniformf("camNear",c[0]),s.setUniformf("camFar",c[1]);const u=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let g=1,m=-1,v=1,y=-1;for(let e=0;e<8;++e)An(p,u[e%2],u[2+Math.floor(e/2)%2],u[4+Math.floor(e/4)]),Dn(p,p,t.modelToView),l.getParallelProjection()||(Rn(f,p),On(p,f,-c[0]/p[2])),Dn(p,p,a.vcpc),g=Math.min(p[0],g),m=Math.max(p[0],m),v=Math.min(p[1],v),y=Math.max(p[1],y);s.setUniformf("dcxmin",g),s.setUniformf("dcxmax",m),s.setUniformf("dcymin",v),s.setUniformf("dcymax",y),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),T=t.currentInput.getSpacing(),C=new Float64Array(3);An(C,(x[1]-x[0])*T[0],(x[3]-x[2])*T[1],(x[5]-x[4])*T[2]),s.setUniform3f("vSpacing",T[0],T[1],T[2]),An(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Dn(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();b(t.idxToView,t.modelToView,S),ve(t.idxNormalMatrix,a.normalMatrix,i.normalMatrix),ve(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const P=Sn(C)/e.getCurrentSampleDistance(r);P>t.renderable.getMaximumSamplesPerRay()&&kg(`The number of steps required ${Math.ceil(P)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const A=new Float64Array(3);if(An(A,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(A,A,C),s.setUniform3f("vVCToIJK",A[0],A[1],A[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const I=new Float64Array(3),w=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:An(I,-1,0,0),An(w,x[0],x[2],x[4]);break;case 2:An(I,0,1,0),An(w,x[1],x[3],x[5]);break;case 3:An(I,0,-1,0),An(w,x[0],x[2],x[4]);break;case 4:An(I,0,0,1),An(w,x[1],x[3],x[5]);break;case 5:An(I,0,0,-1),An(w,x[0],x[2],x[4]);break;default:An(I,1,0,0),An(w,x[1],x[3],x[5])}Ln(I,I,t.idxNormalMatrix),Dn(w,w,t.idxToView);const n=-1*Vn(w,I);s.setUniform3f(`vPlaneNormal${e}`,I[0],I[1],I[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[a,i]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const c=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,c.wcpc),o.setClippingRange(a,i),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const u=e.getRenderTargetSize();s.setUniformf("vpWidth",u[0]),s.setUniformf("vpHeight",u[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/u[0]),s.setUniformf("vpOffsetY",d[1]/u[1])}if(h(t.projectionToView,a.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let O=0;const M=[],R=[],V=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();M[0+3*O]=t[0]*n,M[1+3*O]=t[1]*n,M[2+3*O]=t[2]*n;const r=e.getDirection();An(I,r[0],r[1],r[2]),Ln(I,I,a.normalMatrix),Rn(I,I),R[0+3*O]=I[0],R[1+3*O]=I[1],R[2+3*O]=I[2],V[0+3*O]=-.5*I[0],V[1+3*O]=-.5*I[1],V[2+3*O]=-.5*(I[2]-1),O++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",O),s.setUniform3fv("lightColor",M),s.setUniform3fv("lightDirectionVC",R),s.setUniform3fv("lightHalfAngleVC",V),3===t.lastLightComplexity){O=0;const e=[],n=[],o=[],a=[],i=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*O]=s[0],n[1+3*O]=s[1],n[2+3*O]=s[2],a[O]=r.getExponent(),o[O]=r.getConeAngle(),i[O]=r.getPositional();const l=r.getTransformedPosition();Dn(l,l,t.modelToView),e[0+3*O]=l[0],e[1+3*O]=l[1],e[2+3*O]=l[2],O+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",a),s.setUniformiv("lightPositional",i)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const a=t.scalarTexture.getVolumeInfo(),i=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",i.getAmbient()),o.setUniformf("vDiffuse",i.getDiffuse()),o.setUniformf("vSpecular",i.getSpecular()),o.setUniformf("vSpecularPower",i.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],a=[],i=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Mg?(t.scalarTexture.setMinificationFilter(Cd.NEAREST),t.scalarTexture.setMagnificationFilter(Cd.NEAREST)):(t.scalarTexture.setMinificationFilter(Cd.LINEAR),t.scalarTexture.setMagnificationFilter(Cd.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=md.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Fg("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Fg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;t._scalars!==a&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=a);const i=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Cd.LINEAR),t.jitterTexture.setMagnificationFilter(Cd.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,ys.UNSIGNED_CHAR,e)}const s=a.getNumberOfComponents(),l=i.getIndependentComponents()?s:1,c=i.getScalarOpacity(),u=t._openGLRenderWindow.getGraphicsResourceForObject(c);let d=_g(i,c,l);if(u.vtkObj&&u.hash===d&&t.opacityTextureString===d)t.opacityTexture=u.vtkObj,t.opacityTextureString=u.hash;else{const r=1024,o=2*r*l,a=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Es.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Es.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",rs.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ug,n),Zt.extend(e,t,n),t.VBOBuildTime={},yt(t.VBOBuildTime,{mtime:0}),t.tris=xd.newInstance(),t.scalarTexture=Fd.newInstance(),t.opacityTexture=Fd.newInstance(),t.colorTexture=Fd.newInstance(),t.jitterTexture=Fd.newInstance(),t.jitterTexture.setWrapS(Td.REPEAT),t.jitterTexture.setWrapT(Td.REPEAT),t.labelOutlineThicknessTexture=Fd.newInstance(),t.framebuffer=$p.newInstance(),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),Pt(e,t,["context"]),Gg(e,t)}),"vtkOpenGLVolumeMapper");rn("vtkVolumeMapper",zg);const{vtkDebugMacro:Wg}=Kt;function Hg(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),a=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,i=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),a=t._openGLRenderWindow.getContext();e.bind();const i=r.getFramebuffer();i?i.saveCurrentBindingsAndBuffers():Wg("No framebuffer to save/restore");const l=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.getHandle(),0),a.checkFramebufferStatus(a.FRAMEBUFFER)===a.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),a.viewport(0,0,n,o),a.readPixels(0,0,n,o,a.RGBA,a.UNSIGNED_BYTE,s)),i&&i.restorePreviousBindingsAndBuffers(),a.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const jg={};const Kg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jg,n),Zt.extend(e,t,n),Hg(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");rn("vtkPixelSpaceCallbackMapper",Kg);var $g="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtktextureObjectVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\nattribute vec2 tcoordDC;\nvarying vec2 tcoordVC;\n\nvoid main()\n{\n tcoordVC = tcoordDC;\n gl_Position = vertexDC;\n}\n";const{Representation:qg}=ds;function Xg(e,t,n,r){let[o,a]=t;const i=e.getContext(),s=Fd.newInstance({autoParameters:!1,wrapS:r,wrapT:r,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:i.FLOAT,baseLevel:0,maxLevel:0});return s.setOpenGLRenderWindow(e),s.setInternalFormat(i.RGBA32F),s.create2DFromRaw(o,a,4,"Float32Array",null),s.activate(),s.sendParameters(),s.deactivate(),s}function Yg(e,t){return Xg(e,t,Fd.Filter.NEAREST,Fd.Wrap.CLAMP_TO_EDGE)}function Zg(e,t){t.classHierarchy.push("vtkLICPingPongBufferManager"),t._openGLRenderWindow?(t.quad=function(e){const t=xd.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Es.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Es.newInstance({numberOfComponents:1,values:o}),s=Es.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",qg.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow),t.context=t._openGLRenderWindow.getContext(),t.licTexture0=Yg(t._openGLRenderWindow,t.size),t.seedTexture0=Yg(t._openGLRenderWindow,t.size),t.licTexture1=Yg(t._openGLRenderWindow,t.size),t.seedTexture1=Yg(t._openGLRenderWindow,t.size),t.eeTexture=t.doEEPass?Xg(t._openGLRenderWindow,t.size,Fd.Filter.NEAREST,Fd.Wrap.CLAMP_TO_EDGE):null,t.imageVectorTexture=t.doVTPass?function(e,t){return Xg(e,t,Fd.Filter.LINEAR,Fd.Wrap.CLAMP_TO_EDGE)}(t._openGLRenderWindow,t.size):null,t.pingTextures[0]=t.licTexture0,t.pingTextures[1]=t.seedTexture0,t.pongTextures[0]=t.licTexture1,t.pongTextures[1]=t.seedTexture1,t.textures[0]=t.pingTextures,t.textures[1]=t.pongTextures,e.swap=()=>{t.readIndex=1-t.readIndex},e.renderQuad=(e,n)=>{const r=t.quad,o=t.context;let a=t.quadVAO;a||(a=md.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.quadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.getLastLICBuffer=()=>0===t.readIndex?t.licTexture0:t.licTexture1,e.getLastSeedBuffer=()=>0===t.readIndex?t.seedTexture0:t.seedTexture1,e.getLICBuffer=()=>1-t.readIndex==0?t.licTexture0:t.licTexture1,e.getSeedBuffer=()=>1-t.readIndex==0?t.seedTexture0:t.seedTexture1,e.getLICTextureUnit=()=>{const e=t.textures[t.readIndex][0];return e.activate(),e.getTextureUnit()},e.getSeedTextureUnit=()=>{const e=t.textures[t.readIndex][1];return e.activate(),e.getTextureUnit()},e.getNoiseTextureUnit=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 0===e?(t.noiseTexture.activate(),t.noiseTexture.getTextureUnit()):(t.eeTexture.activate(),t.eeTexture.getTextureUnit())},e.getVectorTextureUnit=()=>(t.vectorTexture.activate(),t.vectorTexture.getTextureUnit()),e.getImageVectorTextureUnit=()=>t.imageVectorTexture?(t.imageVectorTexture.activate(),t.imageVectorTexture.getTextureUnit()):e.getVectorTextureUnit(),e.getMaskVectorTextureUnit=()=>t.maskVectorTexture?(t.maskVectorTexture.activate(),t.maskVectorTexture.getTextureUnit()):e.getImageVectorTextureUnit(),e.clearBuffers=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),n.setColorBuffer(t.licTexture0,0),n.setColorBuffer(t.seedTexture0,1),n.setColorBuffer(t.licTexture1,2),n.setColorBuffer(t.seedTexture1,3);const o=[r.COLOR_ATTACHMENT0,r.COLOR_ATTACHMENT1,r.COLOR_ATTACHMENT2,r.COLOR_ATTACHMENT3];e&&(n.removeColorBuffer(4),n.setColorBuffer(t.eeTexture,4),o.push(r.COLOR_ATTACHMENT4)),r.drawBuffers(o),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),e&&n.removeColorBuffer(4),r.drawBuffers([r.NONE])},e.clearBuffer=e=>{const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.setColorBuffer(e,0),r.drawBuffers([r.COLOR_ATTACHMENT0]),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(e,0),r.drawBuffers([r.NONE])},e.activateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.activate():t.vectorTexture.activate(),t.maskVectorTexture&&t.maskVectorTexture.activate()},e.deactivateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.deactivate():t.vectorTexture.deactivate(),t.maskVectorTexture&&t.maskVectorTexture.deactivate()},e.activateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.activate();break;case 1:t.eeTexture.activate();break;default:console.error("Wrong LIC pass number")}},e.deactivateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.deactivate();break;case 1:t.eeTexture.deactivate();break;default:console.error("Wrong LIC pass number")}},e.attachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.textures[1-t.readIndex],r=t.framebuffer,o=t.context;e[0].activate(),e[1].activate(),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(n[0],0),r.setColorBuffer(n[1],1),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1])},e.detachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.context,r=t.framebuffer;e[0].deactivate(),e[1].deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE])},e.attachImageVectorBuffer=()=>{const e=t.framebuffer,n=t.context;t.vectorTexture.activate(),e.removeColorBuffer(0),e.setColorBuffer(t.imageVectorTexture,0),n.drawBuffers([n.COLOR_ATTACHMENT0])},e.detachImageVectorBuffer=()=>{const e=t.context,n=t.framebuffer;t.vectorTexture.deactivate(),n.removeColorBuffer(0),e.drawBuffers([e.NONE])},e.attachEEBuffer=()=>{t.textures[t.readIndex][0].activate(),t.framebuffer.removeColorBuffer(0),t.framebuffer.setColorBuffer(t.eeTexture,0);const e=t.context;e.drawBuffers([e.COLOR_ATTACHMENT0])},e.detachEEBuffer=()=>{const e=t.context;t.framebuffer.removeColorBuffer(0),e.drawBuffers([e.NONE]),t.textures[t.readIndex][0].deactivate()},e.detachBuffers=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),e.drawBuffers([e.NONE]);const r=t.textures[t.readIndex],o=t.textures[1-t.readIndex];r[0]&&r[0].deactivate(),r[1]&&r[1].deactivate(),o[0]&&o[0].deactivate(),o[1]&&o[1].deactivate(),t.eeTexture&&t.eeTexture.deactivate(),t.noiseTexture&&t.noiseTexture.deactivate()},e.getWriteIndex=()=>1-t.readIndex,e.detachBuffers()):console.error("Pass renderwindow to ping pong manager")}const Qg={vectorTexture:null,maskVectorTexture:null,noiseTexture:null,doEEPass:!1,doVTPass:!1,readIndex:0,quad:null,lastProgramHash:null,framebuffer:null,size:null,pingTextures:[],pongTextures:[],textures:[]};function Jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),jt.obj(e,t),jt.get(e,t,["readIndex"]),jt.setGet(e,t,["doEEPass","doVTPass","_openGLRenderWindow","vectorTexture","maskVectorTexture","noiseTexture","framebuffer","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),Zg(e,t)}var em={newInstance:jt.newInstance(Jg,"vtkLICPingPongBufferManager"),extend:Jg};const tm=0,nm=1,rm=2,om=3,am=1;function im(e,t){function n(e,t){e.setUniformi("texLIC",t.getLICTextureUnit()),e.setUniformi("texSeedPts",t.getSeedTextureUnit())}function r(e,t,n){e.attachLICBuffers(),e.renderQuad(t,n),e.detachLICBuffers(),e.swap()}t.classHierarchy.push("vtkLineIntegralConvolution2D"),e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray($g,e,""),e.dumpTextureValues=function(e,n){let[r,o]=n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4;const l=$p.newInstance(),c=a;let u=null;return l.setOpenGLRenderWindow(i),l.saveCurrentBindingsAndBuffers(),l.create(r,o),l.populateFramebuffer(),l.setColorBuffer(e),u=new Float32Array(r*o*s),c.readPixels(0,0,r,o,4===s?c.RGBA:c.RGB,c.FLOAT,u),l.restorePreviousBindingsAndBuffers(),u},e.getTextureMinMax=function(n,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow;const i=e.dumpTextureValues(n,r,o,a,4);let s=Number.MAX_VALUE,l=Number.MIN_VALUE;for(let e=0;el&&(l=t)}return{min:s,max:l}},e.getComponentSelectionProgram=e=>{const t="xyzw";return`.${t[e[0]]}${t[e[1]]}`},e.buildShaders=()=>{t.LIC0ShaderProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LIC0.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n/**\nThis shader initializes the convolution for the LIC computation.\n*/\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texMaskVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\n\nuniform int uStepNo; // in step 0 initialize lic and seeds, else just seeds\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uMaskThreshold; // if |V| < uMaskThreshold render transparent\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the *whole* domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value. this\n// depends on the pass number.\nvec2 getNoiseTC(vec2 vectc)\n{\n // in pass 1 : convert from vector tc to noise tc\n // in pass 2 : use vector tc\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(vectc);\n }\n else\n {\n return vectc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the\n// need to convert to noise texture coordinates.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\nvoid main(void)\n{\n vec2 vectc = tcoordVC.st;\n\n // lic => (convolution, mask, 0, step count)\n if (uStepNo == 0)\n {\n float maskCriteria = length(texture2D(texMaskVectors, vectc).xyz);\n float maskFlag;\n if (maskCriteria <= uMaskThreshold)\n {\n maskFlag = 1.0;\n }\n else\n {\n maskFlag = 0.0;\n }\n float noise = getNoise(vectc);\n LICOutput = vec4(noise, maskFlag, 0.0, 1.0);\n }\n else\n {\n LICOutput = texture2D(texLIC, vectc);\n }\n\n // initial seed\n SeedOutput = vec4(vectc, 0.0, 1.0);\n}\n");const n=dd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_VT.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// move vector field to normalized image space\n// pre-processing for vtkLineIntegralConvolution2D\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Fragment shader used by the gaussian blur filter render pass.\n\nuniform sampler2D texVectors; // input texture\nuniform vec2 uTexSize; // size of texture\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n //VTK::LICComponentSelection::Impl\n V = V/uTexSize;\n gl_FragData[0] = vec4(V, 0.0, 1.0);\n}\n","//VTK::LICComponentSelection::Impl",`vec2 V = texture2D(texVectors, tcoordVC.st)${e.getComponentSelectionProgram(t.componentIds)};`).result;t.VTProgram=e.buildAShader(n);const r=dd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs1.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\nuniform sampler2D texSeedPts;\n\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uStepSize; // step size in parametric space\n\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n//VTK::LICVectorLookup::Impl\n\n// We need to do this manually since CLAMP_TO_BORDER and and borderColor\n// are very poorly supported in webgl\nvec2 clampToBorder(vec2 uv){\n if(uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)\n {\n return vec2(0.0, 0.0);\n }\n return getVector(uv);\n}\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the whole domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value.\n// in pass 1 repeatedly tile the noise texture across\n// the computational domain.\nvec2 getNoiseTC(vec2 tc)\n{\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(tc);\n }\n else\n {\n return tc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the need\n// to convert to either noise or lic texture coordinates in\n// pass 1 and 2 respectively.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\n// fourth-order Runge-Kutta streamline integration\n// no bounds checks are made, therefore it's essential\n// to have the entire texture initialized to 0\n// and set clamp to border and have border color 0\n// an integer is set if the step was taken, keeping\n// an accurate step count is necessary to prevent\n// boundary artifacts. Don't count the step if\n// all vector lookups are identically 0. This is\n// a proxy for \"stepped outside valid domain\"\nvec2 rk4(vec2 pt0, float dt, out bool count)\n{\n count=true;\n float dtHalf = dt * 0.5;\n vec2 pt1;\n\n vec2 v0 = clampToBorder(pt0);\n pt1 = pt0 + v0 * dtHalf;\n\n vec2 v1 = clampToBorder(pt1);\n pt1 = pt0 + v1 * dtHalf;\n\n vec2 v2 = clampToBorder(pt1);\n pt1 = pt0 + v2 * dt;\n\n vec2 v3 = clampToBorder(pt1);\n vec2 vSum = v0 + v1 + v1 + v2 + v2 + v3;\n\n if (vSum == vec2(0.0, 0.0))\n {\n count = false;\n }\n\n pt1 = pt0 + (vSum) * (dt * (1.0/6.0));\n\n return pt1;\n}\n\nvoid main(void)\n{\n vec2 lictc = tcoordVC.st;\n vec4 lic = texture2D(texLIC, lictc);\n vec2 pt0 = texture2D(texSeedPts, lictc).st;\n\n bool count;\n vec2 pt1 = rk4(pt0, uStepSize, count);\n\n if (count)\n {\n // accumulate lic step\n // (lic, mask, 0, step count)\n float noise = getNoise(pt1);\n LICOutput = vec4(lic.r + noise, lic.g, 0.0, lic.a + 1.0);\n SeedOutput = vec4(pt1, 0.0, 1.0);\n }\n else\n {\n // keep existing values\n LICOutput = lic;\n SeedOutput = vec4(pt0, 0.0, 1.0);\n }\n}\n","//VTK::LICVectorLookup::Impl",function(){const e="\n vec2 getVector( vec2 vectc )\n\n {\n\n vec2 V = texture2D( texVectors, vectc ).xy;\n\n // normalize if |V| not 0\n\n float lenV = length( V );\n\n if ( lenV > 1.0e-8 )\n\n {\n\n return V/lenV;\n\n }\n\n else\n\n {\n\n return vec2( 0.0, 0.0 );\n\n }\n\n }\n\n ",t="\n vec2 getVector( vec2 vectc )\n\n {\n\n return texture2D( texVectors, vectc ).xy;\n\n }\n\n ";return arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?t:e}(t.normalizeVectors),!0).result;t.LICIShaderProgram=e.buildAShader(r),t.LICNShaderProgram=e.buildAShader(" //VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LICN.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n/**\nThis shader finalizes the convolution for the LIC computation\napplying the normalization. eg. if box kernel is used the this\nis the number of steps taken.\n*/\n\nuniform sampler2D texLIC;\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n vec4 conv = texture2D(texLIC, tcoordVC.st);\n conv.r = conv.r/conv.a;\n // lic => (convolution, mask, 0, 1)\n LICOutput = vec4(conv.rg , 0.0, 1.0);\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.CEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// gray scale contrast enhance stage implemented via histogram stretching\n// if the min and max are tweaked it can generate out-of-range values\n// these will be clamped in 0 to 1\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uMin; // min gray scale color value\nuniform float uMaxMinDiff; // max-min\n\nin vec2 tcoordVC;\n\nvoid main( void )\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g!=0.0)\n {\n LICOutput = lic;\n }\n else\n {\n float CElic = clamp((lic.r - uMin)/uMaxMinDiff, 0.0, 1.0);\n LICOutput = vec4(CElic, lic.gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.EEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// high-pass filter stage employed by vtkLineIntegralConvolution2D\n// between LIC pass 1 and LIC pass 2. filtered LIC pass 1, becomes\n// noise for pass2.\n\n// the output of this shader\nlayout(location = 0) out vec4 EEOutput;\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uDx; // fragment size\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n// kernel for simple laplace edge enhancement.\n// p=Laplace(p)+p\nfloat K[9] = float[9](\n -1.0, -1.0, -1.0,\n -1.0, 9.0, -1.0,\n -1.0, -1.0, -1.0\n );\n\n// determine if the fragment was masked\nbool Masked(float val) { return val != 0.0; }\n\nvoid main(void)\n{\n // tex coord neighbor offsets\n vec2 fragDx[9] = vec2[9](\n vec2(-uDx, uDy), vec2(0.0, uDy), vec2(uDx, uDy),\n vec2(-uDx, 0.0), vec2(0.0, 0.0), vec2(uDx, 0.0),\n vec2(-uDx,-uDy), vec2(0.0,-uDy), vec2(uDx,-uDy)\n );\n\n vec2 lictc = tcoordVC.st;\n\n // compute the convolution but don't use convovled values if\n // any masked fragments on the stencil. Fragments outside\n // the valid domain are masked during initialization, and\n // texture wrap parameters are clamp to border with border\n // color that contains masked flag\n float conv = 0.0;\n bool dontUse = false;\n for (int i=0; i<9; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n vec4 lic = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic.g);\n conv = conv + K[i] * lic.r;\n }\n\n if (dontUse)\n {\n EEOutput = vec4(texture2D(texLIC, lictc).rg, 0.0, 1.0);\n }\n else\n {\n conv = clamp(conv, 0.0, 1.0);\n EEOutput = vec4(conv,texture2D(texLIC, lictc).g, 0.0, 1.0);\n }\n\n}\n"),t.AAHProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAH.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// horizontal pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDx; // fragment size\n\nin vec2 tcoordVC;\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDx[3] = vec2[3](vec2(-uDx,0.0), vec2(0.0,0.0), vec2(uDx,0.0));\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.AAVProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAV.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// vertical pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDy[3] = vec2[3](vec2(0.0,-uDy), vec2(0.0,0.0), vec2(0.0,uDy));\n\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDy[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n")},e.executeLIC=(o,a,i,s,l,c)=>{if(t._openGLRenderWindow=l,t.context=l.getContext(),Object.assign(t,c),o[0]<=0||o[1]<=0)return null;const u=[1/o[0],1/o[1]];let d=t.stepSize*Math.sqrt(u[0]*u[0]+u[1]*u[1]);d<=0&&(d=1e-10);const p=t.context;let f=t.framebuffer;f&&o[0]===f.getSize()[0]&&o[1]===f.getSize()[1]||(f=$p.newInstance(),f.setOpenGLRenderWindow(t._openGLRenderWindow),f.saveCurrentBindingsAndBuffers(),f.create(...o),f.populateFramebuffer(),f.restorePreviousBindingsAndBuffers(),t.framebuffer=f),f.saveCurrentBindingsAndBuffers(),f.bind(),p.viewport(0,0,...o),p.scissor(0,0,...o),t.shadersNeedBuild&&(e.buildShaders(),t.shadersNeedBuild=!1),t.bufs?(t.bufs.setVectorTexture(a),t.bufs.setMaskVectorTexture(i),t.bufs.setNoiseTexture(s)):t.bufs=em.newInstance({openGLRenderWindow:l,doEEPass:t.enhancedLIC,doVTPass:t.transformVectors,vectorTexture:a,maskVectorTexture:i,noiseTexture:s,framebuffer:f,size:o});const g=[(s.getWidth()+1)/o[0],(s.getHeight()+1)/o[1]],m=1/o[0],h=1/o[1],v=t._openGLRenderWindow.getShaderCache();if(t.transformVectors){const e=t.VTProgram;v.readyShaderProgram(e),t.bufs.attachImageVectorBuffer(),e.setUniform2f("uTexSize",...o),e.setUniformi("texVectors",t.bufs.getVectorTextureUnit()),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT),t.bufs.renderQuad(o,e),t.bufs.detachImageVectorBuffer()}t.bufs.clearBuffers(t.enhancedLIC),t.bufs.activateVectorTextures(),t.bufs.activateNoiseTexture(0);const{LIC0ShaderProgram:y}=t;v.readyShaderProgram(y),y.setUniformi("uStepNo",0),y.setUniformi("uPassNo",0),y.setUniformf("uMaskThreshold",t.maskThreshold),y.setUniform2f("uNoiseBoundsPt1",...g),y.setUniformi("texMaskVectors",t.bufs.getMaskVectorTextureUnit()),y.setUniformi("texLIC",t.bufs.getLICTextureUnit()),y.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0)),r(t.bufs,o,y);const{LICIShaderProgram:b}=t;v.readyShaderProgram(b),b.setUniformi("uPassNo",0),b.setUniformf("uStepSize",-d),b.setUniform2f("uNoiseBoundsPt1",...g),b.setUniformi("texVectors",t.bufs.getImageVectorTextureUnit()),b.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0));for(let e=0;e{const a=t._openGLRenderWindow.getShaderCache();let{min:i,max:s}=e.getTextureMinMax(t.bufs.getLastLICBuffer(),o,t.context,t._openGLRenderWindow);(s<=i||s>1||i<0)&&(console.error("Invalid color range: ",i,s),i=0,s=1);let l=s-i;n&&(i+=l*t.lowLICContrastEnhancementFactor,s-=l*t.highLICContrastEnhancementFactor,l=s-i);const{CEProgram:c}=t;a.readyShaderProgram(c),c.setUniformi("texLIC",t.bufs.getLICTextureUnit()),c.setUniformf("uMin",i),c.setUniformf("uMaxMinDiff",l),r(t.bufs,o,c)}}const sm={shadersNeedBuild:!0,stepSize:1,numberOfSteps:10,enhancedLIC:!0,enhanceContrast:!1,lowContrastEnhancementFactor:0,highContrastEnhancementFactor:0,antiAlias:0,componentIds:[0,1],normalizeVectors:!0,maskThreshold:0,transformVectors:!0,bufs:null,isComposite:!0};function lm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sm,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","nuberOfSteps","stepSize","normalizeVectors","maskThreshold","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","componentIds","isComposite"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),im(e,t)}var cm={newInstance:jt.newInstance(lm,"vtkLineIntegralConvolution2D"),extend:lm};function um(e,t){t.classHierarchy.push("vtkSurfaceLICInterface")}const dm={enableLIC:!1,nuberOfSteps:40,stepSize:.25,transformVectors:!0,normalizeVectors:!0,maskOnSurface:!1,maskThreshold:0,maskColor:[0,0,0],maskIntensity:0,enhancedLIC:!0,enhanceContrast:tm,lowLICContrastEnhancementFactor:0,highLICContrastEnhancementFactor:0,lowColorContrastEnhancementFactor:0,highColorContrastEnhancementFactor:0,antiAlias:0,colorMode:0,LICIntensity:1,mapModeBias:0,noiseTextureSize:200,noiseTextureType:am,noiseGrainSize:8,noiseImpulseProbability:.1,noiseImpulseBackgroundValue:0,noiseGeneratorSeed:0,minNoiseValue:0,maxNoiseValue:1,numberOfNoiseLevels:2,shadersNeedBuilding:!0,reallocateTextures:!0,rebuildNoiseTexture:!1,viewPortScale:1};function pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dm,n),jt.obj(e,t),jt.setGet(e,t,["enableLIC","numberOfSteps","stepSize","normalizeVectors","transformVectors","maskOnSurface","maskThreshold","maskColor","maskIntensity","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor","antiAlias","colorMode","LICIntensity","mapModeBias","noiseTextureSize","noiseTextureType","noiseGrainSize","minNoiseValue","maxNoiseValue","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","noiseGeneratorSeed","viewPortScale","rebuildNoiseTexture"]),um(0,t)}var fm={newInstance:jt.newInstance(pm,"vtkSurfaceLICInterface"),extend:pm};const{Representation:gm}=ds;function mm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICInterface"),e.renderQuad=(e,n)=>{const r=t.licQuad,o=t.context;let a=t.licQuadVAO;a||(a=md.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.licQuadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.generateNoiseTexture=e=>{if(!t.noiseTexture||t.licInterface.getRebuildNoiseTexture()){t.licInterface.setRebuildNoiseTexture(!1),t.noiseTexture&&t.noiseTexture.releaseGraphicsResources(),vo()(t.noiseGeneratorSeed,{global:!0});let n=[];const{noiseTextureType:r,noiseGrainSize:o,numberOfNoiseLevels:a,noiseImpulseProbability:i,noiseImpulseBackgroundValue:s,minNoiseValue:l,maxNoiseValue:c}=t.licInterface.get("noiseTextureType","noiseGrainSize","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","minNoiseValue","maxNoiseValue");n=r===am?function(e,t,n,r,o,a){const i=Math.max(0,Math.min(1,n)),s=Float32Array.from({length:e*e},(()=>{let e=0;if(1===i||Math.random()>1-i)for(let t=0;t<2048;++t)e+=Math.random();return e}));let l=0,c=2049;s.forEach((e=>{c=1===i?e0?e:c,l=e>l?e:l}));let u=l-c;0===u&&(c=0,u=0===l?1:l);const d=t-1,p=0!==d?1/d:0,f=a-o;return s.map((e=>{const n=e=c?1===t?a:o+(i>d?d:i)*p*f:r}))}(Math.floor(e/o),a,i,s,l,c):function(e,t,n,r){let[o,a]=e;const i=r-n;return Float32Array.from({length:o*a},(()=>{let e=Math.random();return e=Math.floor(e*t)/t,e=e*i+n,e>1?1:e<0?0:e}))}([Math.ceil(e/o),Math.ceil(e/o)],a,l,c);const u=1/o,d=Float32Array.from({length:e*e*4},((t,r)=>{const a=r/4;if(r%4==0){const t=Math.floor(a%e*u),r=Math.floor(a/e*u);return n[r*(e/o)+t]}return r%4==1||r%4==3?1:0})),p=Fd.newInstance({wrapS:Fd.Wrap.REPEAT,wrapT:Fd.Wrap.REPEAT,minificationFilter:Fd.Filter.NEAREST,magnificationFilter:Fd.Filter.NEAREST,generateMipMap:!1,openGLDataType:t.context.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});p.setOpenGLRenderWindow(t._openGLRenderWindow),p.create2DFromRaw(e,e,4,"Float32Array",d),p.activate(),p.sendParameters(),p.deactivate(),t.noiseTexture=p}},e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray($g,e,""),e.allocateTextures=()=>{const n=Fd.Filter.NEAREST,r=Fd.Filter.LINEAR,o=t._openGLRenderWindow;t.geometryImage||(t.geometryImage=e.allocateTexture(o,n)),t.vectorImage||(t.vectorImage=e.allocateTexture(o,r)),t.maskVectorImage||(t.maskVectorImage=e.allocateTexture(o,r)),t.LICImage||(t.LICImage=e.allocateTexture(o,n)),t.RGBColorImage||(t.RGBColorImage=e.allocateTexture(o,n)),t.HSLColorImage||(t.HSLColorImage=e.allocateTexture(o,n)),t.depthTexture||(t.depthTexture=e.allocateDepthTexture(o))},e.allocateTexture=(e,n)=>{const r=t.context,o=Fd.newInstance({wrapS:Fd.Wrap.CLAMP_TO_EDGE,wrapT:Fd.Wrap.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:r.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});return o.setOpenGLRenderWindow(e),o.setInternalFormat(r.RGBA32F),o.create2DFromRaw(...t.size,4,"Float32Array",null),o.activate(),o.sendParameters(),o.deactivate(),o},e.allocateDepthTexture=e=>{const n=t.context,r=Fd.newInstance({generateMipmap:!1,openGLDataType:n.FLOAT,autoParameters:!1});return r.setOpenGLRenderWindow(e),r.createDepthFromRaw(...t.size,"Float32Array",null),r.activate(),r.sendParameters(),r.deactivate(),r},e.createFBO=()=>{if(!t.framebuffer){t.licHelper=null;const e=$p.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow),e.saveCurrentBindingsAndBuffers(),e.create(...t.size),e.populateFramebuffer(),t.framebuffer=e,e.restorePreviousBindingsAndBuffers()}},e.completedGeometry=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeDepthBuffer(),e.drawBuffers([e.NONE]),n.restorePreviousBindingsAndBuffers()},e.buildAllShaders=()=>{t.shadersNeedBuilding&&(t.licColorPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader combines surface geometry, LIC, and scalar colors.\n\n// the output of this shader\nlayout(location = 0) out vec4 RGBOutput;\nlayout(location = 1) out vec4 HSLOutput;\n\nuniform sampler2D texVectors; // vectors, depth\nuniform sampler2D texGeomColors; // scalar colors + lighting\nuniform sampler2D texLIC; // image lic\nuniform int uScalarColorMode; // select between blend, and map shader\nuniform float uLICIntensity; // blend shader: blending factor for lic'd colors\nuniform float uMapBias; // map shader: adjust the brightness of the result\nuniform float uMaskIntensity; // blending factor for mask color\nuniform vec3 uMaskColor; // color for the masked out fragments\n\nin vec2 tcoordVC;\n\n/**\nConvert from RGB color space into HSL colorspace.\n*/\nvec3 RGBToHSL(vec3 RGB)\n{\n vec3 HSL = vec3(0.0, 0.0, 0.0);\n\n float RGBMin = min(min(RGB.r, RGB.g), RGB.b);\n float RGBMax = max(max(RGB.r, RGB.g), RGB.b);\n float RGBMaxMinDiff = RGBMax - RGBMin;\n\n HSL.z = (RGBMax + RGBMin) / 2.0;\n\n if (RGBMaxMinDiff == 0.0)\n {\n // Gray scale\n HSL.x = 0.0;\n HSL.y = 0.0;\n }\n else\n {\n // Color\n if (HSL.z < 0.5)\n HSL.y = RGBMaxMinDiff / (RGBMax + RGBMin);\n else\n HSL.y = RGBMaxMinDiff / (2.0 - RGBMax - RGBMin);\n\n float dR\n = (((RGBMax - RGB.r) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dG\n = (((RGBMax - RGB.g) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dB\n = (((RGBMax - RGB.b) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n\n if (RGB.r == RGBMax)\n HSL.x = dB - dG;\n else\n if (RGB.g == RGBMax)\n HSL.x = (1.0 / 3.0) + dR - dB;\n else\n if (RGB.b == RGBMax)\n HSL.x = (2.0 / 3.0) + dG - dR;\n\n if (HSL.x < 0.0)\n HSL.x += 1.0;\n\n if (HSL.x > 1.0)\n HSL.x -= 1.0;\n }\n\n return HSL;\n}\n\n/**\nHelper for HSL to RGB conversion.\n*/\nfloat Util(float v1, float v2, float vH)\n{\n if (vH < 0.0)\n vH += 1.0;\n\n if (vH > 1.0)\n vH -= 1.0;\n\n if ((6.0 * vH) < 1.0)\n return (v1 + (v2 - v1) * 6.0 * vH);\n\n if ((2.0 * vH) < 1.0)\n return (v2);\n\n if ((3.0 * vH) < 2.0)\n return (v1 + (v2 - v1) * ((2.0 / 3.0) - vH) * 6.0);\n\n return v1;\n}\n\n/**\nConvert from HSL space into RGB space.\n*/\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n if (HSL.y == 0.0)\n {\n // Gray\n RGB.r = HSL.z;\n RGB.g = HSL.z;\n RGB.b = HSL.z;\n }\n else\n {\n // Chromatic\n float v2;\n if (HSL.z < 0.5)\n v2 = HSL.z * (1.0 + HSL.y);\n else\n v2 = (HSL.z + HSL.y) - (HSL.y * HSL.z);\n\n float v1 = 2.0 * HSL.z - v2;\n\n RGB.r = Util(v1, v2, HSL.x + (1.0 / 3.0));\n RGB.g = Util(v1, v2, HSL.x);\n RGB.b = Util(v1, v2, HSL.x - (1.0 / 3.0));\n }\n\n return RGB.rgb;\n}\n\nvoid main()\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n\n // depth is used to determine which fragment belong to us\n // and we can change\n float depth = texture2D(texVectors, tcoordVC.st).a;\n\n vec3 fragColorRGB;\n float valid;\n if (depth > 1.0e-3)\n {\n // we own it\n // shade LIC'ed geometry, or apply mask\n if (lic.g!=0.0)\n {\n // it's masked\n // apply fragment mask\n fragColorRGB = uMaskIntensity * uMaskColor + (1.0 - uMaskIntensity) * geomColor.rgb;\n valid = 0.0;\n }\n else\n {\n if (uScalarColorMode==0)\n {\n // blend with scalars\n fragColorRGB = lic.rrr * uLICIntensity + geomColor.rgb * (1.0 - uLICIntensity);\n }\n else\n {\n // multiply with scalars\n fragColorRGB = geomColor.rgb * clamp((uMapBias + lic.r), 0.0, 1.0);\n }\n if (lic.b != 0.0)\n {\n // didn't have the required guard pixels\n // don't consider it in min max estimation\n // for histpgram stretching\n valid = 0.0;\n }\n else\n {\n // ok to use in min/max estimates for histogram\n // stretching\n valid = 1.0;\n }\n }\n }\n else\n {\n // we don't own it\n // pass through scalars\n fragColorRGB = geomColor.rgb;\n valid = 0.0;\n }\n\n // if no further stages this texture is\n // copied to the screen\n RGBOutput = vec4(fragColorRGB, geomColor.a);\n\n // if further stages, move to hsl space for contrast\n // enhancement. encoding validity saves moving a texture to the cpu\n vec3 fragColorHSL = RGBToHSL(fragColorRGB);\n HSLOutput = vec4(fragColorHSL, valid);\n}\n"),t.licCopyPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_DCpy.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader copies fragments and depths to the output buffer\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texDepth; // z values from vertex shader\nuniform sampler2D texRGBColors; // final rgb LIC colors\n\nin vec2 tcoordVC;\n\nvoid main()\n{\n gl_FragDepth = texture2D(texDepth, tcoordVC).x;\n gl_FragData[0] = texture2D(texRGBColors, tcoordVC);\n\n // since we render a screen aligned quad\n // we're going to be writing fragments\n // not touched by the original geometry\n // it's critical not to modify those\n // fragments.\n if (gl_FragDepth == 1.0)\n {\n discard;\n }\n}\n"),t.enhanceContrastPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// color contrast enhance stage implemented via histogram stretching\n// on lightness channel. if the min and max are tweaked it can generate\n// out-of-range values these will be clamped in 0 to 1\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texGeomColors; // scalars + lighting\nuniform sampler2D texLIC; // image lic, mask\nuniform sampler2D texHSLColors; // hsla colors\n\nuniform float uLMin; // min lightness over all fragments\nuniform float uLMaxMinDiff; // max - min lightness over all fragments\n\nin vec2 tcoordVC;\n\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n float v;\n float h = HSL.x;\n float sl = HSL.y;\n float l = HSL.z;\n\n v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);\n if (v <= 0.0) {\n RGB = vec3(0.0,0.0,0.0);\n } else {\n float m;\n int sextant;\n float fract, vsf, mid1, mid2;\n\n m = l + l - v;\n h *= 6.0;\n sextant = int(h);\n fract = h - float(sextant);\n\n vsf = (v - m) * fract;\n mid1 = m + vsf;\n mid2 = v - vsf;\n switch (sextant) {\n case 0: RGB.r = v; RGB.g = mid1; RGB.b = m; break;\n case 1: RGB.r = mid2; RGB.g = v; RGB.b = m; break;\n case 2: RGB.r = m; RGB.g = v; RGB.b = mid1; break;\n case 3: RGB.r = m; RGB.g = mid2; RGB.b = v; break;\n case 4: RGB.r = mid1; RGB.g = m; RGB.b = v; break;\n case 5: RGB.r = v; RGB.g = m; RGB.b = mid2; break;\n }\n }\n return RGB;\n}\n\nvoid main()\n{\n // lookup hsl color , mask\n vec4 fragColor = texture2D(texHSLColors, tcoordVC.st);\n\n // don't modify masked fragments (masked => lic.g==1)\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g==0.0)\n {\n // normalize lightness channel\n fragColor.z = clamp((fragColor.z - uLMin)/uLMaxMinDiff, 0.0, 1.0);\n }\n\n // back into rgb space\n fragColor.rgb = HSLToRGB(fragColor.xyz);\n\n // add alpha\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n fragColor.a = geomColor.a;\n\n gl_FragData[0] = fragColor;\n}\n"),t.shadersNeedBuilding=!1)},e.initializeResources=()=>{e.createFBO(),e.generateNoiseTexture(t.licInterface.getNoiseTextureSize()),e.allocateTextures(),e.buildAllShaders(),t.licQuad||(t.licQuad=function(e){const t=xd.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Es.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Es.newInstance({numberOfComponents:1,values:o}),s=Es.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",gm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow)),t.licHelper||(t.licHelper=cm.newInstance())},e.prepareForGeometry=()=>{const e=t.framebuffer;e.saveCurrentBindingsAndBuffers(),e.bind(),t.geometryImage.activate(),t.vectorImage.activate(),t.maskVectorImage.activate(),e.removeColorBuffer(0),e.removeColorBuffer(2),e.removeColorBuffer(3),e.setColorBuffer(t.geometryImage,0),e.setColorBuffer(t.vectorImage,2),e.setColorBuffer(t.maskVectorImage,3),e.setDepthBuffer(t.depthTexture);const n=t.context;n.drawBuffers([n.COLOR_ATTACHMENT0,n.NONE,n.COLOR_ATTACHMENT2,n.COLOR_ATTACHMENT3]),n.viewport(0,0,...t.size),n.scissor(0,0,...t.size),n.disable(n.BLEND),n.disable(n.DEPTH_TEST),n.disable(n.SCISSOR_TEST),n.clearColor(0,0,0,0),n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT)},e.copyToScreen=n=>{t.RGBColorImage.activate(),t.depthTexture.activate(),t.licCopyPass||e.initializeResources();const r=t.licCopyPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(r);const o=t.context;o.viewport(0,0,...n),o.scissor(0,0,...n),o.disable(o.BLEND),o.enable(o.DEPTH_TEST),o.disable(o.SCISSOR_TEST),r.setUniformi("texDepth",t.depthTexture.getTextureUnit()),r.setUniformi("texRGBColors",t.RGBColorImage.getTextureUnit()),e.renderQuad(n,r),t.RGBColorImage.deactivate(),t.depthTexture.deactivate()},e.combineColorsAndLIC=()=>{const n=t.context,r=t.framebuffer;r.saveCurrentBindingsAndBuffers(),r.bind(),r.create(...t.size),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(t.RGBColorImage,0),r.setColorBuffer(t.HSLColorImage,1),n.drawBuffers([n.COLOR_ATTACHMENT0,n.COLOR_ATTACHMENT1]),n.disable(n.DEPTH_TEST),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),t.vectorImage.activate(),t.geometryImage.activate(),t.LICImage.activate(),t.licColorPass||e.initializeResources();const o=t.licColorPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(o),o.setUniformi("texVectors",t.vectorImage.getTextureUnit()),o.setUniformi("texGeomColors",t.geometryImage.getTextureUnit());const{colorMode:a,LICIntensity:i,mapModeBias:s,maskIntensity:l,maskColor:c,enhanceContrast:u,lowColorContrastEnhancementFactor:d,highColorContrastEnhancementFactor:p}=t.licInterface.get("colorMode","LICIntensity","mapModeBias","maskIntensity","maskColor","enhanceContrast","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor");if(o.setUniformi("texLIC",t.LICImage.getTextureUnit()),o.setUniformi("uScalarColorMode",a),o.setUniformf("uLICIntensity",i),o.setUniformf("uMapBias",s),o.setUniformf("uMaskIntensity",l),o.setUniform3f("uMaskColor",...c),e.renderQuad(t.size,o),t.vectorImage.deactivate(),t.geometryImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE]),u===rm||u===om){let o=0,a=1,i=a-o;o+=i*d,a-=i*p,i=a-o,r.setColorBuffer(t.RGBColorImage),n.drawBuffers([n.COLOR_ATTACHMENT0]),t.geometryImage.activate(),t.HSLColorImage.activate(),t.LICImage.activate(),t.enhanceContrastPass||e.initializeResources();const{enhanceContrastPass:s}=t;t._openGLRenderWindow.getShaderCache().readyShaderProgram(s),s.setUniformi("texGeomColors",t.geometryImage.getTextureUnit()),s.setUniformi("texHSLColors",t.HSLColorImage.getTextureUnit()),s.setUniformi("texLIC",t.LICImage.getTextureUnit()),s.setUniformf("uLMin",o),s.setUniformf("uLMaxMinDiff",i),e.renderQuad(t.size,s),t.geometryImage.deactivate(),t.HSLColorImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),n.drawBuffers([n.NONE])}r.restorePreviousBindingsAndBuffers()},e.applyLIC=()=>{const e=t.licInterface.get("stepSize","numberOfSteps","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","normalizeVectors","maskThreshold","transformVectors"),n=t.licHelper.executeLIC(t.size,t.vectorImage,t.maskVectorImage,t.noiseTexture,t._openGLRenderWindow,e);if(!n)return console.error("Failed to compute image LIC"),void(t.LICImage=null);t.LICImage=n},e.setSize=n=>{Array.isArray(n)&&2===n.length&&(t.size&&t.size[0]===n[0]&&t.size[1]===n[1]||(t.size=n,e.releaseGraphicsResources()))},e.releaseGraphicsResources=()=>{t.geometryImage&&(t.geometryImage.releaseGraphicsResources(),t.geometryImage=null),t.vectorImage&&(t.vectorImage.releaseGraphicsResources(),t.vectorImage=null),t.maskVectorImage&&(t.maskVectorImage.releaseGraphicsResources(),t.maskVectorImage=null),t.LICImage&&(t.LICImage.releaseGraphicsResources(),t.LICImage=null),t.RGBColorImage&&(t.RGBColorImage.releaseGraphicsResources(),t.RGBColorImage=null),t.HSLColorImage&&(t.HSLColorImage.releaseGraphicsResources(),t.HSLColorImage=null),t.depthTexture&&(t.depthTexture.releaseGraphicsResources(),t.depthTexture=null),t.framebuffer&&(t.framebuffer.releaseGraphicsResources(),t.framebuffer=null)}}const hm={context:null,shadersNeedBuilding:!0,reallocateTextures:!0,size:null,licInterface:null};function vm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hm,n),fm.extend(e,t,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","reallocateTextures","licInterface","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),mm(e,t)}var ym={newInstance:jt.newInstance(vm,"vtkSurfaceLICInterface"),extend:vm};const{vtkErrorMacro:bm}=Kt;function xm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICMapper");const n={...e};e.getNeedToRebuildShaders=(e,r,o)=>t.rebuildLICShaders||n.getNeedToRebuildShaders(e,r,o),e.replaceShaderValues=(e,r,o)=>{const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=e.Vertex,s=e.Fragment;const l=t.renderable.getInputArrayToProcess(0);if(l&&t.canDrawLIC){s=dd.substitute(s,"//VTK::Output::Dec",["//VTK::Output::Dec","layout(location = 2) out vec4 vectorTexture;","layout(location = 3) out vec4 maskVectorTexture;"]).result;const n=`${l.getName()}MC`;0===a&&t.lastBoundBO.set({lastLightComplexity:1},!0),i=dd.substitute(i,"//VTK::TCoord::Dec",[`attribute vec3 ${n};`,"out vec3 licOutput;","//VTK::TCoord::Dec"]).result,i=dd.substitute(i,"//VTK::TCoord::Impl",[`licOutput = ${n};`,"//VTK::TCoord::Impl"]).result,s=dd.substitute(s,"//VTK::TCoord::Dec",["uniform int uMaskOnSurface;","uniform mat3 normalMatrix;","in vec3 licOutput;","//VTK::TCoord::Dec"]).result,s=dd.substitute(s,"//VTK::TCoord::Impl",["// projected vectors"," vec3 tcoordLIC = normalMatrix * licOutput;"," vec3 normN = normalize(normalVCVSOutput);"," float k = dot(tcoordLIC, normN);"," vec3 projected = (tcoordLIC - k*normN);"," vectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);","// vectors for fragment masking"," if (uMaskOnSurface == 0)"," {"," maskVectorTexture = vec4(licOutput, 1.0);"," }"," else"," {"," maskVectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);"," }","//VTK::TCoord::Impl"],!1).result,e.Vertex=i}t.rebuildLICShaders=!1,e.Fragment=s,n.replaceShaderValues(e,r,o),a>0&&t.lastBoundBO.set({lastLightComplexity:a},!0)},e.setMapperShaderParameters=(e,r,o)=>{n.setMapperShaderParameters(e,r,o),t.canDrawLIC&&e.getProgram().setUniformi("uMaskOnSurface",t.maskOnSurface)},e.getNeedToRebuildBufferObjects=(e,r)=>t.rebuildLICBuffers||n.getNeedToRebuildBufferObjects(e,r),e.buildBufferObjects=(e,r)=>{if(t.canDrawLIC){const e=t.renderable.getInputArrayToProcess(0);e&&e.getNumberOfComponents()>1&&t.renderable.setCustomShaderAttributes([e.getName()])}t.rebuildLICBuffers=!1,n.buildBufferObjects(e,r)},e.pushState=e=>{t.stateCache={[e.BLEND]:e.isEnabled(e.BLEND),[e.DEPTH_TEST]:e.isEnabled(e.DEPTH_TEST),[e.SCISSOR_TEST]:e.isEnabled(e.SCISSOR_TEST),[e.CULL_FACE]:e.isEnabled(e.CULL_FACE)}},e.popState=e=>{const n=n=>t.stateCache[n]?e.enable(n):e.disable(n);n(e.BLEND),n(e.DEPTH_TEST),n(e.SCISSOR_TEST),n(e.CULL_FACE)},e.renderPiece=(r,o)=>{let a=!0;t._openGLRenderWindow.getWebgl2()||(bm("SurfaceLICMapper Requires WebGL 2"),a=!1),t.context.getExtension("EXT_color_buffer_float")&&t.context.getExtension("OES_texture_float_linear")||(bm("SurfaceLICMapper requires the EXT_color_buffer_float and OES_texture_float_linear WebGL2 extensions."),a=!1),t.currentInput=t.renderable.getInputData(),t.currentInput||(bm("No input"),a=!1);let i=t.renderable.getLicInterface();i||(i=fm.newInstance(),t.renderable.setLicInterface(i)),t.openGLLicInterface||(t.openGLLicInterface=ym.newInstance()),i!==t.openGLLicInterface.getLicInterface()&&t.openGLLicInterface.setLicInterface(i);const s=t.renderable.getInputArrayToProcess(0);if(i.getEnableLIC()&&(!s||s.getNumberOfComponents()<2)&&(bm("No vector input array"),a=!1),i.getEnableLIC()||(a=!1),t.canDrawLIC!==a&&(t.rebuildLICShaders=!0,t.rebuildLICBuffers=!0),t.canDrawLIC=a,!a||!i.getEnableLIC())return void n.renderPiece(r,o);const l=t.context,c=o.getProperty().getBackfaceCulling(),u=o.getProperty().getFrontfaceCulling();c||u?u?(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.FRONT)):(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.BACK)):t._openGLRenderWindow.disableCullFace();const d=t._openGLRenderWindow.getSize(),p=d.map((e=>Math.round(e*i.getViewPortScale())));t.openGLLicInterface.setSize(p),t.openGLLicInterface.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLLicInterface.setContext(t.context),e.pushState(t.context),t.openGLLicInterface.initializeResources(),t.openGLLicInterface.prepareForGeometry(),e.popState(t.context),n.renderPieceStart(r,o),n.renderPieceDraw(r,o),n.renderPieceFinish(r,o),e.pushState(t.context),t.VBOBuildTime.modified(),t.openGLLicInterface.completedGeometry(),t.context.disable(t.context.CULL_FACE),t.openGLLicInterface.applyLIC(),t.openGLLicInterface.combineColorsAndLIC(),t.openGLLicInterface.copyToScreen(d),e.popState(t.context)}}const Tm={canDrawLIC:!1,rebuildLICShaders:!1,rebuildLICBuffers:!1,openGLLicInterface:null};const Cm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tm,n),op.extend(e,t,n),xm(e,t),Pt(e,t,["openGLLicInterface"])}),"vtkOpenGLSurfaceLICMapper");rn("vtkSurfaceLICMapper",Cm);const{vtkErrorMacro:Sm}=Kt;function Pm(e,t){t.classHierarchy.push("vtkOpenGLSphereMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,i=dd.substitute(i,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=dd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=dd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{if(e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)||Sm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),e.getProgram().isUniformUsed("scaleFactor")){const n=t.currentInput.getPointData();null!=t.renderable.getScaleArray()&&n.hasArray(t.renderable.getScaleArray())?e.getProgram().setUniformf("scaleFactor",t.renderable.getScaleFactor()):e.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),o.isUniformUsed("MCVCMatrix"))if(r.getIsIdentity())o.setUniformMatrix("MCVCMatrix",i.wcvc);else{const e=t.openGLActor.getKeyMatrices(),n=new Float64Array(16);b(n,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",n)}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(u=i.getArray(t.renderable.getScaleArray()).getData());let d=null,p=0,f=null;o?(p=o.getNumberOfComponents(),a.setColorOffset(0),a.setColorBOStride(4),d=o.getData(),f=new Uint8Array(3*l*4),a.getColorBO()||a.setColorBO(Yu.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow)):a.getColorBO()&&a.setColorBO(null),a.setColorComponents(p);const g=new Float32Array(5*l*3);a.setStride(20);const m=Math.cos(Mo(30));let h=0,v=0,y=0,b=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Am,n),op.extend(e,t,n),Pm(e,t)}),"vtkOpenGLSphereMapper");rn("vtkSphereMapper",Im);const{vtkErrorMacro:wm}=Kt;function Om(e,t){t.classHierarchy.push("vtkOpenGLStickMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkStickMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Sticks\n\nattribute vec4 vertexMC;\nattribute vec3 orientMC;\nattribute vec4 offsetMC;\nattribute float radiusMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying float lengthVCVSOutput;\nvarying vec3 centerVCVSOutput;\nvarying vec3 orientVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = radiusMC;\n lengthVCVSOutput = length(orientMC);\n orientVCVSOutput = normalMatrix * normalize(orientMC);\n\n // make sure it is pointing out of the screen\n if (orientVCVSOutput.z < 0.0)\n {\n orientVCVSOutput = -orientVCVSOutput;\n }\n\n // make the basis\n vec3 xbase;\n vec3 ybase;\n vec3 dir = vec3(0.0,0.0,1.0);\n if (cameraParallel == 0)\n {\n dir = normalize(-vertexVCVSOutput.xyz);\n }\n if (abs(dot(dir,orientVCVSOutput)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));\n ybase = cross(xbase,orientVCVSOutput);\n }\n else\n {\n xbase = normalize(cross(orientVCVSOutput,dir));\n ybase = cross(orientVCVSOutput,xbase);\n }\n\n vec3 offsets = offsetMC.xyz*2.0-1.0;\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +\n radiusVCVSOutput*offsets.x*xbase +\n radiusVCVSOutput*offsets.y*ybase +\n 0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,i=dd.substitute(i,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,i=dd.substitute(i,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=dd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=dd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)||wm("Error setting 'orientMC' in shader VAO.")),e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)||wm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isAttributeUsed("radiusMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)||wm("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),r.getIsIdentity())o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",i.wcvc),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",i.normalMatrix);else{const e=t.openGLActor.getKeyMatrices();if(o.isUniformUsed("MCVCMatrix")){const t=new Float64Array(16);b(t,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",t)}if(o.isUniformUsed("normalMatrix")){const t=new Float64Array(9);ve(t,i.normalMatrix,e.normalMatrix),o.setUniformMatrix3x3("normalMatrix",t)}}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=3;u+=4;let d=null,p=0;a.setColorBOStride(4),a.getColorBO()||a.setColorBO(Yu.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow),o&&(p=o.getNumberOfComponents(),a.setColorOffset(4),d=o.getData(),a.setColorBOStride(8)),a.setColorComponents(p),a.setStride(28);const f=new Float32Array(7*l*12),g=new Uint8Array(12*l*(d?8:4));let m=null,h=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(m=i.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&i.hasArray(t.renderable.getOrientationArray())?h=i.getArray(t.renderable.getOrientationArray()).getData():wm(["Error setting orientationArray.\n","You have to specify the stick orientation"]);const v=[0,1,3,0,3,2,2,3,5,2,5,4];let y=0,b=0,x=0,T=0;for(let e=0;e=4?255:0,g[T++]=v[t]>=2?255:0,g[T++]=255,b=e*p,d&&(g[T++]=d[b],g[T++]=d[b+1],g[T++]=d[b+2],g[T++]=d[b+3])}a.setElementCount(x/7),a.upload(f,Hu.ARRAY_BUFFER),a.getColorBO().upload(g,Hu.ARRAY_BUFFER),t.VBOBuildTime.modified()}}const Mm={};const Rm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mm,n),op.extend(e,t,n),Om(e,t)}),"vtkOpenGLStickMapper");rn("vtkStickMapper",Rm);const Vm=Object.create(null);function Em(e,t){Vm[e]=t}function Dm(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const Lm={};function Bm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lm,n),t.overrides=Vm,tn.extend(e,t,n),Dm(0,t)}var Nm={newInstance:jt.newInstance(Bm,"vtkWebGPUViewNodeFactory"),extend:Bm};function km(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(g(e),t.renderable.getParallelProjection()){const a=t.renderable.getParallelScale(),i=a*n,s=a,l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(c-l),f=1/(d-u);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(c+l)*p,e[13]=(d+u)*f,e[14]=r[1]/(r[1]-r[0])}else{const a=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let i,s;!0===t.renderable.getUseHorizontalViewAngle()?(i=r[0]*a,s=r[0]*a/n):(i=r[0]*a*n,s=r[0]*a);const l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(c-l),e[5]=2*r[0]/(d-u),e[12]=(l+c)/(c-l),e[13]=(u+d)/(d-u),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();d(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();x(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const a=n.getAspectRatio(),i=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,a,i,t.renderable.getWindowCenterByReference()),b(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),h(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Fm={keyMatrixTime:null,keyMatrices:null};const _m=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fm,n),Zt.extend(e,t,n),t.keyMatrixTime={},jt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},jt.setGet(e,t,["keyMatrixTime"]),km(e,t)}));function Gm(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Um,n),jt.obj(e,t),t.bindables=[],t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),jt.setGet(e,t,["label","device","arrayInformation"]),Gm(e,t)}var Wm={newInstance:jt.newInstance(zm),extend:zm};function Hm(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const jm={device:null,handle:null};function Km(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["device","handle"]),Hm(e,t)}var $m={newInstance:jt.newInstance(Km,"vtkWebGPUShaderModule"),extend:Km};function qm(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xm,n),t._shaderModules=new Map,jt.obj(e,t),jt.setGet(e,t,["device","window"]),qm(e,t)}var Zm={newInstance:jt.newInstance(Ym,"vtkWebGPUShaderCache"),extend:Ym,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let a=!1;-1!==e.search(t)&&(a=!0);let i="";r&&(i="g");const s=new RegExp(t,i),l=e.replace(s,o);return{replace:a,result:l}}};function Qm(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Jm={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function eh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jm,n),yt(e,t),t.layouts=[],t.shaderDescriptions=[],xt(e,t,["handle","pipelineDescription"]),Pt(e,t,["device","renderEncoder","topology","vertexState"]),Qm(e,t)}var th={newInstance:Et(eh,"vtkWebGPUPipeline"),extend:eh};function nh(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Zm.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Zm.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const rh={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function oh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rh,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],jt.obj(e,t),jt.setGet(e,t,["type","hash","code"]),jt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),nh(e,t)}var ah={newInstance:jt.newInstance(oh,"vtkWebGPUShaderDescription"),extend:oh};const ih={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var sh=function(e){return!e||e.length<6?0:e in ih==1?ih[e]:(et(`unknown format ${e}`),null)},lh=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(et(`unknown format ${e}`),0):t*(5-r/2)},ch=function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},uh=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void et(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;et(`unknown format ${e}`)},dh=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void et(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},ph=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},fh=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void et(`unknown format ${e}`)};function gh(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${i}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const hh={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function vh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),yt(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],Pt(e,t,["created","device","handle","indexBuffer"]),mh(e,t)}var yh={newInstance:Et(vh,"vtkWebGPUVertexInput"),extend:vh};const bh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",xh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function Th(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const a=ah.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),i=ah.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(a),s.push(i);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,c=new RegExp("//VTK::[^:]*::","g"),u=l.match(c).filter(((e,t,n)=>n.indexOf(e)===t)),d=u.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=Zm.substitute(i,"//VTK::Renderer::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");i=s.getCode(),i=Zm.substitute(i,"//VTK::Renderer::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=Zm.substitute(i,"//VTK::Mapper::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),i=s.getCode(),i=Zm.substitute(i,"//VTK::Mapper::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=th.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const Ch={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Sh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ch,n),Zt.extend(e,t,n),t.textureViews=[],t.vertexInput=yh.newInstance(),t.bindGroup=Wm.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||xh,t.vertexShaderTemplate=t.vertexShaderTemplate||bh,t.shaderReplacements=new Map,jt.get(e,t,["pipeline","vertexInput"]),jt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),Th(e,t)}var Ph={newInstance:jt.newInstance(Sh,"vtkWebGPUSimpleMapper"),extend:Sh};function Ah(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const Ih={};function wh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ih,n),Ph.extend(e,t,n),Ah(e,t)}var Oh={newInstance:jt.newInstance(wh,"vtkWebGPUFullScreenQuad"),extend:wh},Mh={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const Rh=["getMappedRange","mapAsync","unmap"];function Vh(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,a=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=a.getMappedRange(0,o);new Uint8Array(i).set(new Uint8Array(r)),a.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(a,0,t,0,o);const l=s.finish();e.queue.submit([l]),a.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Eh,n),jt.obj(e,t),jt.get(e,t,["handle","sizeInBytes","usage"]),jt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),Vh(e,t)}var Lh={newInstance:jt.newInstance(Dh),extend:Dh,...Mh};const{Representation:Bh}=ds,{PrimitiveTypes:Nh}=Mh;class kh{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let a=0;a2){for(let a=0;a{const n=e.cells,r=e.primitiveType,o=e.representation,a=e.cellOffset,i=n.getData(),s=i.length,l=function(e){switch(e){case Nh.Points:return"points";case Nh.Lines:return"lines";case Nh.Triangles:case Nh.TriangleEdges:return"polys";case Nh.TriangleStripEdges:case Nh.TriangleStrips:return"strips";default:return""}}(r),c=e.numberOfPoints,u={provokedPointIds:new Uint8Array(c),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new kh};let d=null;d=o===Bh.POINTS||r===Nh.Points?jh.anythingToPoints:o===Bh.WIREFRAME||r===Nh.Lines?jh[`${l}ToWireframe`]:jh[`${l}ToSurface`],Uh=Gh;let p=a||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$h,n),Lh.extend(e,t,n),jt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),Kh(e,t)}var Xh={newInstance:jt.newInstance(qh),extend:qh,...Mh};const{BufferUsage:Yh}=Mh,{vtkErrorMacro:Zh}=Kt,{VtkDataTypes:Qh}=Es;function Jh(e,t,n,r,o){const a={},i=e.getFlatSize();if(!i)return a;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const c=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let u,d=0;const p=at(r,i*(n+(c?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?u=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||c?3===n&&c?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case Qh.UNSIGNED_CHAR:t="uint8";break;case Qh.FLOAT:t="float32";break;case Qh.UNSIGNED_INT:t="uint32";break;case Qh.INT:t="sint32";break;case Qh.DOUBLE:t="float32";break;case Qh.UNSIGNED_SHORT:t="uint16";break;case Qh.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Zh(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Yh.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=Lh.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const nv={device:null,fullScreenQuadBuffer:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),yt(e,t),Pt(e,t,["device"]),tv(e,t)}var ov={newInstance:Et(rv),extend:rv,...Mh};const{BufferUsage:av}=ov,{vtkErrorMacro:iv}=jt;function sv(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void iv(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=ph(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:fh(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:av.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void iv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType];s[(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void iv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType],l=(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const lv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function cv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},jt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},jt.get(e,t,["bindGroupTime"]),jt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),sv(e,t)}var uv={newInstance:jt.newInstance(cv,"vtkWebGPUStorageBuffer"),extend:cv};const{BufferUsage:dv}=ov,{vtkErrorMacro:pv}=jt;function fv(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?pv(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:ph(n),offset:-1,nativeType:fh(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:dv.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void pv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];a.lastValue!==r&&(i[a.offset/i.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),a.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void pv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const gv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function mv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},jt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,jt.get(e,t,["binding","bindGroupTime"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),fv(e,t)}var hv={newInstance:jt.newInstance(mv,"vtkWebGPUUniformBuffer"),extend:mv};const{vtkDebugMacro:vv}=Kt,yv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",bv=new Float64Array(16),xv=new Float64Array(16);function Tv(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];On(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),In(r,n,o),kn(o,r,t.stabilizedCenter),Fn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(vv("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(Mo(n[t].getConeAngle())),s[l+2]=Math.cos(Mo(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",i),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var a;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=Oh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(yv);const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=Oh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(yv);const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),m(xv,r.normalMatrix),oe(bv,r.scvc,r.pcsc),oe(bv,xv,bv),t.clearFSQ.getUBO().setArray("FSQMatrix",bv),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const Cv={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const Sv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cv,n),Zt.extend(e,t,n),t.UBO=hv.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=uv.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=Wm.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=g(new Float64Array(16)),t.stabilizedTime={},yt(t.stabilizedTime,{mtime:0}),xt(e,t,["bindGroup","stabilizedTime"]),At(e,t,["stabilizedCenter"]),Pt(e,t,["renderEncoder","selector","suppressClear","UBO"]),Tv(e,t)}),"vtkWebGPURenderer");Em("vtkRenderer",Sv);const{CoordinateSystem:Pv}=Zi;function Av(e,t){t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix();t.bufferShift[0]=n[3],t.bufferShift[1]=n[7],t.bufferShift[2]=n[11];const r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Pv.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Pv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Iv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const wv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Av(e,t)}));Em("vtkActor",wv);const{CoordinateSystem:Ov}=Zi;function Mv(e,t){t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;const n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Ov.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),g(t.keyMatrices.bcwc),g(t.keyMatrices.normalMatrix),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Ov.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Rv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Vv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Mv(e,t)}));function Ev(e,t){t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Em("vtkActor2D",Vv);const Dv={};const Lv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dv,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Gu.newCubeAxesActorHelper(),Ev(e,t)}),"vtkWebGPUCubeAxesActor");Em("vtkCubeAxesActor",Lv);const{DisplayLocation:Bv}=fp;function Nv(e,t){t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(Bv.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(Bv.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(rs.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(rs.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(rs.POINTS),e.getRepresentationAsString=()=>jt.enumToString(rs,t.representation)}const kv={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:rs.SURFACE,displayLocation:Bv.FOREGROUND};function Fv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),jt.obj(e,t),jt.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation"]),jt.setGetArray(e,t,["color"],3),Nv(e,t)}var _v={newInstance:jt.newInstance(Fv,"vtkProperty2D"),extend:Fv,...fp};const{BufferUsage:Gv,PrimitiveTypes:Uv}=ov,{Representation:zv}=ds,{ScalarMode:Wv}=oc,{CoordinateSystem:Hv}=Zi,{DisplayLocation:jv}=_v,Kv="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",$v='\nstruct PBRData {\n diffuse: vec3,\n specular: vec3,\n}\n\n// Dot product with the max already in it\nfn mdot(a: vec3, b: vec3) -> f32 {\n return max(0.0, dot(a, b));\n}\n// Dot product with a max in it that does not allow for negative values\n// Physically based rendering is accurate as long as normals are accurate,\n// however this is pretty often not the case. In order to prevent negative\n// values from ruining light calculations and creating zones of zero light,\n// this remapping is used, which smoothly clamps the dot product between\n// zero and one while still maintaining a good amount of accuracy.\nfn cdot(a: vec3, b: vec3) -> f32 {\n var d: f32 = max(0.0, dot(a, b));\n d = pow((d + 1) / 2.0, 2.6);\n return d;\n}\n\n// Lambertian diffuse model\nfn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 {\n var pi: f32 = 3.14159265359; \n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5);\n return (base/pi)*NdotL;\n}\n\n// Yasuhiro Fujii improvement on the Oren-Nayar model\n// https://mimosa-pudica.net/improved-oren-nayar.html\n// p is surface color, o is roughness\nfn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 {\n var invpi: f32 = 0.31830988618; // 1/pi\n\n var o2 = o*o;\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better\n\n var NdotV: f32 = mdot(N, V);\n var LdotV: f32 = mdot(L, V);\n\n var s: f32 = LdotV - NdotL*NdotV;\n var t: f32 = mix(1, max(NdotL, NdotV), step(0, s)); // Mix with step is the equivalent of an if statement\n var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13));\n A = invpi*(1 - A);\n var B: f32 = 0.45*(o2 / (o2 + 0.09));\n B = invpi*B;\n\n return p*NdotL*(A + B*(s/t));\n}\n\n// Fresnel portion of BRDF (IOR only, simplified)\nfn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 {\n var NdotV: f32 = mdot(V, N);\n var F0: f32 = (pow((ior - 1.0), 2) + k*k) / (pow((ior + 1.0), 2) + k*k); // This takes into account the roughness, which the other one does not\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Fresnel portion of BRDF (Color ior, better)\nfn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 {\n var NdotV: f32 = mdot(V, N);\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Normal portion of BRDF\n// https://learnopengl.com/PBR/Theory\n// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2\nfn trGGX(N: vec3, H: vec3, a: f32) -> f32 {\n var pi: f32 = 3.14159265359; \n\n var a2: f32 = a*a;\n var NdotH = mdot(N, H);\n var NdotH2 = NdotH*NdotH;\n \n var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0;\n\n return a2 / max((pi*denom*denom), 0.000001);\n}\n\n// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent\nfn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 {\n var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz;\n\n var ggx1: f32 = trGGX(N + Op*s, H, a);\n var ggx2: f32 = trGGX(N - Op*s, H, a);\n return (0.5 * ggx1 + 0.5 * ggx2);\n}\n\n// Geometry portion of BRDF\nfn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 {\n var NdotX = cdot(N, X);\n return NdotX / max(0.000001, (NdotX*(1-k) + k));\n}\n\nfn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 {\n var ggx1: f32 = min(1, schlickGGX(N, V, k));\n var ggx2: f32 = min(1, schlickGGX(N, L, k));\n return ggx1*ggx2;\n}\n\n// BRDF Combination\nfn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 {\n var num: f32 = D*F*G;\n var denom: f32 = 4*cdot(V, N)*cdot(L, N);\n\n return num / max(denom, 0.000001);\n}\n\n// Different lighting calculations for different light sources\nfn calcDirectionalLight(N: vec3, V: vec3, ior: f32, roughness: f32, metallic: f32, direction: vec3, color: vec3, base: vec3) -> PBRData { \n var L: vec3 = normalize(direction); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); // Fresnel term is replaced with 1 because it is added later\n var incoming: vec3 = color;\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5);\n\n var specular: vec3 = brdf*incoming*angle;\n // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate\n // control property for the diffuse vs specular roughness\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V); \n // Stores the specular and diffuse separately to allow for finer post processing\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// TODO: find some way to reduce the number of arguments going in here\nfn calcPointLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n var incoming: vec3 = color * (1. / (dist*dist));\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights\nfn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, direction: vec3, cones: vec2, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos);\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n \n // Cones.x is the inner phi and cones.y is the outer phi\n var theta: f32 = mdot(normalize(direction), L);\n var epsilon: f32 = cones.x - cones.y;\n var intensity: f32 = (theta - cones.y) / epsilon;\n intensity = clamp(intensity, 0.0, 1.0);\n intensity /= dist*dist;\n\n var incoming: vec3 = color * intensity;\n\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// Environment mapping stuff\n// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::TCoord::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n // Temporary ambient, diffuse, and opacity\n var ambientColor: vec4 = mapperUBO.AmbientColor;\n var diffuseColor: vec4 = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n\n // This should be declared somewhere else\n var _diffuseMap: vec4 = vec4(1);\n var _roughnessMap: vec4 = vec4(1);\n var _metallicMap: vec4 = vec4(1);\n var _normalMap: vec4 = vec4(0, 0, 1, 0); // normal map was setting off the normal vector detection in fragment\n var _ambientOcclusionMap: vec4 = vec4(1);\n var _emissionMap: vec4 = vec4(0);\n\n //VTK::Color::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Normal::Impl\n\n var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0);\n\n //VTK::Light::Impl\n\n //VTK::Select::Impl\n\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n\n return output;\n}\n';function qv(e){return e.indexOf("edge")>=0}function Xv(e,t){t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=n=>{n&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==Hv.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.translucentPass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.opaquePass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.updateUBO=()=>{const n=t.WebGPUActor.getRenderable().getProperty(),r=t.UBO.getSendTime();if(e.getMTime()>r||n.getMTime()>r||t.renderable.getMTime()>r){const e=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",e.bcwc),t.UBO.setArray("BCSCMatrix",e.bcsc),t.UBO.setArray("MCWCNormals",e.normalMatrix),t.is2D){t.UBO.setValue("ZValue",t.WebGPUActor.getRenderable().getProperty().getDisplayLocation()===jv.FOREGROUND?1:0);const e=n.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setValue("SpecularIntensity",0)}else{let e=n.getAmbientColorByReference();t.UBO.setValue("AmbientIntensity",n.getAmbient()),t.UBO.setArray("AmbientColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",n.getDiffuse()),e=n.getDiffuseColorByReference(),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("Roughness",n.getRoughness()),t.UBO.setValue("BaseIOR",n.getBaseIOR()),t.UBO.setValue("Metallic",n.getMetallic()),t.UBO.setValue("NormalStrength",n.getNormalStrength()),t.UBO.setValue("Emission",n.getEmission()),t.UBO.setValue("SpecularIntensity",n.getSpecular()),e=n.getSpecularColorByReference(),t.UBO.setArray("SpecularColor",[e[0],e[1],e[2],1])}const r=n.getEdgeColorByReference?.();r&&t.UBO.setArray("EdgeColor",[r[0],r[1],r[2],1]),t.UBO.setValue("LineWidth",n.getLineWidth()),t.UBO.setValue("Opacity",n.getOpacity()),t.UBO.setValue("PropID",t.WebGPUActor.getPropID());const o=t.WebGPURenderWindow.getDevice();t.UBO.sendIfNeeded(o)}},e.haveWideLines=()=>{const e=t.WebGPUActor.getRenderable(),n=e.getProperty().getRepresentation();return!(e.getProperty().getLineWidth()<=1)&&t.primitiveType!==Uv.Verts&&(t.primitiveType!==Uv.Triangles&&t.primitiveType!==Uv.TriangleStrips||n===zv.WIREFRAME)},e.replaceShaderPosition=(n,r,o)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position"),a.hasOutput("vertexVC")||a.addOutput("vec4","vertexVC");let i=a.getCode();t.useRendererMatrix?(i=Zm.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(i=Zm.substitute(i,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(i=Zm.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(i=Zm.substitute(i,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(a.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),i=Zm.substitute(i,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),i=Zm.substitute(i,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,a.setCode(i)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,n,r)=>{const o=r.getBuffer("normalMC"),a=t.WebGPUActor.getRenderable();if(o){const e=n.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",o.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",o.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",o.getArrayInformation()[0].interpolation);let t=e.getCode();t=Zm.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);const r=n.getShaderDescription("fragment");t=r.getCode(),t=a.getProperty().getNormalTexture()?Zm.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, mapperUBO.NormalStrength);"," normal = normalize(normal);"]).result:Zm.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,r.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,n,r)=>{if(e.includes("sel"))return;const o=n.getShaderDescription("vertex");o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC");const a=t.WebGPURenderer.getRenderable(),i=n.getShaderDescription("fragment");let s=i.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||qv(e)||t.is2D||e.includes("sel"))s=Zm.substitute(s,"//VTK::Light::Impl",[" var diffuse: vec3 = diffuseColor.rgb;"," var specular: vec3 = mapperUBO.SpecularColor.rgb * mapperUBO.SpecularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, mapperUBO.Opacity);"]).result,i.setCode(s);else{const e=[" var pi: f32 = 3.14159265359;"," var fragPos: vec3 = vec3(input.vertexVC.xyz);"," var V: vec3 = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," var baseColor: vec3 = _diffuseMap.rgb * diffuseColor.rgb;"," var roughness: f32 = max(0.000001, mapperUBO.Roughness * _roughnessMap.r);"," var metallic: f32 = mapperUBO.Metallic * _metallicMap.r;"," var alpha: f32 = roughness*roughness;"," var ior: f32 = mapperUBO.BaseIOR;"," var k: f32 = alpha*alpha / 2;"," var diffuse: vec3 = vec3(0.);"," var specular: vec3 = vec3(0.);"," var emission: vec3 = _emissionMap.rgb * mapperUBO.Emission;"," {"," var i: i32 = 0;"," loop {"," if !(i < rendererUBO.LightCount) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var calculated: PBRData = calcPointLight(normal, V, fragPos, ior, roughness, metallic, pos, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Directional light"," case 1 {"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var calculated: PBRData = calcDirectionalLight(normal, V, ior, roughness, metallic, dir, color, baseColor); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Spot Light"," case 2 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var cones: vec2 = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," var calculated: PBRData = calcSpotLight(normal, V, fragPos, ior, roughness, metallic, pos, dir, cones, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," var fresnel: f32 = schlickFresnelIOR(V, normal, ior, k); // Fresnel"," fresnel = min(1, fresnel);"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," var fresnelMetallic: vec3 = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," var kS: vec3 = mix(vec3(fresnel), fresnelMetallic, metallic);"," kS = min(vec3(1), kS);"," var kD: vec3 = (1.0 - kS) * (1.0 - metallic);"," var PBR: vec3 = mapperUBO.DiffuseIntensity*kD*diffuse + kS*specular;"," PBR += emission;"," computedColor = vec4(PBR, mapperUBO.Opacity);"];a.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," var diffuseIBLCoords: vec3 = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," var diffuseCoords: vec2 = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," var VreflN: vec3 = normalize(reflect(-V, normal));"," var reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," var specularCoords: vec2 = vecToRectCoord(reflectionIBLCoords);"," var diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," var level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," var specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," var specularIBLContribution: vec3 = specularIBL.rgb*rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution*kS, 0);"," var diffuseIBLContribution: vec3 = diffuseIBL.rgb*rendererUBO.BackgroundDiffuseStrength;"," diffuseIBLContribution *= baseColor * _ambientOcclusionMap.rgb;"," computedColor += vec4(diffuseIBLContribution*kD, 0);"),s=Zm.substitute(s,"//VTK::Light::Impl",e).result,i.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,t,n)=>{if(qv(e)){const e=t.getShaderDescription("fragment");let n=e.getCode();return n=Zm.substitute(n,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,void e.setCode(n)}const r=n.getBuffer("colorVI");if(!r)return;const o=t.getShaderDescription("vertex");o.addOutput("vec4","color",r.getArrayInformation()[0].interpolation);let a=o.getCode();a=Zm.substitute(a,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,o.setCode(a);const i=t.getShaderDescription("fragment");a=i.getCode(),a=Zm.substitute(a,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,i.setCode(a)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,n,r)=>{if(!r.hasAttribute("tcoord"))return;const o=n.getShaderDescription("vertex"),a=r.getBuffer("tcoord"),i=ch(a.getArrayInformation()[0].format);let s=o.getCode();o.addOutput(`vec${i}`,"tcoordVS"),s=Zm.substitute(s,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,o.setCode(s);const l=n.getShaderDescription("fragment");s=l.getCode();const c=t.WebGPUActor.getRenderable(),u=e=>!!e&&e.getDimensionality()===i,d=[];(c.getProperty().getDiffuseTexture?.()?.getImageLoaded()||c.getTextures()[0]||t.colorTexture)&&(u(c.getProperty().getDiffuseTexture?.())||u(c.getTextures()[0])||u(t.colorTexture))&&d.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);"),c.getProperty().getRoughnessTexture?.()?.getImageLoaded()&&u(c.getProperty().getRoughnessTexture())&&d.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS);"),c.getProperty().getMetallicTexture?.()?.getImageLoaded()&&u(c.getProperty().getMetallicTexture())&&d.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS);"),c.getProperty().getNormalTexture?.()?.getImageLoaded()&&u(c.getProperty().getNormalTexture())&&d.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),c.getProperty().getAmbientOcclusionTexture?.()?.getImageLoaded()&&u(c.getProperty().getAmbientOcclusionTexture())&&d.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS);"),c.getProperty().getEmissionTexture?.()?.getImageLoaded()&&u(c.getProperty().getEmissionTexture())&&d.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),s=Zm.substitute(s,"//VTK::TCoord::Impl",d).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("fragment");let n=e.getCode();n=Zm.substitute(n,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"]).result,e.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===zv.POINTS||t===Uv.Points?Gv.Verts:t===Uv.Lines?Gv.Lines:e===zv.WIREFRAME?t===Uv.Triangles?Gv.LinesFromTriangles:Gv.LinesFromStrips:t===Uv.Triangles?Gv.Triangles:t===Uv.TriangleStrips?Gv.Strips:t===Uv.TriangleEdges?Gv.LinesFromTriangles:Gv.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case Gv.Triangles:return"triangle-list";case Gv.Verts:return"point-list";case Gv.Lines:default:return"line-list"}},e.buildVertexInput=()=>{const n=t.currentInput,r=t.cellArray,o=t.primitiveType;let a=t.WebGPUActor.getRenderable().getProperty().getRepresentation();const i=t.WebGPURenderWindow.getDevice();let s=!1;o===Uv.TriangleEdges&&(s=!0,a=zv.WIREFRAME);const l=t.vertexInput,c=n.getPoints();let u;if(r){const e={hash:`R${a}P${o}${r.getMTime()}`,usage:Gv.Index,cells:r,numberOfPoints:c.getNumberOfPoints(),primitiveType:o,representation:a};u=i.getBufferManager().getBuffer(e),l.setIndexBuffer(u)}else l.setIndexBuffer(null);if(c){const e=t.WebGPUActor.getBufferShift(t.WebGPURenderer),n={hash:`${c.getMTime()}I${u.getMTime()}${e.join()}float32x4`,usage:Gv.PointArray,format:"float32x4",dataArray:c,indexBuffer:u,shift:e,packExtra:!0},r=i.getBufferManager().getBuffer(n);l.addBuffer(r,["vertexBC"])}else l.removeBufferIfPresent("vertexBC");const d=e.getUsage(a,o);if(t._usesCellNormals=!1,t.is2D||d!==Gv.Triangles&&d!==Gv.Strips)l.removeBufferIfPresent("normalMC");else{const e=n.getPointData().getNormals(),a={format:"snorm8x4",indexBuffer:u,packExtra:!0,shift:0,scale:127};if(e){a.hash=`${e.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=e,a.usage=Gv.PointArray;const t=i.getBufferManager().getBuffer(a);l.addBuffer(t,["normalMC"])}else if(o===Uv.Triangles){t._usesCellNormals=!0,a.hash=`PFN${c.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=c,a.cells=r,a.usage=Gv.NormalsFromPoints;const e=i.getBufferManager().getBuffer(a);l.addBuffer(e,["normalMC"])}else l.removeBufferIfPresent("normalMC")}let p=!1;if(t.renderable.getScalarVisibility()){const e=t.renderable.getColorMapColors();if(e&&!s){const r=t.renderable.getScalarMode();let o=!1;r!==Wv.USE_CELL_DATA&&r!==Wv.USE_CELL_FIELD_DATA&&r!==Wv.USE_FIELD_DATA&&n.getPointData().getScalars()||r===Wv.USE_POINT_FIELD_DATA||!e||(o=!0);const a={usage:Gv.PointArray,format:"unorm8x4",hash:`${o}${e.getMTime()}I${u.getMTime()}unorm8x4`,dataArray:e,indexBuffer:u,cellData:o,cellOffset:0},s=i.getBufferManager().getBuffer(a);l.addBuffer(s,["colorVI"]),p=!0}}p||l.removeBufferIfPresent("colorVI");let f=null;if(f=t.renderable.getInterpolateScalarsBeforeMapping?.()&&t.renderable.getColorCoordinates()?t.renderable.getColorCoordinates():n.getPointData().getTCoords(),f&&!s){const e=i.getBufferManager().getBufferForPointArray(f,l.getIndexBuffer());l.addBuffer(e,["tcoord"])}else l.removeBufferIfPresent("tcoord")},e.updateTextures=()=>{const e=[],n=[],r=t.renderable.getColorTextureMap?.();r&&(t.colorTexture||(t.colorTexture=Tu.newInstance({label:"polyDataColor"})),t.colorTexture.setInputData(r),n.push(["Diffuse",t.colorTexture]));const o=t.WebGPUActor.getRenderable(),a=t.WebGPURenderer.getRenderable(),i=[];if(o.getProperty().getDiffuseTexture?.()){const e=["Diffuse",o.getProperty().getDiffuseTexture()];i.push(e)}if(o.getTextures()[0]){const e=["Diffuse",o.getTextures()[0]];i.push(e)}if(t.colorTexture){const e=["Diffuse",t.colorTexture];i.push(e)}if(o.getProperty().getRoughnessTexture?.()){const e=["Roughness",o.getProperty().getRoughnessTexture()];i.push(e)}if(o.getProperty().getMetallicTexture?.()){const e=["Metallic",o.getProperty().getMetallicTexture()];i.push(e)}if(o.getProperty().getNormalTexture?.()){const e=["Normal",o.getProperty().getNormalTexture()];i.push(e)}if(o.getProperty().getAmbientOcclusionTexture?.()){const e=["AmbientOcclusion",o.getProperty().getAmbientOcclusionTexture()];i.push(e)}if(o.getProperty().getEmissionTexture?.()){const e=["Emission",o.getProperty().getEmissionTexture()];i.push(e)}if(a.getEnvironmentTexture?.()){const e=["Environment",a.getEnvironmentTexture()];i.push(e)}for(let e=0;e=0;n--)e[n]||(t.textures.splice(n,1),t.textureViews.splice(n,1))},e.computePipelineHash=()=>{let n=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.primitiveType===Uv.TriangleEdges||t.primitiveType===Uv.TriangleStripEdges)n+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(n+="n"),t.vertexInput.hasAttribute("colorVI")&&(n+="c"),t.vertexInput.hasAttribute("tcoord")){const e=t.vertexInput.getBuffer("tcoord");n+=`t${ch(e.getArrayInformation()[0].format)}`}t.textures.length&&(n+=`tx${t.textures.length}`)}t._usesCellNormals&&(n+="cn"),t.SSBO&&(n+="ssbo"),n+=e.getHashFromUsage(t.usage),n+=t.renderEncoder.getPipelineHash(),t.pipelineHash=n},e.updateBuffers=()=>{t.primitiveType!==Uv.TriangleEdges&&t.primitiveType!==Uv.TriangleStripEdges&&e.updateTextures();const n=t.WebGPUActor.getRenderable(),r=n.getProperty().getRepresentation();t.usage=e.getUsage(r,t.primitiveType),e.buildVertexInput();const o=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(o.getSizeInBytes()/o.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){const t=n.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}const Yv={is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function Zv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yv,n),Ph.extend(e,t,n),t.fragmentShaderTemplate=$v,t.vertexShaderTemplate=Kv,t._tmpMat3=pe(new Float64Array(9)),t._tmpMat4=g(new Float64Array(16)),t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),Pt(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],Xv(e,t)}var Qv={newInstance:Et(Zv,"vtkWebGPUCellArrayMapper"),extend:Zv};const{PrimitiveTypes:Jv}=ov;function ey(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>Qv.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=Jv.Points;i<=Jv.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility())for(let a=Jv.TriangleEdges;a<=Jv.TriangleStripEdges;a++)if(r[a-2].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const i=t.primitives[a];i.setCellArray(r[a-2]),i.setCurrentInput(n),i.setCellOffset(t.primitives[a-2].getCellOffset()),i.setPrimitiveType(a),i.setRenderable(t.renderable),o.push(i)}else t.primitives[a]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}const ty={primitives:null};function ny(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ty,n),Zt.extend(e,t,n),t.primitives=[],ey(e,t)}const ry=Et(ny,"vtkWebGPUPolyDataMapper");var oy={newInstance:ry,extend:ny};Em("vtkMapper",ry);const{PrimitiveTypes:ay}=ov;function iy(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>Qv.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=ay.Points;i<=ay.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),s.setIs2D(!0),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}function sy(e){return{primitives:[],...e}}const ly=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sy(n)),Zt.extend(e,t,n),t.primitives=[],iy(e,t)}),"vtkWebGPUPolyDataMapper2D");function cy(e,t){t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Em("vtkMapper2D",ly);const uy={};const dy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uy,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Vp.newScalarBarActorHelper(),cy(e,t)}),"vtkWebGPUScalarBarActor");function py(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}Em("vtkScalarBarActor",dy);const fy={device:null,handle:null,label:null,options:null};function gy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fy,n),jt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","options"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),py(e,t)}var my={newInstance:jt.newInstance(gy),extend:gy};function hy(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=sh(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=sh(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=my.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const vy={texture:null,handle:null,sampler:null,label:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),jt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","texture"]),jt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),hy(e,t)}var by={newInstance:jt.newInstance(yy),extend:yy};const{BufferUsage:xy}=ov;function Ty(e,t){t.classHierarchy.push("vtkWebGPUTexture"),e.create=(e,n)=>{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=sh(t.format);let a=t.width*o.stride;const i=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,a=2===o.elementSize&&"float"===o.sampleType;if(a||r%256){const i=e,s=r/i.BYTES_PER_ELEMENT,l=o.elementSize,c=256*Math.floor((s*l+255)/256),u=c/l,d=jt.newTypedArray(a?"Uint16Array":i.constructor.name,u*t*n);for(let e=0;e{const e=sh(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>sh(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=by.newInstance({label:n});return o.create(e,r),o}}const Cy={device:null,handle:null,buffer:null,ready:!1,label:null};function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cy,n),jt.obj(e,t),jt.get(e,t,["handle","ready","width","height","depth","format","usage"]),jt.setGet(e,t,["device","label"]),Ty(e,t)}var Py={newInstance:jt.newInstance(Sy),extend:Sy};function Ay(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DCellArrayMapper");const n={...e};e.setGlyphInstances=e=>{t.glyphInstances=e},e.updateBuffers=()=>{n.updateBuffers(),e.setNumberOfInstances(t.glyphInstances)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),r.addBuiltinOutput("vec4","@builtin(position) Position"),r.hasOutput("vertexVC")||r.addOutput("vec3","vertexVC");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" var vertexSC: vec4 = mapperUBO.BCSCMatrix*glyphSSBO.values[input.instanceIndex].matrix*vertexBC;"," output.vertexVC = (rendererUBO.SCVCMatrix*vertexSC).xyz;"," output.Position = rendererUBO.SCPCMatrix*vertexSC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,t,r)=>{if(r.hasAttribute("normalMC")){const e=t.getShaderDescription("vertex");let n=e.getCode();n=Zm.substitute(n,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals"," * mapperUBO.MCWCNormals"," * glyphSSBO.values[input.instanceIndex].normal*normalMC).xyz);"]).result,e.setCode(n)}n.replaceShaderNormal(e,t,r)},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderColor=(e,r,o)=>{if(!t.renderable.getColorArray())return void n.replaceShaderColor(e,r,o);const a=r.getShaderDescription("vertex");a.addOutput("vec4","color");let i=a.getCode();i=Zm.substitute(i,"//VTK::Color::Impl",[" output.color = glyphSSBO.values[input.instanceIndex].color;"]).result,a.setCode(i);const s=r.getShaderDescription("fragment");i=s.getCode(),i=Zm.substitute(i,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("vertex");e.addOutput("u32","compositeID","flat");let n=e.getCode();n=Zm.substitute(n,"//VTK::Select::Impl",[" output.compositeID = input.instanceIndex;"]).result,e.setCode(n);const r=t.getShaderDescription("fragment");n=r.getCode(),n=Zm.substitute(n,"//VTK::Select::Impl",["var compositeID: u32 = input.compositeID;"]).result,r.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect)}const Iy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,{},n),Qv.extend(e,t,n),Ay(e,t)}),"vtkWebGPUGlyph3DCellArrayMapper");function wy(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DMapper"),e.createCellArrayMapper=()=>{const e=Iy();return e.setSSBO(t.SSBO),e.setRenderable(t.renderable),e},e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData(1);t.renderable.mapScalars(n,1),e.updateSSBO(),e.updateCellArrayMappers(n);for(let e=0;e{t.currentInput=t.renderable.getInputData(1),t.renderable.buildArrays();const n=t.renderable.getMatrixArray(),r=t.renderable.getNormalArray();if(t.carray=t.renderable.getColorArray(),t.numInstances=n.length/16,t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.WebGPURenderWindow=e.getFirstAncestorOfType("vtkWebGPURenderWindow");const o=t.WebGPURenderWindow.getDevice();t.SSBO.clearData(),t.SSBO.setNumberOfInstances(t.numInstances),t.SSBO.addEntry("matrix","mat4x4"),t.SSBO.addEntry("normal","mat4x4"),t.carray&&t.SSBO.addEntry("color","vec4"),t.SSBO.setAllInstancesFromArray("matrix",n),t.SSBO.setAllInstancesFromArray3x3To4x4("normal",r),t.carray&&t.SSBO.setAllInstancesFromArrayColorToFloat("color",t.carray.getData()),t.SSBO.send(o),t.glyphBOBuildTime.modified()}}}const Oy={};const My=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Oy,n),oy.extend(e,t,n),t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),t.SSBO=uv.newInstance({label:"glyphSSBO"}),wy(e,t)}),"vtkWebGPUGlyph3DMapper");Em("vtkGlyph3DMapper",My);const{SlicingMode:Ry}=ug,Vy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",Ey=new Float64Array(16),Dy=new Float64Array(16),Ly=new Float64Array(16),By=new Float64Array(4),Ny=new Float64Array(4);function ky(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();g(Ey),x(Ey,Ey,n);const a=r.getMatrix();m(Dy,a),h(Dy,Dy),b(Ey,Dy,Ey);const i=e.getWorldToIndex();b(Ey,i,Ey),h(Ly,Ey),I(Dy,[.5,.5,.5]),b(Ey,Dy,Ey);const s=e.getDimensions();g(Dy),T(Dy,Dy,[1/s[0],1/s[1],1/s[2]]),b(Ey,Dy,Ey),t.UBO.setArray("SCTCMatrix",Ey);const l=t.currentInput.getExtent(),{ijkMode:c}=t.renderable.getClosestIJKAxis();let u=t.renderable.getSlice();c!==t.renderable.getSlicingMode()&&(u=t.renderable.getSliceAtPosition(u));let d=2,p=0,f=1;c===Ry.I?(d=0,p=1,f=2):c===Ry.J&&(d=1,p=2,f=0),By[d]=u,By[p]=l[2*p]-.5,By[f]=l[2*f]-.5,By[3]=1,Gi(By,By,Ly),t.UBO.setArray("Origin",By),Ny[d]=u,Ny[p]=l[2*p+1]+.5,Ny[f]=l[2*f]-.5,Ny[3]=1,Gi(Ny,Ny,Ly),_i(Ny,Ny,By),Ny[3]=1,t.UBO.setArray("Axis1",Ny),Ny[d]=u,Ny[p]=l[2*p]-.5,Ny[f]=l[2*f+1]+.5,Ny[3]=1,Gi(Ny,Ny,Ly),_i(Ny,Ny,By),Ny[3]=1,t.UBO.setArray("Axis2",Ny);const v=[1,1,1,1],y=[0,0,0,0],C=t.textureViews[0],S=C.getTexture().getScale(),P=C.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let a=0;a<1;a++){o=n.getRGBTransferFunction(a);const i=o.getRange();o.getTable(i[0],i[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const a=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===ng.NEAREST?"nearest":"linear";t.clampSampler&&a===t.clampSampler.getOptions().minFilter||(t.clampSampler=my.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:a,magFilter:a}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let a=o.getCode();const i=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?i.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):i.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),i.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),a=Zm.substitute(a,"//VTK::Position::Impl",i).result,o.setCode(a)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();t.dimensions,a=Zm.substitute(a,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,a=Zm.substitute(a,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(a)},r.set("replaceShaderImage",e.replaceShaderImage)}const Fy={rowLength:1024};const _y=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fy,n),Oh.extend(e,t,n),e.setFragmentShaderTemplate(Vy),t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},yt(t.lutBuildTime,{mtime:0}),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},yt(t.VBOBuildTime),ky(e,t)}),"vtkWebGPUImageMapper");function Gy(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Em("vtkImageMapper",_y);const Uy={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const zy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uy,n),Zt.extend(e,t,n),t.keyMatricesTime={},yt(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},t.bufferShift=[0,0,0,0],xt(e,t,["propID","keyMatricesTime"]),Gy(e,t)}),"vtkWebGPUImageSlice");function Wy(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const a=t.renderable.getMapper().getInputData();if(!a)return;const i=a.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=i[t];for(let t=2;t<4;t++){n[1]=i[t];for(let t=0;t<2;t++){n[0]=i[t],a.indexToWorld(n,r);let c=o+3*l;e[c++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[c++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[c++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();m(t.keyMatrices.bcwc,n),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Em("vtkImageSlice",zy);const Hy={propID:void 0,keyMatricesTime:null};const jy=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hy,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),Wy(e,t)}),"vtkWebGPUVolume");function Ky(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),a=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,i=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,null)}}Em("vtkVolume",jy);const $y={};const qy=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$y,n),Zt.extend(e,t,n),Ky(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");Em("vtkPixelSpaceCallbackMapper",qy);const{BufferUsage:Xy}=ov,{vtkErrorMacro:Yy}=Kt,Zy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3 = normalize(-vertexVC.xyz);\n var base2: vec3 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n var base1: vec3 = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2 = vertexVC.xy + offsetMC;\n vertexVC = vec4(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vec4(vertexVC.xyz, 0.0);\n\n //VTK::Position::Impl\n\n return output;\n}\n";function Qy(e,t){t.classHierarchy.push("vtkWebGPUSphereMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("f32","radiusVC");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=Zm.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n var invertedDepth: f32 = 1.0;\n if (rendererUBO.cameraParallel != 0u) {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0) {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n // find the intersection\n var b: f32 = 2.0*dot(EyePos,EyeDir);\n var c: f32 = dot(EyePos,EyePos) - 1.0;\n var d: f32 = b*b - 4.0*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else {\n var t: f32 = (-b - invertedDepth*sqrt(d))*0.5;\n\n // compute the normal, for unit sphere this is just\n // the intersection point\n normal = invertedDepth*normalize(EyePos + t*EyeDir);\n // compute the intersection point in VC\n vertexVC = vec4(normal * input.radiusVC + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="spm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=n.getPoints(),o=r.getNumberOfPoints(),a=r.getData();e.setNumberOfInstances(1),e.setNumberOfVertices(3*o);const i=t.vertexInput;let s=`spm${r.getMTime()}float32x3`;if(!t.device.getBufferManager().hasBuffer(s)){const e={hash:s,usage:Xy.RawVertex,format:"float32x3"},n=new Float32Array(3*o*3);let r=0,l=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jy,n),Qv.extend(e,t,n),e.setVertexShaderTemplate(Zy),Qy(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUSphereMapper");Em("vtkSphereMapper",eb);const{BufferUsage:tb}=ov,{vtkErrorMacro:nb}=Kt,rb="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array, 12> = array, 12>(\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(-1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n vec3(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3;\n var ybase: vec3;\n var dir: vec3 = vec3(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3 = offsetsArray[vertIdx];\n\n vertexVC = vec4(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n";function ob(e,t){t.classHierarchy.push("vtkWebGPUStickMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("vec3","orientVC"),r.addOutput("f32","radiusVC"),r.addOutput("f32","lengthVC"),r.addBuiltinInput("u32","@builtin(vertex_index) vertexIndex");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=Zm.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n\n if (rendererUBO.cameraParallel != 0u)\n {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else\n {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0)\n {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n\n // rotate to new basis\n // base1, base2, orientVC\n var base1: vec3;\n if (abs(input.orientVC.z) < 0.99)\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,0.0,1.0)));\n }\n else\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,1.0,0.0)));\n }\n var base2: vec3 = cross(input.orientVC,base1);\n EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,input.orientVC));\n EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,input.orientVC));\n\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n\n // find the intersection\n var a: f32 = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n var b: f32 = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n var c: f32 = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n var d: f32 = b*b - 4.0*a*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else\n {\n var t: f32 = (-b - sqrt(d))*(0.5 / a);\n var tz: f32 = EyePos.z + t*EyeDir.z;\n var iPoint: vec3 = EyePos + t*EyeDir;\n if (abs(iPoint.z)*input.radiusVC > input.lengthVC*0.5)\n {\n // test for end cap\n var t2: f32 = (-b + sqrt(d))*(0.5 / a);\n var tz2: f32 = EyePos.z + t2*EyeDir.z;\n if (tz2*input.radiusVC > input.lengthVC*0.5 || tz*input.radiusVC < -0.5*input.lengthVC) { discard; }\n else\n {\n normal = input.orientVC;\n var t3: f32 = (input.lengthVC*0.5/input.radiusVC - EyePos.z)/EyeDir.z;\n iPoint = EyePos + t3*EyeDir;\n vertexVC = vec4(input.radiusVC*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n else\n {\n // The normal is the iPoint.xy rotated back into VC\n normal = iPoint.x*base1 + iPoint.y*base2;\n // rescale rerotate and translate\n vertexVC = vec4(input.radiusVC*(normal + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="stm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=t.device,o=n.getPoints(),a=n.getPointData(),i=o.getNumberOfPoints(),s=o.getData();e.setNumberOfInstances(i),e.setNumberOfVertices(12);const l=t.vertexInput;let c=`stm${o.getMTime()}float32x3`;if(!r.getBufferManager().hasBuffer(c)){const e={hash:c,usage:tb.RawVertex,format:"float32x3"},t=new Float32Array(3*i);let n=0,o=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ab,n),Qv.extend(e,t,n),e.setVertexShaderTemplate(rb),ob(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUStickMapper");function sb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0];const[n,r,o,a]=t,i=e.getContext("2d"),s=i.getImageData(n,r,o||e.width,a||e.height),l=gl.newInstance({type:"vtkImageData"});l.setOrigin(0,0,0),l.setSpacing(1,1,1),l.setExtent(0,(o||e.width)-1,0,(a||e.height)-1,0,0);const c=Es.newInstance({numberOfComponents:4,values:new Uint8Array(s.data.buffer)});return c.setName("scalars"),l.getPointData().setScalars(c),l}Em("vtkStickMapper",ib);var lb={canvasToImageData:sb,imageToImageData:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flipX:!1,flipY:!1,rotate:0};const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d"),{flipX:o,flipY:a,rotate:i}=t;return r.translate(n.width/2,n.height/2),r.scale(o?-1:1,a?-1:1),r.rotate(i*Math.PI/180),r.drawImage(e,-e.width/2,-e.height/2),sb(n)}};const cb={default:{defaultStyle:{fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:"white",edgeThickness:.1,edgeColor:"black",resolution:400},xMinusFaceProperty:{text:"X-",faceColor:"yellow"},xPlusFaceProperty:{text:"X+",faceColor:"yellow"},yMinusFaceProperty:{text:"Y-",faceColor:"red"},yPlusFaceProperty:{text:"Y+",faceColor:"red"},zMinusFaceProperty:{text:"Z-",faceColor:"#008000"},zPlusFaceProperty:{text:"Z+",faceColor:"#008000"}},lps:{xMinusFaceProperty:{text:"R",faceRotation:-90},xPlusFaceProperty:{text:"L",faceRotation:90},yMinusFaceProperty:{text:"A",faceRotation:0},yPlusFaceProperty:{text:"P",faceRotation:180},zMinusFaceProperty:{text:"I",faceRotation:180},zPlusFaceProperty:{text:"S",faceRotation:0}}};function ub(e,t){t.set(e)}var db={applyDefinitions:ub,applyPreset:function(e,t){return ub(cb[e],t)},registerStylePreset:function(e,t){cb[e]=t}};const pb={xPlus:0,xMinus:1,yPlus:2,yMinus:3,zPlus:4,zMinus:5};function fb(e,t){t.classHierarchy.push("vtkAnnotatedCubeActor"),t.xPlusFaceProperty={...t.xPlusFaceProperty},t.xMinusFaceProperty={...t.xMinusFaceProperty},t.yPlusFaceProperty={...t.yPlusFaceProperty},t.yMinusFaceProperty={...t.yMinusFaceProperty},t.zPlusFaceProperty={...t.zPlusFaceProperty},t.zMinusFaceProperty={...t.zMinusFaceProperty};let n=null;const r=document.createElement("canvas"),o=oc.newInstance(),a=Tu.newInstance();function i(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o&&Object.assign(t[`${n}FaceProperty`],o);const i={...t.defaultStyle,...t[`${n}FaceProperty`]};r.width=i.resolution,r.height=i.resolution;const s=r.getContext("2d");s.fillStyle=i.faceColor,s.fillRect(0,0,r.width,r.height),i.edgeThickness>0&&(s.strokeStyle=i.edgeColor,s.lineWidth=i.edgeThickness*r.width,s.strokeRect(0,0,r.width,r.height)),s.save(),s.translate(0,r.height),s.scale(1,-1),s.translate(r.width/2,r.height/2),s.rotate(-Math.PI*(i.faceRotation/180));const l=i.fontSizeScale(i.resolution);s.fillStyle=i.fontColor,s.textAlign="center",s.textBaseline="middle",s.font=`${i.fontStyle} ${l}px "${i.fontFamily}"`,s.fillText(i.text,0,0),s.restore();const c=lb.canvasToImageData(r);a.setInputData(c,pb[n]),e.modified()}function s(){n=jf.newInstance({generate3DTextureCoordinates:!0}),o.setInputConnection(n.getOutputPort()),i("xPlus"),i("xMinus"),i("yPlus"),i("yMinus"),i("zPlus"),i("zMinus")}a.setInterpolate(!0),e.setDefaultStyle=e=>{t.defaultStyle={...t.defaultStyle,...e},s()},e.setXPlusFaceProperty=e=>i("xPlus",e),e.setXMinusFaceProperty=e=>i("xMinus",e),e.setYPlusFaceProperty=e=>i("yPlus",e),e.setYMinusFaceProperty=e=>i("yMinus",e),e.setZPlusFaceProperty=e=>i("zPlus",e),e.setZMinusFaceProperty=e=>i("zMinus",e),s(),o.setInputConnection(n.getOutputPort()),e.setMapper(o),e.addTexture(a)}const gb={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:e=>e/1.8,edgeThickness:.1,edgeColor:"black",resolution:200}};function mb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gb,n),hs.extend(e,t,n),jt.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty"]),fb(e,t)}var hb={newInstance:jt.newInstance(mb,"vtkAnnotatedCubeActor"),extend:mb,Presets:db};const vb={};function yb(e){return!!vb[e]}function bb(e,t){vb[e]=t}var xb=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vb[e](t)};function Tb(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Pb({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Cb={name:"",numberOfComponents:1,size:0,dataType:"string"};function Sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Cb,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),jt.obj(e,t),jt.set(e,t,["name"]),Tb(e,t)}const Pb=jt.newInstance(Sb,"vtkStringArray");var Ab={newInstance:Pb,extend:Sb};function Ib(){const e=new ArrayBuffer(4),t=new Uint8Array(e),n=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===n[0]?"LittleEndian":2712847316===n[0]?"BigEndian":null}var wb=Ib(),Ob=function(e,t){if(t<2)return;const n=new Int8Array(e),r=n.length,o=[];for(let e=0;e(Mb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let Eb=0;function Db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const Lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?Vb():n.ref&&!n.ref.pending?new Promise(((o,a)=>{const i=Db("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);i.onreadystatechange=t=>{1===i.readyState&&(n.ref.pending=!0,1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0)),4===i.readyState&&(n.ref.pending=!1,200===i.status||0===i.status?(n.buffer=i.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(wb!==n.ref.encode&&wb&&(Rb(`Swap bytes of ${n.name}`),Ob(n.buffer,vs[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Mb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:i,e:t}))},i.responseType="string"!==n.dataType?"arraybuffer":"text",i.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Vb():new Promise(((r,o)=>{const a=Db("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Vb():new Promise(((r,o)=>{const a=Db("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(a.responseText):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=Db("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};yb("http")||bb("http",(e=>Lb));const Bb=["pointData","cellData","fieldData"],Nb={vtkDataArray:Es,vtkStringArray:Ab},kb={},Fb={vtkPolyData(e){const t=[];return t.push(e.points),["verts","lines","polys","strips"].forEach((n=>{e[n]&&t.push(e[n])})),t},vtkImageData:e=>[],vtkUnstructuredGrid(e){const t=[];return t.push(e.points),t.push(e.cells),t.push(e.cellTypes),t},vtkRectilinearGrid(e){const t=[];return t.push(e.xCoordinates),t.push(e.yCoordinates),t.push(e.zCoordinates),t}};function _b(e,t){function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=`${n.ref.id}|${n.vtkClass}`;return kb[o]?Promise.resolve(kb[o]).then((e=>{n!==e&&(Object.assign(n,e),delete n.ref)})):kb[o]=t.dataAccessHelper.fetchArray(e,t.baseURL,n,r).then((e=>(kb[o]=e,e))),Promise.resolve(kb[o])}t.classHierarchy.push("vtkHttpDataSetReader"),t.output[0]=We({vtkClass:"vtkPolyData"}),t.dataAccessHelper||(t.dataAccessHelper=xb("http")),e.updateMetadata=function(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"zip"===t.compression?new Promise(((r,o)=>{xb("http").fetchBinary(t.url).then((a=>{t.dataAccessHelper=xb("zip",{zipContent:a,callback:a=>{t.baseURL="",t.dataAccessHelper.fetchJSON(e,"index.json").then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}})}),(e=>{o(e)}))})):new Promise(((r,o)=>{t.dataAccessHelper.fetchJSON(e,t.url).then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}))},e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf("index.json")||r.fullpath){t.url=n;const e=n.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=n,t.url=`${n}/index.json`;return t.compression=r.compression,e.updateMetadata(!!r.loadData)},e.parseObject=(r,o)=>{let{loadData:a,baseUrl:i,deepCopy:s=!0}=o;i&&(t.baseURL=i);const l=s?structuredClone(r):r;return new Promise(((r,o)=>{!function(e,t,n,r,o,a,i){const s=t.enableArray;t.arrays=[],Bb.forEach((e=>{n[e]&&(n[e].arrays.map((e=>e.data)).forEach((n=>{t.arrays.push({name:n.name,enable:s,location:e,array:n,registration:n.ref.registration||"addArray"})})),n[e].arrays=[])}));const l=[],{progressCallback:c}=t,u=t.fetchGzip?"gz":null;function d(){t.dataset=We(n),i?e.loadData().then((()=>{t.output[0]=t.dataset,o(e,t.output[0])})):(t.output[0]=t.dataset,o(e,t.output[0]))}Fb[n.vtkClass](n).forEach((e=>{l.push(r(e,{compression:u,progressCallback:c}))})),l.length?Promise.all(l).then(d,(e=>{a(e)})):d()}(e,t,l,n,r,o,a)}))},e.loadData=()=>{const r=t.dataset,o=t.arrays.filter((e=>e.enable)).filter((e=>e.array.ref)).map((e=>e.array));return new Promise(((a,i)=>{const s=e=>{i(e)},l=()=>{if(o.length){const{progressCallback:e}=t,r=t.fetchGzip?"gz":null;n(o.pop(),{compression:r,progressCallback:e}).then(l,s)}else r&&(t.arrays.filter((e=>e.registration&&!e.array.ref)).forEach((e=>{const t=Nb[e.array.vtkClass].newInstance(e.array);r[`get${jt.capitalize(e.location)}`]()[e.registration](t),delete e.registration})),r.modified(),a(e,r))};l()}))},e.requestData=(e,t)=>{},e.enableArray=function(e,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.arrays.filter((t=>t.name===n&&t.location===e));1===o.length&&(o[0].enable=r)},e.isBusy=()=>!!t.requestCount}const Gb={enableArray:!0,fetchGzip:!1,arrays:[],url:null,baseURL:null,requestCount:0};function Ub(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gb,n),jt.obj(e,t),jt.get(e,t,["enableArray","fetchGzip","url","baseURL","dataAccessHelper"]),jt.set(e,t,["dataAccessHelper","progressCallback"]),jt.getArray(e,t,["arrays"]),jt.algo(e,t,0,1),jt.event(e,t,"busy"),_b(e,t),void 0===t.progressCallback&&(t.progressCallback=null)}var zb={newInstance:jt.newInstance(Ub,"vtkHttpDataSetReader"),extend:Ub};const{vtkDebugMacro:Wb}=jt;function Hb(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),a=g(new Float64Array(16)),i=g(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),c=new Float64Array(3),u=g(new Float64Array(16)),p=g(new Float64Array(16)),f=new Float64Array(3),v=new Float64Array(3);function y(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Wb("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Wb("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,y()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,a=t.viewUp,i=new Float64Array([a[0],a[1],a[2],0]);g(u);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);C(u,u,Mo(n),s),Gi(i,i,u),t.viewUp[0]=i[0],t.viewUp[1]=i[1],t.viewUp[2]=i[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;g(p),x(p,p,r),C(p,p,Mo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Dn(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.yaw=n=>{const r=t.position;g(p),x(p,p,r),C(p,p,Mo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Dn(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),a=[-o[0],-o[1],-o[2]];g(p),x(p,p,r),C(p,p,Mo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Dn(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),a=[o[0],o[1],o[2]];g(p),x(p,p,r),C(p,p,Mo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Dn(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const a=[n,r,o];Uo(t.position,a,t.position),Uo(t.focalPoint,a,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],a=[],i=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Gi(o,[...t.position,1],n),Gi(a,[...t.focalPoint,1],n),Gi(i,r,n),i[0]-=o[0],i[1]-=o[1],i[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...a.slice(0,3)),e.setViewUp(...i.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Wb("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Wb("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(d(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{d(a,e.getViewMatrix()),h(a,a),w(i,[t.distance,t.distance,t.distance]),b(a,a,i),g(t.cameraLightTransform),x(t.cameraLightTransform,a,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Hi(e[0],e[1],e[2],e[3]),n=Ui(),r=Hi(0,0,1,0);var o,a;return a=t,(o=n)[0]=-a[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],Wi(r,t,r),Wi(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),h(t,t)},e.getWorldToPhysicalMatrix=e=>{g(e);const n=[3];$o(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],m(e,e),An(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),T(e,e,s),x(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=i=>{h(a,i),Dn(s,n,a),e.computeDistance();const u=t.distance;e.setPosition(s[0],s[1],s[2]),Dn(l,r,a),wn(l,l,s),Rn(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Dn(c,o,a),wn(c,c,s),Rn(c,c),e.setViewUp(c[0],c[1],c[2]),e.setDistance(u)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(a),b(a,t,a),e.computeViewParametersFromViewMatrix(a)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(d(a,t.viewMatrix),e.computeViewParametersFromViewMatrix(a),m(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;q(a,t.position,t.focalPoint,t.viewUp),m(a,a);const e=new Float64Array(16);return d(e,a),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(g(o),t.projectionMatrix){const e=1/t.physicalScale;return An(s,e,e,e),d(o,t.projectionMatrix),T(o,o,s),m(o,o),o}g(a);const i=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*i/2,t.clippingRange[0]+(r+1)*i/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,i=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,c=(t.windowCenter[1]+1)*r;K(a,o,i,s,c,l[0],l[1]),m(a,a)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(Mo(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const i=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,c=(t.windowCenter[1]-1)*o,u=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];a[0]=2*d/(s-i),a[5]=2*d/(u-c),a[2]=(i+s)/(s-i),a[6]=(c+u)/(u-c),a[10]=-(d+p)/(p-d),a[14]=-1,a[11]=-2*d*p/(p-d),a[15]=0}}return d(o,a),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),a=e.getProjectionMatrix(t,n,r);return b(a,o,a),a},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,y()},e.setDeviceAngles=(n,r,o,a)=>{const i=[3];$o(t.physicalViewNorth,t.physicalViewUp,i);const s=g(new Float64Array(16));C(s,s,Mo(n),t.physicalViewUp),C(s,s,Mo(r),i),C(s,s,Mo(o),t.physicalViewNorth),C(s,s,Mo(-a),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),c=new Float64Array(t.physicalViewNorth);Dn(l,l,s),Dn(c,c,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(c[0],c[1],c[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const a=g(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=Mo(t),i=Ui();zi(i,[n,r,o],e),_(a,i)}const i=new Float64Array(3);Dn(i,[0,0,-1],a);const s=new Float64Array(3);Dn(s,[0,1,0],a),e.setDirectionOfProjection(...i),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],a=-n[1],i=-n[2],s=-(o*r[0]+a*r[1]+i*r[2]),l=[o*e[0]+a*e[2]+i*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const c=o*e[r]+a*e[2+n]+i*e[4+t]+s;l[0]=cl[1]?c:l[1]}return l}}const jb={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:c(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jb,n),jt.obj(e,t),jt.get(e,t,["distance"]),jt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),jt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),jt.setGetArray(e,t,["clippingRange","windowCenter"],2),jt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),Hb(e,t)}var $b={newInstance:jt.newInstance(Kb,"vtkCamera"),extend:Kb};function qb(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Dn(n,t.position,t.transformMatrix):An(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Dn(n,t.focalPoint,t.transformMatrix):An(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);kn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=Mo(t),o=Mo(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Xb={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Yb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),jt.obj(e,t),jt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),jt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),qb(e,t)}var Zb={newInstance:jt.newInstance(Yb,"vtkLight"),extend:Yb,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Qb}=jt;function Jb(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Qb("call displayToView on your view instead"),e.viewToDisplay=()=>Qb("callviewtodisplay on your view instead"),e.getSize=()=>Qb("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Qb("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const ex={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function tx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ex,n),jt.obj(e,t),jt.event(e,t,"event"),jt.setGetArray(e,t,["viewport"],4),jt.setGetArray(e,t,["background","background2"],3),Jb(e,t)}var nx={newInstance:jt.newInstance(tx,"vtkViewport"),extend:tx};const{vtkDebugMacro:rx,vtkErrorMacro:ox,vtkWarningMacro:ax}=Kt;function ix(e){return()=>ox(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function sx(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(rx("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(c())):ox("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=ix("allocateTime"),e.updateGeometry=ix("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{rx(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=$b.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Zb.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let a=e.normalizedDisplayToProjection(t,n,r);return a=e.projectionToView(a[0],a[1],a[2],o),e.viewToWorld(a[0],a[1],a[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let a=e.worldToView(t,n,r);return a=e.viewToProjection(a[0],a[1],a[2],o),e.projectionToNormalizedDisplay(a[0],a[1],a[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return ox("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o),m(o,o);const a=new Float64Array([e,n,r]);return Dn(a,a,o),a},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return ox("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);h(a,a),m(a,a);const i=new Float64Array([e,n,r]);return Dn(i,i,a),i},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return ox("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o);const a=new Float64Array([e,n,r]);return Dn(a,a,o),a},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return ox("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);m(a,a);const i=new Float64Array([e,n,r]);return Dn(i,i,a),i},e.computeVisiblePropBounds=()=>{t.allBounds[0]=Fi.INIT_BOUNDS[0],t.allBounds[1]=Fi.INIT_BOUNDS[1],t.allBounds[2]=Fi.INIT_BOUNDS[2],t.allBounds[3]=Fi.INIT_BOUNDS[3],t.allBounds[4]=Fi.INIT_BOUNDS[4],t.allBounds[5]=Fi.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(wa(t.allBounds),rx("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),a=[0,0,0];if(!Oa(r))return rx("Cannot reset camera!"),!1;let i=null;if(!e.getActiveCamera())return ox("Trying to reset non-existent camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),a[0]=(r[0]+r[1])/2,a[1]=(r[2]+r[3])/2,a[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],c=r[5]-r[4];s*=s,l*=l,c*=c;let u=s+l+c;u=0===u?1:u,u=.5*Math.sqrt(u);const d=Mo(t.activeCamera.getViewAngle()),p=u,f=u/Math.sin(.5*d),g=t.activeCamera.getViewUp();return Math.abs(Ko(g,i))>.999&&(ax("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-g[2],g[0],g[1])),t.activeCamera.setFocalPoint(a[0],a[1],a[2]),t.activeCamera.setPosition(a[0]+f*i[0],a[1]+f*i[1],a[2]+f*i[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(u),t.activeCamera.setPhysicalTranslation(-a[0],-a[1],-a[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!Oa(o))return rx("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return ox("Trying to reset clipping range of non-existent camera"),!1;const a=t.activeCamera.computeClippingRange(o);let i=0;if(t.activeCamera.getParallelProjection())i=.2*t.activeCamera.getParallelScale();else{const e=Mo(t.activeCamera.getViewAngle());i=.2*Math.tan(e/2)*a[1]}return a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const lx={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Na(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function cx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,lx,n),nx.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),xt(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),Pt(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),At(e,t,["actors","volumes","lights"]),wt(e,t,["background"],4,1),Ot(0,t,["renderWindow"]),sx(e,t)}var ux={newInstance:Et(cx,"vtkRenderer"),extend:cx};const dx=Object.create(null);function px(e,t){dx[e]=t}function fx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return dx[e]&&dx[e](t)}function gx(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fx(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const mx={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function hx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mx,n),jt.obj(e,t),jt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),jt.get(e,t,["neverRendered"]),jt.getArray(e,t,["renderers"]),jt.moveToProtected(e,t,["views"]),jt.event(e,t,"completion"),gx(e,t)}var vx={newInstance:jt.newInstance(hx,"vtkRenderWindow"),extend:hx,registerViewConstructor:px,listViewAPIs:function(){return Object.keys(dx)},newAPISpecificView:fx};const yx={Unknown:0,LeftController:1,RightController:2},bx={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var xx={Device:yx,Input:bx,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Tx,Input:Cx}=xx,{vtkWarningMacro:Sx,vtkErrorMacro:Px,normalizeWheel:Ax,vtkOnceErrorMacro:Ix}=jt,wx={ctrlKey:!1,altKey:!1,shiftKey:!1},Ox={"xr-standard":[Cx.Trigger,Cx.Grip,Cx.TrackPad,Cx.Thumbstick,Cx.A,Cx.B]},Mx=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Rx(e){e.cancelable&&e.preventDefault()}function Vx(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function Ex(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function a(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Px("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Sx("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||a(0,0),t.currentRenderer);const i=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),i=n.width/o.width,s=n.height/o.height,l={x:i*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&a(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function c(e){return e.pointerType||""}function u(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Rx),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Rx),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Rx(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Sx("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:i(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Rx(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=i(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Px(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Sx("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Px("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Sx(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const a=null==n.gripSpace?null:r.getPose(n.gripSpace,o),i=n.gamepad,s=n.handedness;if(i){i.index in t.lastGamepadValues||(t.lastGamepadValues[i.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:i(n),deviceType:c(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),u(),n.size>0||Date.now(){Rx(n);const r={...Ax(n),...s(n),position:i(n),deviceType:c(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Px(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=Vx(r);if(2===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(wx),position:i(n),deviceType:c(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=Vx(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(wx),position:i(n),deviceType:c(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=Vx(r);e.recognizeGesture("TouchEnd",t);const a={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonPressEvent(a)}else{const t=Vx(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,a=null,i=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){i=l;break}null===o&&l.getInteractive()&&(o=l),null===a&&t._view.isInViewport(e,n,l)&&(a=l)}return null===i&&(i=o),null===i&&(i=a),null==i&&(i=r[0]),i},e.render=()=>{e.isAnimating()||t.inRender||u()},Mx.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void Ix("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const a=[],i=[];Object.keys(r).forEach((e=>{a[o]=r[e],i[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y)),l=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y));let c=Ro(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),u=Ro(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),d=u-c;u=u+180>=360?u-180:u+180,c=c+180>=360?c-180:c+180,Math.abs(u-c)n&&o>a&&o>i){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(a>n&&a>i){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(i>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Dx={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Lx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dx,n),jt.obj(e,t),t._animationExtendedEnd=0,jt.event(e,t,"RenderEvent"),Mx.forEach((n=>jt.event(e,t,n))),jt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),jt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),jt.moveToProtected(e,t,["view"]),Ex(e,t)}var Bx={newInstance:jt.newInstance(Lx,"vtkRenderWindowInteractor"),extend:Lx,handledEvents:Mx,...xx};const{vtkErrorMacro:Nx,VOID:kx}=jt;function Fx(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Bx.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):kx),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Nx("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const _x={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function Gx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_x,n),jt.obj(e,t),jt.event(e,t,"InteractionEvent"),jt.event(e,t,"StartInteractionEvent"),jt.event(e,t,"EndInteractionEvent"),jt.get(e,t,["_interactor","enabled"]),jt.setGet(e,t,["priority","processEvents"]),jt.moveToProtected(e,t,["interactor"]),Fx(e,t)}var Ux={newInstance:jt.newInstance(Gx,"vtkInteractorObserver"),extend:Gx,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}};const zx={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025};var Wx={States:zx};const{States:Hx}=Wx,jx={Rotate:Hx.IS_ROTATE,Pan:Hx.IS_PAN,Spin:Hx.IS_SPIN,Dolly:Hx.IS_DOLLY,CameraPose:Hx.IS_CAMERA_POSE,WindowLevel:Hx.IS_WINDOW_LEVEL,Slice:Hx.IS_SLICE};function Kx(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(jx).forEach((n=>{jt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===Hx.IS_NONE&&(t.state=jx[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},jt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===jx[n]&&(t.state=Hx.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const $x={state:Hx.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function qx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$x,n),Ux.extend(e,t,n),Kx(e,t)}var Xx={newInstance:jt.newInstance(qx,"vtkInteractorStyle"),extend:qx,...Wx};const{States:Yx}=Wx;function Zx(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case Yx.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==yx.RightController||n.input!==bx.Trigger&&n.input!==bx.TrackPad?!n||n.pressed||n.device!==yx.RightController||n.input!==bx.Trigger&&n.input!==bx.TrackPad||t.state!==Yx.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===Yx.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case Yx.IS_DOLLY:e.endDolly();break;case Yx.IS_PAN:e.endPan();break;case Yx.IS_SPIN:e.endSpin();break;case Yx.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const a=o[2],i=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+i[0]-s[0],o[1]+i[1]-s[1],a),c=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],a),u=[];u[0]=c[0]-l[0],u[1]=c[1]-l[1],u[2]=c[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(u[0]+o[0],u[1]+o[1],u[2]+o[2]),r.setPosition(u[0]+d[0],u[1]+d[1],u[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,a=n.y-t.previousPosition.y,i=r.getView().getViewportSize(e);let s=-.1,l=-.1;i[0]&&i[1]&&(s=-20/i[1],l=-20/i[0]);const c=o*l*t.motionFactor,u=a*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(c)||Number.isNaN(u)||(d.azimuth(c),d.elevation(u),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),a=r.getView().getViewportCenter(e),i=Ro(Math.atan2(t.previousPosition.y-a[1],t.previousPosition.x-a[0])),s=Ro(Math.atan2(n.y-a[1],n.x-a[0]))-i;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let a=o.getFocalPoint();a=e.computeWorldToDisplay(n,a[0],a[1],a[2]);const i=a[2],s=e.computeDisplayToWorld(n,r.x,r.y,i),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,i),c=[];c[0]=l[0]-s[0],c[1]=l[1]-s[1],c[2]=l[2]-s[2],a=o.getFocalPoint();const u=o.getPosition();o.setFocalPoint(c[0]+a[0],c[1]+a[1],c[2]+a[2]),o.setPosition(c[0]+u[0],c[1]+u[1],c[2]+u[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,a=t._interactor.getView().getViewportCenter(n),i=t.motionFactor*o/a[1];e.dollyByFactor(n,1.1**i)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const Qx={motionFactor:10,zoomFactor:10};function Jx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qx,n),Xx.extend(e,t,n),jt.setGet(e,t,["motionFactor","zoomFactor"]),Zx(e,t)}var eT={newInstance:jt.newInstance(Jx,"vtkInteractorStyleTrackballCamera"),extend:Jx};function tT(e){return e}function nT(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>nT(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var rT=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?nT:tT,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n};function oT(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${jt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}const aT={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function iT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,aT,n),jt.obj(e,t),jt.get(e,t,["currentOperation"]),jt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),jt.moveToProtected(e,t,["currentParent"]),oT(e,t)}var sT={newInstance:jt.newInstance(iT,"vtkRenderPass"),extend:iT};const{Representation:lT}=ds,{vtkErrorMacro:cT}=jt;function uT(e){const t=dd.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function dT(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Es.newInstance({numberOfComponents:3,values:e});o.setName("points");const a=Es.newInstance({numberOfComponents:2,values:n});a.setName("tcoords");const i=Es.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",lT.SURFACE,{points:o,tcoords:a,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=$p.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=Fd.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=Fd.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=Fd.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||cT("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||cT("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const a=n.getSize(),i=n.getContext();if(t._supported=!1,r.getSelector()||!i||!n.getWebgl2()||!i.getExtension("EXT_color_buffer_half_float")&&!i.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==a[0]||r[1]!==a[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}i.drawBuffers([i.COLOR_ATTACHMENT0]),i.clearBufferfv(i.COLOR,0,[0,0,0,0]),i.clearBufferfv(i.DEPTH,0,[1]),i.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),i.colorMask(!0,!0,!0,!0),i.drawBuffers([i.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1]),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),i.clearBufferfv(i.COLOR,0,[0,0,0,1]),i.clearBufferfv(i.COLOR,1,[0,0,0,0]),i.enable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFuncSeparate(i.ONE,i.ONE,i.ZERO,i.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),i.drawBuffers([i.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=md.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?uT:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const pT={framebuffer:null,copyShader:null,tris:null};function fT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pT,n),sT.extend(e,t,n),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),t.tris=xd.newInstance(),jt.get(e,t,["framebuffer"]),dT(e,t)}var gT={newInstance:jt.newInstance(fT,"vtkOpenGLOrderIndependentTranslucentPass"),extend:fT};function mT(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=$p.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),i.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),i.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),i.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=gT.newInstance()),t.translucentPass.traverse(n,i,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),i.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),i.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const hT={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function vT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hT,n),sT.extend(e,t,n),jt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),mT(e,t)}var yT={newInstance:jt.newInstance(vT,"vtkForwardPass"),extend:vT},bT=n(594),xT=n.n(bT);const TT=["lastShaderProgramBound","context","_openGLRenderWindow"];function CT(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=dd.substitute(o,"VSOut","GSOut").result);const a=t._openGLRenderWindow.getWebgl2();let i="\n",s="#version 100\n";a?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(i="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(i+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=dd.substitute(o,"//VTK::System::Dec",[`${s}\n`,a?"":"#extension GL_OES_standard_derivatives : enable\n",i,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=dd.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(a){l=dd.substitute(l,"varying","out").result,o=dd.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=dd.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=dd.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:dd.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),a=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(a)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,a=xT().hash(o);if(!(a in t.shaderPrograms)){const o=dd.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(a),t.shaderPrograms[a]=o,o}return t.shaderPrograms[a]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const ST={lastShaderProgramBound:null,shaderPrograms:null,context:null};function PT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ST,n),t.shaderPrograms={},jt.obj(e,t),jt.setGet(e,t,TT),jt.moveToProtected(e,t,["openGLRenderWindow"]),CT(e,t)}var AT={newInstance:jt.newInstance(PT,"vtkShaderCache"),extend:PT};const{vtkErrorMacro:IT}=jt;function wT(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OT,n),jt.obj(e,t),t.textureUnits=[],jt.get(e,t,["numberOfTextureUnits"]),jt.setGet(e,t,["context"]),wT(e,t)}var RT={newInstance:jt.newInstance(MT,"vtkOpenGLTextureUnitManager"),extend:MT};function VT(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),a=e.getFramebufferSize();return o[0]*a[0]<=t&&o[2]*a[0]>=t&&o[1]*a[1]<=n&&o[3]*a[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const a=o.worldToView(t,n,r),i=e.getViewportSize(o),s=o.viewToProjection(a[0],a[1],a[2],i[0]/i[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const a=e.displayToNormalizedDisplay(t,n,r),i=o.normalizedDisplayToProjection(a[0],a[1],a[2]),s=e.getViewportSize(o),l=o.projectionToView(i[0],i[1],i[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=e.normalizedDisplayToDisplay(t,n,r);return[i[0]-a[0]-.5,i[1]-a[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return a&&0!==a[0]&&0!==a[1]?[t/(a[0]-1),n/(a[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return[t*(a[0]-1),n*(a[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=t+a[0]+.5,s=n+a[1]+.5;return e.displayToNormalizedDisplay(i,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{jt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{jt.vtkErrorMacro("not implemented")},e.createSelector=()=>{jt.vtkErrorMacro("not implemented")}}const ET={size:void 0,selector:void 0};function DT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ET,n),t.size||(t.size=[300,300]),jt.getArray(e,t,["size"],2),jt.get(e,t,["selector"]),Zt.extend(e,t,n),VT(e,t)}var LT={newInstance:jt.newInstance(DT,"vtkRenderWindowViewNode"),extend:DT};const{vtkDebugMacro:BT,vtkErrorMacro:NT}=jt,kT={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function FT(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),a===e.FRAMEBUFFER_COMPLETE}let _T=0;const GT=[];function UT(){_T++,GT.forEach((e=>e(_T)))}function zT(){_T--,GT.forEach((e=>e(_T)))}function WT(e){e.preventDefault()}function HT(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(a=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(a,r[0]),t.apply(n,r))}));var a},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const a=n[t];return a?a(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",WT,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=RT.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&NT("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const a=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,a),a},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,BT("using webgl2"))),r||(BT("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=sT.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?NT("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case ys.CHAR:case ys.SIGNED_CHAR:case ys.UNSIGNED_CHAR:return 1;case n:case r:case ys.UNSIGNED_SHORT:case ys.SHORT:case ys.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case ys.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&ys.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&ys.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=kT,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),a=n.getExtension("WEBGL_debug_renderer_info"),i=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&FT(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&FT(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&FT(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&FT(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&FT(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&FT(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&FT(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&FT(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&FT(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&FT(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&FT(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&FT(n,n.RGB,n.FLOAT)?"RGB":"",r&&FT(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&FT(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&FT(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",i?n.getParameter(i.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",a&&n.getParameter(a.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",a&&n.getParameter(a.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],c={};for(;l.length;){const[e,t,n]=l.pop();t&&(c[t]={label:e,value:n})}return t._glInformation=c,c},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const a=t.canvas.getBoundingClientRect(),i=t.renderable;i.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=gf.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=jt.chain((function(){t.canvas.removeEventListener("webglcontextlost",WT),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,zT),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const a=e.setSize;e.setSize=(t,n)=>{const r=a(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const jT={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const KT=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jT,n),LT.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",UT(),t.selector||(t.selector=gf.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=ln.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",KT),t.shaderCache=AT.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=yT.newInstance(),jt.event(e,t,"imageReady"),jt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),jt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),HT(e,t)}),"vtkOpenGLRenderWindow");px("WebGL",KT);const $T=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function qT(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),a=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==a&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${a}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XT,n),yt(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],xt(e,t,["boundPipeline","colorTextureViews"]),Pt(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),qT(e,t)}var ZT={newInstance:Et(YT,"vtkWebGPURenderEncoder"),extend:YT};function QT(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=Py.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=Py.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(a)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=ZT.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const JT={renderEncoder:null,colorTexture:null,depthTexture:null};function eC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JT,n),sT.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),QT(e,t)}var tC={newInstance:jt.newInstance(eC,"vtkWebGPUOpaquePass"),extend:eC};function nC(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=Py.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=Py.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const a=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,a),t.fullScreenQuad=Oh.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=ZT.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=ZT.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const rC={colorTextureView:null,depthTextureView:null};function oC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rC,n),sT.extend(e,t,n),jt.setGet(e,t,["colorTextureView","depthTextureView"]),nC(e,t)}var aC={newInstance:jt.newInstance(oC,"vtkWebGPUOrderIndependentTranslucentPass"),extend:oC};const iC="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",sC=new Float64Array(16),lC=new Float64Array(16);function cC(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();const i=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));a=Zm.substitute(a,"//VTK::Volume::CompositeCalls",i).result,a=Zm.substitute(a,"//VTK::Volume::TraverseCalls",s).result,a=Zm.substitute(a,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",a),t.SSBO.setAllInstancesFromArray("planeNormals",i),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",c),t.SSBO.setAllInstancesFromArray("ipScalarRange",u),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),f=new Float64Array(t.numRows),v=new Float64Array(t.numRows),y=new Float64Array(t.numRows),C=new Float64Array(t.numRows),S=new Float64Array(t.numRows),P=new Float64Array(t.numRows);let A=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const uC={volumes:null,rowLength:1024,lastVolumeLength:0};function dC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uC,n),Oh.extend(e,t,n),t.fragmentShaderTemplate=iC,t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=uv.newInstance({label:"volumeSSBO"}),t.componentSSBO=uv.newInstance({label:"componentSSBO"}),t.lutBuildTime={},jt.obj(t.lutBuildTime,{mtime:0}),cC(e,t)}var pC={newInstance:jt.newInstance(dC,"vtkWebGPUVolumePassFSQ"),extend:dC};const{Representation:fC}=ds,{BufferUsage:gC,PrimitiveTypes:mC}=ov,hC=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],vC="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function yC(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=pC.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=Oh.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=hv.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),a=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>a){const o=n.getRenderable().getActiveCamera().getPosition(),i=[];for(let e=0;ei[t]-i[e]));let l=[],c=s.length%a;for(let o=0;o=c&&(e.rayCastPass(r,n,l),l=[],c=a,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=jt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let a=t._colorTextureView.getTexture().getWidth(),i=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),a=t._smallViewportWidth,i=t._smallViewportHeight}o.getHandle().setViewport(0,0,a,i,0,1),o.getHandle().setScissorRect(0,0,a,i),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,a=o.getPoints(),i=o.getPolys();let s={hash:`vp${i.getMTime()}`,usage:gC.Index,cells:i,numberOfPoints:a.getNumberOfPoints(),primitiveType:mC.Triangles,representation:fC.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:gC.PointArray,format:"float32x4",hash:`vp${a.getMTime()}${i.getMTime()}`,dataArray:a,indexBuffer:l,packExtra:!0};const c=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(c,["vertexBC"]),t._mapper.setNumberOfVertices(c.getSizeInBytes()/c.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=ZT.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=Py.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=Py.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=Py.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=ZT.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=ZT.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=ZT.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bC,n),sT.extend(e,t,n),t._mapper=Ph.newInstance(),t._mapper.setFragmentShaderTemplate(vC),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=hu.newInstance(),t._lastMTimes=[],jt.setGet(e,t,["colorTextureView","depthTextureView"]),yC(e,t)}var TC={newInstance:jt.newInstance(xC,"vtkWebGPUVolumePass"),extend:xC};function CC(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=tC.newInstance());const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=aC.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(i,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=TC.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(i,n)),e.finalPass(n,i))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=ZT.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=my.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=Oh.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=by.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const SC={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function PC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,SC,n),sT.extend(e,t,n),jt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),CC(e,t)}var AC={newInstance:jt.newInstance(PC,"vtkForwardPass"),extend:PC};const{VtkDataTypes:IC}=Es;function wC(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case IC.UNSIGNED_CHAR:e.format+="8unorm";break;case IC.FLOAT:case IC.UNSIGNED_INT:case IC.INT:case IC.DOUBLE:case IC.UNSIGNED_SHORT:case IC.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=Py.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const OC={handle:null,device:null};function MC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OC,n),jt.obj(e,t),jt.setGet(e,t,["device"]),wC(e,t)}var RC={newInstance:jt.newInstance(MC),extend:MC};class VC extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function EC(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DC,n),yt(e,t),Pt(e,t,["handle"]),xt(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new VC,t.shaderCache=Zm.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=ov.newInstance(),t.bufferManager.setDevice(e),t.textureManager=RC.newInstance(),t.textureManager.setDevice(e),t.pipelines={},EC(e,t)}var BC={newInstance:Et(LC,"vtkWebGPUDevice"),extend:LC};function NC(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=Py.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=Py.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(a)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=ZT.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const kC={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function FC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kC,n),sT.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),NC(e,t)}var _C={newInstance:jt.newInstance(FC,"vtkWebGPUHardwareSelectionPass"),extend:FC};const{SelectionContent:GC,SelectionField:UC}=Zp,{FieldAssociations:zC}=al,{vtkErrorMacro:WC}=jt;function HC(e){return`${e.propID} ${e.compositeID}`}function jC(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function KC(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=jC(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let a=jC(t[0],t[1],e,1);if((a<0||a>16777215)&&(a=0),o.compositeID=a,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const a=[t[0],t[1]],i=[0,0];let s=KC(e,t,0,r);if(s)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=KC(e,i,0,r),s))return s;if(i[0]=a[0]+t,s=KC(e,i,0,r),s)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=KC(e,i,0,r),s))return s;if(i[1]=a[1]+t,s=KC(e,i,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function $C(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return WC("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),a=t._selectionPass.getColorTexture(),i=t._selectionPass.getDepthTexture(),s={area:[0,0,a.getWidth()-1,a.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:a.getWidth(),height:a.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=Lh.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const c=t._WebGPURenderWindow.getCommandEncoder();let u;c.copyTextureToBuffer({texture:a.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),u=Lh.newInstance({label:"hardwareSelectDepthBuffer"}),u.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,u.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),c.copyTextureToBuffer({texture:i.getHandle(),aspect:"depth-only"},{buffer:u.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(c);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=u.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(u.getMappedRange().slice()),u.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=KC(e,[n,t],0,u);if(r){const t=HC(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const i=Zp.newInstance();switch(i.setContentType(GC.INDICES),e){case zC.FIELD_ASSOCIATION_CELLS:i.setFieldType(UC.CELL);break;case zC.FIELD_ASSOCIATION_POINTS:i.setFieldType(UC.POINT);break;default:WC("Unknown field association")}i.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);i.getProperties().prop=s.getRenderable(),i.getProperties().compositeID=t.info.compositeID,i.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(i.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],i.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),i.setSelectionList(t.attributeIDs),r[o]=i,o++})),r}(e.fieldAssociation,c,e)}(s,e,t,n,r),s}}const qC={};function XC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qC,n),Wp.extend(e,t,n),t._selectionPass=_C.newInstance(),jt.setGet(e,t,["_WebGPURenderWindow"]),jt.moveToProtected(e,t,["WebGPURenderWindow"]),$C(e,t)}var YC={newInstance:jt.newInstance(XC,"vtkWebGPUHardwareSelector"),extend:XC};const{vtkErrorMacro:ZC}=jt,QC={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function JC(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ZC("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ZC("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=BC.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=sT.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=QC,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const a=await e.getPixelsAsync(),i=new ImageData(a.colorValues,a.width,a.height);o.putImageData(i,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=Lh.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const a=t.device.createCommandEncoder();a.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(a);const i=o.mapAsync(GPUMapMode.READ);await i,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=YC.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=jt.chain(e.delete,e.setViewStream)}const eS={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const tS=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eS,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",LT.extend(e,t,n),t.myFactory=Nm.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",tS),t.renderPasses[0]=AC.newInstance(),t.selector||(t.selector=YC.newInstance(),t.selector.setWebGPURenderWindow(e)),jt.event(e,t,"imageReady"),jt.event(e,t,"initialized"),jt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),jt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),JC(e,t)}),"vtkWebGPURenderWindow");px("WebGPU",tS);const nS=rT();function rS(e,t){const n=e.invokeResize;delete e.invokeResize,t.renderWindow=vx.newInstance(),t.renderer=ux.newInstance(),t.renderWindow.addRenderer(t.renderer),t._apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(nS.viewAPI??t.defaultViewAPI),t.renderWindow.addView(t._apiSpecificRenderWindow),t.interactor=Bx.newInstance(),t.interactor.setInteractorStyle(eT.newInstance()),t.interactor.setView(t._apiSpecificRenderWindow),t.interactor.initialize(),e.setBackground=t.renderer.setBackground,e.setBackground(...t.background),e.resize=()=>{if(t.container){const e=t.container.getBoundingClientRect(),r=window.devicePixelRatio||1;t._apiSpecificRenderWindow.setSize(Math.floor(e.width*r),Math.floor(e.height*r)),n(),t.renderWindow.render()}},e.setContainer=e=>{t.container&&t.interactor.unbindEvents(t.container),t.container=e,t._apiSpecificRenderWindow.setContainer(t.container),t.container&&t.interactor.bindEvents(t.container)},e.delete=jt.chain(e.setContainer,t._apiSpecificRenderWindow.delete,e.delete),t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const oS={background:[.32,.34,.43],listenWindowResize:!0,container:null};function aS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oS,n),jt.obj(e,t),jt.get(e,t,["renderWindow","renderer","_apiSpecificRenderWindow","interactor","container"]),jt.moveToProtected(e,t,["_apiSpecificRenderWindow"]),jt.event(e,t,"resize"),rS(e,t)}var iS={newInstance:jt.newInstance(aS),extend:aS};function sS(e,t){t.classHierarchy.push("vtkAbstractImageMapper"),e.getIsOpaque=()=>!0,e.getCurrentImage=()=>null,e.getBoundsForSlice=()=>(jt.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),Na())}const lS={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1]};var cS=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lS,n),Fs(e,t,n),jt.setGet(e,t,["slice","useCustomExtents"]),jt.setGetArray(e,t,["customDisplayExtent"],6),jt.setGetArray(e,t,["backgroundColor"],4),sS(e,t)};function uS(e,t,n){const r=n.getCurrentImage(),o=r.getExtent(),a=[o[0],o[2],o[4]],{ijkMode:i}=n.getClosestIJKAxis();let s=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();i!==n.getSlicingMode()&&(s=n.getSliceAtPosition(s)),a[i]+=s;const l=[0,0,0];r.indexToWorld(a,l),a[i]+=1;const c=[0,0,0];r.indexToWorld(a,c),c[0]-=l[0],c[1]-=l[1],c[2]-=l[2],Rn(c,c);const u=ei.intersectWithLine(e,t,l,c);if(u.intersection){const e=u.x,t=[0,0,0];return r.worldToIndex(e,t),{t:u.t,absoluteIJK:t}}return null}const{staticOffsetAPI:dS,otherStaticMethods:pS}=Wl,{SlicingMode:fS}=ug;function gS(e,t){function n(){let n;switch(t.slicingMode){case fS.X:n=0;break;case fS.Y:n=1;break;case fS.Z:n=2;break;default:return void(t.closestIJKAxis={ijkMode:t.slicingMode,flip:!1})}const r=ka(e.getCurrentImage().getDirection());let o=0;for(;o<3&&0===r[n+3*o];++o);const a=r[n+3*o]<0;t.closestIJKAxis={ijkMode:o,flip:a}}t.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=n=>{const r=e.getCurrentImage();let o;if(3===n.length)o=n;else if(Number.isFinite(n)){const e=r.getBounds();switch(t.slicingMode){case fS.X:o=[n,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case fS.Y:o=[(e[1]+e[0])/2,n,(e[5]+e[4])/2];break;case fS.Z:o=[(e[1]+e[0])/2,(e[3]+e[2])/2,n]}}const a=[0,0,0];r.worldToIndex(o,a);const i=r.getExtent(),{ijkMode:s}=e.getClosestIJKAxis();let l=0;switch(s){case fS.I:l=Ma(a[0],i[0],i[1]);break;case fS.J:l=Ma(a[1],i[2],i[3]);break;case fS.K:l=Ma(a[2],i[4],i[5]);break;default:return 0}return l},e.setSliceFromCamera=n=>{const r=n.getFocalPoint();switch(t.slicingMode){case fS.I:case fS.J:case fS.K:{const t=e.getSliceAtPosition(r);e.setSlice(t)}break;case fS.X:e.setSlice(r[0]);break;case fS.Y:e.setSlice(r[1]);break;case fS.Z:e.setSlice(r[2])}},e.setXSlice=t=>{e.setSlicingMode(fS.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(fS.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(fS.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(fS.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(fS.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(fS.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{const n=[0,0,0],r=e.getCurrentImage().getDirection();switch(t.slicingMode){case fS.X:n[0]=1;break;case fS.Y:n[1]=1;break;case fS.Z:n[2]=1;break;case fS.I:na(r,[1,0,0],n);break;case fS.J:na(r,[0,1,0],n);break;case fS.K:na(r,[0,0,1],n)}return n},e.setSlicingMode=r=>{t.slicingMode!==r&&(t.slicingMode=r,e.getCurrentImage()&&n(),e.modified())},e.getClosestIJKAxis=()=>(void 0!==t.closestIJKAxis&&t.closestIJKAxis.ijkMode!==fS.NONE||!e.getCurrentImage()||n(),t.closestIJKAxis),e.getBounds=()=>{const n=e.getCurrentImage();if(!n)return Na();if(!t.useCustomExtents)return n.getBounds();const r=t.customDisplayExtent.slice(),{ijkMode:o}=e.getClosestIJKAxis();let a=t.slice;switch(o!==t.slicingMode&&(a=e.getSliceAtPosition(t.slice)),o){case fS.I:r[0]=a,r[1]=a;break;case fS.J:r[2]=a,r[3]=a;break;case fS.K:r[4]=a,r[5]=a}return n.extentToBounds(r)},e.getBoundsForSlice=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slice,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.getCurrentImage();if(!o)return Na();const a=o.getSpatialExtent(),{ijkMode:i}=e.getClosestIJKAxis();let s=n;switch(i!==t.slicingMode&&(s=e.getSliceAtPosition(n)),i){case fS.I:a[0]=s-r,a[1]=s+r;break;case fS.J:a[2]=s-r,a[3]=s+r;break;case fS.K:a[4]=s-r,a[5]=s+r}return o.extentToBounds(a)},e.intersectWithLineForPointPicking=(t,n)=>function(e,t,n){const r=uS(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return t[0]e[1]||t[1]e[3]||t[2]e[5]?null:{t:r.t,ijk:t}}return null}(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>function(e,t,n){const r=uS(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=r.absoluteIJK,o=[Math.floor(t[0]),Math.floor(t[1]),Math.floor(t[2])];if(o[0]e[1]-1||o[1]e[3]-1||o[2](e[5]?e[5]-1:e[5]))return null;const a=[t[0]-o[0],t[1]-o[1],t[2]-o[2]];return{t:r.t,ijk:o,pCoords:a}}return null}(t,n,e),e.getCurrentImage=()=>e.getInputData()}const mS={slicingMode:fS.NONE,closestIJKAxis:{ijkMode:fS.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function hS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mS,n),cS(e,t,n),jt.get(e,t,["slicingMode"]),jt.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),Wl.implementCoincidentTopologyMethods(e,t),gS(e,t)}var vS={newInstance:jt.newInstance(hS,"vtkImageMapper"),extend:hS,...dS,...pS,...ug};const yS={CLAMP:0,REPEAT:1,MIRROR:2},bS={NEAREST:0,LINEAR:1,CUBIC:2};var xS={ImageBorderMode:yS,InterpolationMode:bS};const TS={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:yS.CLAMP,interpolationMode:bS.LINEAR,extraInfo:null},CS={...TS,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function SS(e){const t=Math.floor(e);return{floored:t,error:e-t}}function PS(e){return Math.round(e)}function AS(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function IS(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function wS(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let a=e-t;return a=a>=0?a:-a,a%=o,a=a<=r?a:o-a,a}const{ImageBorderMode:OS}=xS;function MS(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,a=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,a)}const i=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*i,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let c=t.componentOffset;c=c>0?c:0,c=c{},e.interpolateXYZ=(n,r,o,a)=>{let i=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=a>0?a:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,a)=>{}}const RS={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:OS.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...TS},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function VS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,RS,n),jt.obj(e,t),jt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),jt.get(e,t,["origin","spacing"]),MS(e,t)}var ES={newInstance:jt.newInstance(VS,"vtkAbstractImageInterpolator"),extend:VS,...xS};function DS(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===bS.LINEAR?n=2:t.interpolationMode===bS.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,a=e.numberOfComponents;let i=PS(t[0]),s=PS(t[1]),l=PS(t[2]);switch(e.borderMode){case yS.REPEAT:i=IS(i,r[0],r[1]),s=IS(s,r[2],r[3]),l=IS(l,r[4],r[5]);break;case yS.MIRROR:i=wS(i,r[0],r[1]),s=wS(s,r[2],r[3]),l=wS(l,r[4],r[5]);break;default:i=AS(i,r[0],r[1]),s=AS(s,r[2],r[3]),l=AS(l,r[4],r[5])}const c=i*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,a=e.numberOfComponents,i=SS(t[0]),s=SS(t[1]),l=SS(t[2]);let c=i.floored,u=s.floored,d=l.floored;const p=i.error,f=s.error,g=l.error;let m=c+(0!==p),h=u+(0!==f),v=d+(0!==g);switch(e.borderMode){case yS.REPEAT:c=IS(c,r[0],r[1]),u=IS(u,r[2],r[3]),d=IS(d,r[4],r[5]),m=IS(m,r[0],r[1]),h=IS(h,r[2],r[3]),v=IS(v,r[4],r[5]);break;case yS.MIRROR:c=wS(c,r[0],r[1]),u=wS(u,r[2],r[3]),d=wS(d,r[4],r[5]),m=wS(m,r[0],r[1]),h=wS(h,r[2],r[3]),v=wS(v,r[4],r[5]);break;default:c=AS(c,r[0],r[1]),u=AS(u,r[2],r[3]),d=AS(d,r[4],r[5]),m=AS(m,r[0],r[1]),h=AS(h,r[2],r[3]),v=AS(v,r[4],r[5])}const y=c*o[0],b=m*o[0],x=u*o[1],T=h*o[1],C=d*o[2],S=v*o[2],P=x+C,A=x+S,I=T+C,w=T+S,O=1-p,M=1-f,R=1-g,V=M*R,E=f*R,D=M*g,L=f*g,B=e.pointer;for(let e=0;e{switch(t.interpolationMode){case bS.LINEAR:e.interpolateLinear(n,r,o);break;case bS.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,a)=>{const i=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),c=e.pointer.subarray(s[0]+l[0]),u=e.numberOfComponents;for(let e=0;e{const i=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],c=t*i,u=n*s,d=r*l,p=e.weights[0].subarray(c),f=e.weights[1].subarray(u),g=e.weights[2].subarray(d),m=e.positions[0].subarray(c),h=e.positions[1].subarray(u),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=h.subarray(v[0]);let T=x,C=x,S=x,P=1,A=0,I=1,w=0;2===s&&(C=h[1].subarray(v[0]),S=C,P=f[0],A=f[1]),2===l&&(T=h[0].subarray(v[1]),S=T,I=g[0],w=g[1]),s+l===4&&(S=h[1].subarray(v[1]));const O=P*I,M=P*w,R=A*I,V=A*w;if(1===i)if(0===A&&0===w)for(let e=a;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],i=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],a=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case bS.LINEAR:e.interpolateRowLinear(n,r,o,a,i,s);break;case bS.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,a,i,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const a={...CS.newInstance(),...t.interpolationInfo};a.weightType="Float32Array";const i=a.interpolationMode;let s=!0;for(let l=0;l<3;++l){let c;for(c=0;c<3&&0===n[4*l+c];++c);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const u=a.extent[2*c],d=a.extent[2*c+1],p=t.structuredBounds[2*c],f=t.structuredBounds[2*c+1];let g=1;g=i1)if(i===bS.LINEAR)v[g*t+1-y]=T[1]*S,b[g*t-y]=1-h,b[g*t+1-y]=h;else if(i===bS.CUBIC){const n=e.vtkTricubicInterpWeights(h);if(4===g)for(let e=0;e<4;e++)v[g*t+e-y]=T[e]*S,b[g*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[T[t]-u]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const LS={interpolationMode:bS.NEAREST};function BS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,LS,n),ES.extend(e,t,n),jt.setGet(e,t,["interpolationMode"]),DS(e,t)}var NS={newInstance:jt.newInstance(BS,"vtkImageInterpolator"),extend:BS};function kS(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const a=e.getExtent();let i=n;null==i&&(i=a);let s,l,c,u=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(i[e],a[e]),t.extent[e+1]=Math.min(i[e+1],a[e+1]),t.extent[e]>t.extent[e+1]&&(u=!0);if(t.rowIncrement=a[1]-a[0]+1,t.sliceIncrement=t.rowIncrement*(a[3]-a[2]+1),u){s=0,l=0,c=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=a[e],t.extent[e+1]=a[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,c=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-a[0]+(t.extent[2]-a[2])*t.rowIncrement+(t.extent[4]-a[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*c-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const a=t.extent[4]-e[4];a<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=a*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&a>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*c;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let a;for(a=0;ae);++a)n=!n;t.spanIndex=a,t.inStencil=n;let i=t.extent[1]+1;a{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const FS={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function _S(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FS,n),jt.obj(e,t),jt.get(e,t,["id","index"]),kS(e,t)}var GS={newInstance:jt.newInstance(_S,"vtkImagePointDataIterator"),extend:_S};const US={MIN:0,MAX:1,MEAN:2,SUM:3};var zS={SlabMode:US};const{SlabMode:WS}=zS,{vtkErrorMacro:HS}=jt;function jS(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=g(new Float64Array(16));let o=null;function a(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=g(new Float64Array(16))),ne(t.resliceAxes,n)?null:(d(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,a)=>{const i=n[0];if(!i)return void HS("Invalid or missing input");const s=i.getOrigin(),l=i.getSpacing(),c=i.getDimensions(),u=i.getPointData().getScalars(),d=[0,c[0]-1,0,c[1]-1,0,c[2]-1],p=[0,0,0],f=[1,1,1],m=[0,0,0,0,0,0],v=[0,0,0],y=g(new Float64Array(16));t.resliceAxes&&b(y,y,t.resliceAxes);const x=new Float64Array(16);h(x,y);const T=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let C=null;t.autoCropOutput&&(C=e.getAutoCroppedOutputBounds(i));for(let e=0;e<3;e++){let n=0,r=0,o=0,a=0;if(t.transformInputSampling){let t=0;for(let i=0;i<3;i++){a+=x[4*i+e]*(T[i]-y[12+i]);const s=y[4*e+i]*y[4*e+i];n+=s*Math.abs(l[i]),r+=s*(d[2*i+1]-d[2*i])*Math.abs(l[i]),o+=s*d[2*i],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else a=T[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?f[e]=n:f[e]=t.outputSpacing[e],e>=t.outputDimensionality?(m[2*e]=0,m[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=C[2*e+1]-C[2*e]),m[2*e]=Math.round(o),m[2*e+1]=Math.round(m[2*e]+Math.abs(r/f[e]))):(m[2*e]=t.outputExtent[2*e],m[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=C[2*e]-m[2*e]*f[e]:p[e]=a-.5*(m[2*e]+m[2*e+1])*f[e]:p[e]=t.outputOrigin[e],v[e]=m[2*e+1]-m[2*e]+1}let S=u.getDataType();t.outputScalarType&&(S=t.outputScalarType);const P=i.getPointData().getScalars().getNumberOfComponents(),A=jt.newTypedArray(S,v[0]*v[1]*v[2]*P),I=Es.newInstance({name:"Scalars",values:A,numberOfComponents:P}),w=gl.newInstance();w.setDimensions(v),w.setOrigin(p),w.setSpacing(f),t.outputDirection&&w.setDirection(t.outputDirection),w.getPointData().setScalars(I),e.getIndexMatrix(i,w);let O=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,m)&&(O=bS.NEAREST)),t.interpolator.setInterpolationMode(O);let M=yS.CLAMP;M=t.wrap?yS.REPEAT:M,M=t.mirror?yS.MIRROR:M,t.interpolator.setBorderMode(M);const R=762939453125e-17;let V=.5*t.border;V=M===yS.CLAMP?V:4294967294,V=V>R?V:R,t.interpolator.setTolerance(V),t.interpolator.initialize(i),e.vtkImageResliceExecute(i,w),t.interpolator.releaseData(),a[0]=w},e.vtkImageResliceExecute=(n,a)=>{const i=n.getPointData().getScalars(),s=a.getPointData().getScalars();let l=s.getData();const c=a.getExtent(),u=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(u);let g=i.getData();const m=i.getDataType(),h=i.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],T=[0,0,0];T[0]=i.getNumberOfComponents(),T[1]=T[0]*b[0],T[2]=T[1]*b[1];const C=b[0]*b[1]*b[2];v>0&&v+hbS.LINEAR||d>1&&t.slabMode===WS.SUM,B=e.getConversionFunc(m,I,t.scalarShift,t.scalarScale,L),N=e.getSetPixelsFunc(I,1,w,l),k=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let F=c[2]-1,_=c[4]-1;const G=[0,0,0,0],U=[0,0,0,0],z=GS.newInstance();z.initialize(a,c,t.stencil,null);const W=z.getScalars(a,0);let H=0;const j=jt.newTypedArray(I,Fi.getDiagonalLength(c)*w*2),K=new Float64Array(h*d),$=new Float64Array(h);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(H=1*z.getId()*w,z.isInStencil()){const r=z.getIndex();r[2]>_&&(_=r[2],G[0]=V[0]+_*R[0],G[1]=V[1]+_*R[1],G[2]=V[2]+_*R[2],G[3]=V[3]+_*R[3],F=c[2]-1),r[1]>F&&(F=r[1],U[0]=G[0]+F*M[0],U[1]=G[1]+F*M[1],U[2]=G[2]+F*M[2],U[3]=G[3]+F*M[3]);const a=r[0],i=a+n-1;if(A){const e=g,t=l,n=1*T[0],r=1*T[1],o=1*T[2],s=x[1]-x[0]+1,c=x[3]-x[2]+1,u=x[5]-x[4]+1;let d=a,p=a-1,f=!1;const m=1*h;for(let t=a;t<=i;t++){const i=[U[0]+t*O[0],U[1]+t*O[1],U[2]+t*O[2]],l=PS(i[0])-x[0],g=PS(i[1])-x[2],h=PS(i[2])-x[4];if(l>=0&&l=0&&g=0&&h1){let e=n-.5*(d-1);e*=p,s[0]=i[0]+e*R[0],s[1]=i[1]+e*R[1],s[2]=i[2]+e*R[2],s[3]=i[3]+e*R[3],g=s}if(f){const e=1/g[3];g[0]*=e,g[1]*=e,g[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),a=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,g,n,a)}if(t.interpolator.checkBoundsIJK(g)){r=1,t.interpolator.interpolateIJK(g,$);for(let e=0;eh&&k(K,h,m/h);for(let e=0;ea?n:r}const g=l-1-(r!==n)-s+1;let m=0;n?(P&&e.rescaleScalars(E,h,i-a+1,t.scalarShift,t.scalarScale),m=B(j,E.subarray(s*h),w,g)):m=N(j,D,w,g);for(let e=0;e{const a=g(new Float64Array(16));return o=null,t.resliceAxes&&d(a,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?b(a,t.resliceTransform.getMatrix(),a):tt("Non homogeneous transform have not yet been ported")),b(a,a,n.getIndexToWorld()),null==o&&b(a,e.getWorldToIndex(),a),d(r,a),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),a=e.getDimensions(),i=[0,a[0]-1,0,a[1]-1,0,a[2]-1],s=new Float64Array(16);t.resliceAxes?h(s,t.resliceAxes):g(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let c=null;Ga.isIdentity3x3(o)||(c=_f().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const u=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+i[e%2]*r[0],d[1]=n[1]+i[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+i[4+Math.floor(e/4)%2]*r[2],d[3]=1,c&&Gi(d,d,c),t.resliceTransform&&l.transformPoint(d,d),Gi(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>u[2*e+1]&&(u[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,a)=>{const i=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let i=a;if(n!==ys.FLOAT&&n!==ys.DOUBLE&&!a){const a=e.getDataTypeMinMax(t);let s=(a.min+r)*o,l=(a.max+r)*o;const c=e.getDataTypeMinMax(n),u=c.min,d=c.max;if(s>l){const e=l;l=s,s=e}i=sd}if(i&&n!==ys.FLOAT&&n!==ys.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,a)=>e.clamp(n,r,o,a,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case WS.MIN:n=s;break;case WS.MAX:n=l;break;case WS.MEAN:n=t?u:c;break;case WS.SUM:n=t?f:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Gi(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const a=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],a=e[12+n];t[2*r]===t[2*r+1]&&(a+=o*t[2*n],o=0);const i=SS(o).error,s=SS(a).error;if(0!==i||0!==s)return 0}return 1}}const KS={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:bS.NEAREST,slabMode:WS.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:NS.newInstance(),usePermuteExecute:!1};function $S(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,KS,n),jt.obj(e,t),jt.algo(e,t,1,1),jt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),jt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),jt.setGetArray(e,t,["outputExtent"],6),jt.setGetArray(e,t,["outputDirection"],9),jt.setGetArray(e,t,["backgroundColor"],4),jt.get(e,t,["resliceAxes"]),jt.algo(e,t,1,1),jS(e,t)}var qS={newInstance:jt.newInstance($S,"vtkImageReslice"),extend:$S,...zS};const{InterpolationType:XS}=rg,{vtkErrorMacro:YS}=jt;function ZS(e,t){t.classHierarchy.push("vtkImageProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].piecewiseFunction&&(e=t.componentData[r].piecewiseFunction.getMTime(),n=n>e?n:e);return n},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].rGBTransferFunction!==a&&(t.componentData[o].rGBTransferFunction=a,e.modified(),!0)},e.getRGBTransferFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].rGBTransferFunction},e.setPiecewiseFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].piecewiseFunction!==a&&(t.componentData[o].piecewiseFunction=a,e.modified(),!0)},e.getPiecewiseFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].piecewiseFunction},e.setScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=t,o=n;return Number.isInteger(t)||(o=t,r=0),e.setPiecewiseFunction(r,o)},e.getScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e.getPiecewiseFunction(t)},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return YS("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(YS("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(XS.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(XS.LINEAR),e.getInterpolationTypeAsString=()=>jt.enumToString(XS,t.interpolationType)}const QS={independentComponents:!1,interpolationType:XS.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function JS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,QS,n),jt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;e++)t.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}jt.setGet(e,t,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity"]),jt.setGetArray(e,t,["labelOutlineThickness"]),ZS(e,t)}var eP={newInstance:jt.newInstance(JS,"vtkImageProperty"),extend:JS};const{vtkDebugMacro:tP}=jt;function nP(e,t){t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=eP.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){tP("Recomputing bounds..."),t.mapperBounds=n.map((e=>e)),e.computeMatrix();const r=new Float64Array(16);m(r,t.matrix),Fi.transformBounds(n,r,t.bounds),t.boundsMTime.modified()}var r;return t.bounds},e.getBoundsForSlice=(n,r)=>{const o=t.mapper.getBoundsForSlice(n,r);if(!Fi.isValid(o))return o;e.computeMatrix();const a=new Float64Array(16);return m(a,t.matrix),Fi.transformBounds(o,a)},e.getMinXBound=()=>e.getBounds()[0],e.getMaxXBound=()=>e.getBounds()[1],e.getMinYBound=()=>e.getBounds()[2],e.getMaxYBound=()=>e.getBounds()[3],e.getMinZBound=()=>e.getBounds()[4],e.getMaxZBound=()=>e.getBounds()[5],e.getMTime=()=>{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}if(null!==t.property){let n=t.property.getMTime();e=n>e?n:e,null!==t.property.getRGBTransferFunction()&&(n=t.property.getRGBTransferFunction().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}const rP={mapper:null,property:null,bounds:[...Fi.INIT_BOUNDS]};function oP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rP,n),ts.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["mapper"]),jt.getArray(e,t,["bounds"],6),nP(e,t)}var aP={newInstance:jt.newInstance(oP,"vtkImageSlice"),extend:oP};function iP(e,t){t.classHierarchy.push("vtkInteractorStyleImage"),e.superHandleMouseMove=e.handleMouseMove,e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case zx.IS_WINDOW_LEVEL:e.windowLevel(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zx.IS_SLICE:e.slice(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}e.superHandleMouseMove(n)},e.superHandleLeftButtonPress=e.handleLeftButtonPress,e.handleLeftButtonPress=n=>{const r=n.position;if(n.shiftKey||n.controlKey)"IMAGE3D"===t.interactionMode&&n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startRotate():"IMAGE_SLICING"===t.interactionMode&&n.controlKey?(t.lastSlicePosition=r.y,e.startSlice()):e.superHandleLeftButtonPress(n);else{t.windowLevelStartPosition[0]=r.x,t.windowLevelStartPosition[1]=r.y,e.setCurrentImageNumber(t.currentImageNumber);const n=t.currentImageProperty;n&&(t.windowLevelInitial[0]=n.getColorWindow(),t.windowLevelInitial[1]=n.getColorLevel()),e.startWindowLevel()}},e.superHandleLeftButtonRelease=e.handleLeftButtonRelease,e.handleLeftButtonRelease=()=>{switch(t.state){case zx.IS_WINDOW_LEVEL:e.endWindowLevel();break;case zx.IS_SLICE:e.endSlice();break;default:e.superHandleLeftButtonRelease()}},e.handleStartMouseWheel=()=>{e.startSlice()},e.handleEndMouseWheel=()=>{e.endSlice()},e.handleMouseWheel=e=>{const t=e.pokedRenderer.getActiveCamera();let n=t.getDistance();n+=e.spinY;const r=t.getClippingRange();nr[1]&&(n=r[1]),t.setDistance(n),e.pokedRenderer.getViewProps().filter((e=>e.isA("vtkImageSlice"))).forEach((t=>{if(t.getMapper().isA("vtkImageResliceMapper")){const n=t.getMapper().getSlicePlane();n&&(n.push(e.spinY),n.modified(),t.getMapper().modified())}}))},e.windowLevel=(e,n)=>{t.windowLevelCurrentPosition[0]=n.x,t.windowLevelCurrentPosition[1]=n.y;const r=t._interactor;if(t.currentImageProperty){const n=r.getView().getViewportSize(e),o=t.windowLevelInitial[0],a=t.windowLevelInitial[1];let i=4*(t.windowLevelCurrentPosition[0]-t.windowLevelStartPosition[0])/n[0],s=4*(t.windowLevelStartPosition[1]-t.windowLevelCurrentPosition[1])/n[1];Math.abs(o)>.01?i*=o:i*=o<0?-.01:.01,Math.abs(a)>.01?s*=a:s*=a<0?-.01:.01,o<0&&(i*=-1),a<0&&(s*=-1);let l=i+o;const c=a-s;l<.01&&(l=.01),t.currentImageProperty.setColorWindow(l),t.currentImageProperty.setColorLevel(c)}},e.slice=(e,n)=>{const r=t._interactor,o=n.y-t.lastSlicePosition,a=e.getActiveCamera(),i=a.getClippingRange();let s=a.getDistance(),l=0;if(a.getParallelProjection())l=2*a.getParallelScale();else{const e=Mo(a.getViewAngle());l=2*s*Math.tan(.5*e)}s+=o*l/r.getView().getViewportSize(e)[1],si[1]&&(s=i[1]-.001*l),a.setDistance(s),t.lastSlicePosition=n.y},e.setCurrentImageNumber=n=>{if(null===n)return;const r=t._interactor.getCurrentRenderer();if(!r)return;t.currentImageNumber=n;const o=r.getViewProps().filter((e=>e.isA("vtkImageSlice")));let a=n;n<0&&(a+=o.length);const i=o.find(((e,t)=>function(e,t,n){return e===n&&t.getNestedPickable()}(t,e,a)));i&&e.setCurrentImageProperty(i.getProperty())},e.setCurrentImageProperty=e=>{t.currentImageProperty=e}}const sP={windowLevelStartPosition:[0,0],windowLevelCurrentPosition:[0,0],lastSlicePosition:0,windowLevelInitial:[1,.5],currentImageNumber:-1,interactionMode:"IMAGE2D",xViewRightVector:[0,1,0],xViewUpVector:[0,0,-1],yViewRightVector:[1,0,0],yViewUpVector:[0,0,-1],zViewRightVector:[1,0,0],zViewUpVector:[0,1,0]};function lP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sP,n),eT.extend(e,t,n),jt.setGet(e,t,["interactionMode"]),jt.get(e,t,["currentImageProperty"]),iP(e,t)}var cP={newInstance:jt.newInstance(lP,"vtkInteractorStyleImage"),extend:lP};const{vtkErrorMacro:uP}=jt,dP=[0,2,4,1,2,4,0,3,4,1,3,4,0,2,5,1,2,5,0,3,5,1,3,5],pP=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7];function fP(e,t){t.classHierarchy.push("vtkOutlineFilter"),e.requestData=(e,t)=>{const n=e[0];if(!n)return void uP("Invalid or missing input");const r=n.getBounds(),o=hu.newInstance();o.getPoints().setData(Float32Array.from(dP.map((e=>r[e]))),3),o.getLines().setData(Uint16Array.from(pP)),t[0]=o}}const gP={};function mP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gP,n),jt.obj(e,t),jt.algo(e,t,1,1),fP(e,t)}var hP={newInstance:jt.newInstance(mP,"vtkOutlineFilter"),extend:mP,BOUNDS_MAP:dP,LINE_ARRAY:pP},vP={Corners:{TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"}};const{vtkErrorMacro:yP}=jt,{Corners:bP}=vP;function xP(e,t){t.classHierarchy.push("vtkOrientationMarkerWidget");const n={...e},r=[],o=ux.newInstance(),a=new ResizeObserver((t=>{e.updateViewport()}));let i=null,s=null,l=null,c=null,u=null;function d(){t._interactor.isAnimating()||e.updateMarkerOrientation()}t._onParentRendererChanged=()=>e.updateViewport(),e.computeViewport=()=>{const e=t.parentRenderer||t._interactor.getCurrentRenderer(),[n,r,o,a]=e.getViewport(),i=t._interactor.getView(),s=i.getSize(),[l,c]=i.getViewportSize(e),u=Math.min(l,c);let d=t.viewportSize*u;d=Math.max(Math.min(t.minPixelSize,u),Math.min(t.maxPixelSize,d));const p=d/s[0],f=d/s[1];switch(t.viewportCorner){case bP.TOP_LEFT:return[n,a-f,n+p,a];case bP.TOP_RIGHT:return[o-p,a-f,o,a];case bP.BOTTOM_LEFT:return[n,r,n+p,r+f];case bP.BOTTOM_RIGHT:return[o-p,r,o,r+f];default:return yP("Invalid widget corner"),null}},e.updateViewport=()=>{t.enabled&&(o.setViewport(...e.computeViewport()),t._interactor.render())},e.updateMarkerOrientation=()=>{const e=(t.parentRenderer||t._interactor.getCurrentRenderer()).getActiveCamera();if(!e)return;const n=e.getReferenceByName("position"),a=e.getReferenceByName("focalPoint"),i=e.getReferenceByName("viewUp");if(r[0]!==n[0]||r[1]!==n[1]||r[2]!==n[2]||r[3]!==a[0]||r[4]!==a[1]||r[5]!==a[2]||r[6]!==i[0]||r[7]!==i[1]||r[8]!==i[2]){r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=a[0],r[4]=a[1],r[5]=a[2],r[6]=i[0],r[7]=i[1],r[8]=i[2];const e=o.getActiveCamera();e.setPosition(n[0],n[1],n[2]),e.setFocalPoint(a[0],a[1],a[2]),e.setViewUp(i[0],i[1],i[2]),o.resetCamera()}},e.setEnabled=n=>{if(n){if(t.enabled)return;if(!t.actor)return void yP("Must set actor before enabling orientation marker.");if(!t._interactor)return void yP("Must set interactor before enabling orientation marker.");const n=t.parentRenderer||t._interactor.getCurrentRenderer(),r=n.getRenderWindow();r.addRenderer(o),r.getNumberOfLayers()<2&&r.setNumberOfLayers(2),o.setLayer(r.getNumberOfLayers()-1),o.setInteractive(!1),o.addViewProp(t.actor),t.actor.setVisibility(!0),i=n.onEvent((e=>{"ActiveCameraEvent"===e.type&&(s&&s.unsubscribe(),s=e.camera.onModified(d))})),s=n.getActiveCamera().onModified(d),l=t._interactor.onAnimation(e.updateMarkerOrientation),c=t._interactor.onEndAnimation(e.updateMarkerOrientation),a.observe(t._interactor.getView().getCanvas()),e.updateViewport(),e.updateMarkerOrientation(),t.enabled=!0}else{if(!t.enabled)return;t.enabled=!1,a.disconnect(),i.unsubscribe(),i=null,s.unsubscribe(),s=null,l.unsubscribe(),l=null,c.unsubscribe(),c=null,t.actor.setVisibility(!1),o.removeViewProp(t.actor);const e=t._interactor?.findPokedRenderer()?.getRenderWindow();e&&e.removeRenderer(o)}e.modified()},e.setViewportCorner=n=>{n!==t.viewportCorner&&(t.viewportCorner=n,e.updateViewport())},e.setViewportSize=n=>{const r=Math.min(1,Math.max(0,n));r!==t.viewportSize&&(t.viewportSize=r,e.updateViewport())},e.setActor=n=>{const r=t.enabled;e.setEnabled(!1),t.actor=n,e.setEnabled(r)},e.getRenderer=()=>o,e.delete=()=>{n.delete(),u&&(u.unsubscribe(),u=null),i&&(i.unsubscribe(),i=null),s&&(s.unsubscribe(),s=null),l&&(l.unsubscribe(),l=null),c&&(c.unsubscribe(),c=null),a.disconnect()},u=e.onModified(e.updateViewport)}const TP={viewportCorner:vP.Corners.BOTTOM_LEFT,viewportSize:.2,minPixelSize:50,maxPixelSize:200,parentRenderer:null};function CP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TP,n),jt.obj(e,t),jt.get(e,t,["enabled","viewportCorner","viewportSize"]),jt.setGet(e,t,["_interactor","minPixelSize","maxPixelSize","parentRenderer"]),jt.get(e,t,["actor"]),jt.moveToProtected(e,t,["interactor"]),xP(e,t)}var SP={newInstance:jt.newInstance(CP,"vtkOrientationMarkerWidget"),extend:CP,...vP};const PP={DEFAULT:0,GEOMETRY:1,SLICE:2,VOLUME:3,YZ_PLANE:4,XZ_PLANE:5,XY_PLANE:6},AP={PICKING_BUFFER:0,FRONT_BUFFER:1},IP={MOUSE_MOVE:0,MOUSE_RELEASE:1};var wP={ViewTypes:PP,RenderingTypes:AP,CaptureOn:IP};function OP(e,t){t.classHierarchy.push("vtkAbstractWidget"),t.actorToRepresentationMap=new WeakMap,e.getBounds=t.widgetState.getBounds,e.getNestedProps=()=>t.representations,e.activateHandle=n=>{let{selectedState:r,representation:o}=n;t.widgetState.activateOnly(r),t.activeState=r,r&&r.updateManipulator&&r.updateManipulator(),e.invokeActivateHandle({selectedState:r,representation:o}),e.updateCursor&&e.updateCursor()},e.deactivateAllHandles=()=>{t.widgetState.deactivate()},e.hasActor=e=>t.actorToRepresentationMap.has(e),e.grabFocus=()=>{t.hasFocus=!0},e.loseFocus=()=>{t.hasFocus=!1},e.hasFocus=()=>t.hasFocus,e.placeWidget=e=>t.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e),e.getRepresentationFromActor=e=>t.actorToRepresentationMap.get(e),e.updateRepresentationForRender=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:AP.FRONT_BUFFER;for(let n=0;nt._factory.getViewWidgets(),e.setPriority(.5)}const MP={contextVisibility:!0,handleVisibility:!0,hasFocus:!1};function RP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,MP,n),Zi.extend(e,t,n),Ux.extend(e,t,n),jt.setGet(e,t,["contextVisibility","handleVisibility","_widgetManager"]),jt.get(e,t,["representations","widgetState","activeState"]),jt.moveToProtected(e,t,["widgetManager"]),jt.event(e,t,"ActivateHandle"),OP(e,t)}var VP={newInstance:jt.newInstance(RP,"vtkAbstractWidget"),extend:RP};const{ViewTypes:EP,RenderingTypes:DP,CaptureOn:LP}=wP,{vtkErrorMacro:BP}=jt;let NP=1;function kP(e){const t=e.getActiveCamera(),n=e.getRenderWindow(),r=n.getInteractor(),o=r.getView();return{renderer:e,renderWindow:n,interactor:r,apiSpecificRenderWindow:o,camera:t}}function FP(e,t){const{dispHeightFactor:n,cameraPosition:r,cameraDir:o,isParallel:a,rendererPixelDims:i}=t;let s=1;if(a)s=n;else{const t=[...e];Ga.subtract(t,r,t),s=Ga.dot(t,o)*n}return s/i[1]}function _P(e,t){t.viewId||(t.viewId="view-"+NP++),t.classHierarchy.push("vtkWidgetManager");const n=new WeakMap,r=[];function o(e){return e&&(e.isA("vtkAbstractWidget")?e:e.getWidgetForView({viewId:t.viewId}))}function a(){const{_apiSpecificRenderWindow:e,_camera:n,_renderer:r}=t;if(r&&e&&n){const[o,a]=e.getSize(),[i,s,l,c]=r.getViewport(),u=e.getComputedDevicePixelRatio(),d=[o*(l-i)/u,a*(c-s)/u],p=n.getPosition(),f=n.getDirectionOfProjection(),g=n.getParallelProjection(),m=g?2*n.getParallelScale():2*Math.tan(Ga.radiansFromDegrees(n.getViewAngle())/2);t.widgets.forEach((e=>{e.getNestedProps().forEach((e=>{e.getScaleInPixels()&&e.setDisplayScaleParams({dispHeightFactor:m,cameraPosition:p,cameraDir:f,isParallel:g,rendererPixelDims:d})}))}))}}async function i(n,r,o){const{position:a}=n,{requestCount:i,selectedState:s,representation:l,widget:c}=await e.getSelectedDataForXY(a.x,a.y);if(i||o!==t._currentUpdateSelectionCallID)return;function u(e){r&&t._interactor.invokeLeftButtonRelease(n),e.activateHandle({selectedState:s,representation:l}),r&&t._interactor.invokeLeftButtonPress(n)}t._apiSpecificRenderWindow.setCursor(c?"pointer":"default"),t.activeWidget=null;let d=!1;if(t.widgetInFocus===c&&c.hasFocus())u(c),t.activeWidget=c,d=!0;else for(let e=0;e1&&void 0!==arguments[1]&&arguments[1];if(!t.isAnimating&&t.pickingEnabled&&e.pokedRenderer===t._renderer){const r=Symbol("UpdateSelection");t._currentUpdateSelectionCallID=r,await i(e,n,r)}};function l(e){e.updateRepresentationForRender(t.renderingType)}function c(){t.renderingType=DP.FRONT_BUFFER,t.widgets.forEach(l)}async function u(e,n,r,o){t._captureInProgress?await t._captureInProgress:(t.renderingType=DP.PICKING_BUFFER,t.widgets.forEach(l),t._capturedBuffers=null,t._captureInProgress=t._selector.getSourceDataAsync(t._renderer,e,n,r,o),t._capturedBuffers=await t._captureInProgress,t._captureInProgress=null,t.previousSelectedData=null,c())}function d(e){t._renderer.removeActor(e),e.delete()}function p(){t._renderer.getRenderWindow().getInteractor().render(),e.renderWidgets()}e.enablePicking=()=>{t.pickingEnabled=!0,e.renderWidgets()},e.renderWidgets=()=>{if(t.pickingEnabled&&t.captureOn===LP.MOUSE_RELEASE){const[e,n]=t._apiSpecificRenderWindow.getSize();u(0,0,e,n)}c(),e.modified()},e.disablePicking=()=>{t.pickingEnabled=!1},e.setRenderer=n=>{const o=kP(n);for(Object.assign(t,o),jt.moveToProtected({},t,Object.keys(o));r.length;)r.pop().unsubscribe();t._selector=t._apiSpecificRenderWindow.createSelector(),t._selector.setFieldAssociation(Js.FIELD_ASSOCIATION_POINTS),r.push(t._apiSpecificRenderWindow.onWindowResizeEvent(a)),r.push(t._camera.onModified(a)),a(),r.push(t._interactor.onStartAnimation((()=>{t.isAnimating=!0}))),r.push(t._interactor.onEndAnimation((()=>{t.isAnimating=!1,e.renderWidgets()}))),r.push(t._interactor.onMouseMove((e=>(s(e),jt.VOID)))),r.push(t._interactor.onLeftButtonPress((e=>{const{deviceType:t}=e,n="touch"===t||"pen"===t;return n&&s(e,n),jt.VOID}),.25)),e.modified(),t.pickingEnabled&&e.enablePicking()},e.addWidget=(r,o,i)=>{if(!t._renderer)return BP("Widget manager MUST BE link to a view before registering widgets"),null;const{viewId:s,_renderer:l}=t,c=r.getWidgetForView({viewId:s,renderer:l,viewType:o||EP.DEFAULT,initialValues:i});return null!=c&&-1===t.widgets.indexOf(c)&&(t.widgets.push(c),(u=c).setWidgetManager(e),function(e){const t=e.getRepresentations();for(let r=0;r{t.widgets.forEach(d),t.widgets=[],t.widgetInFocus=null,p()},e.removeWidget=n=>{const r=o(n),a=t.widgets.indexOf(r);-1!==a&&(t.widgets.splice(a,1),t.widgetInFocus===r&&e.releaseFocus(),d(r),p())},e.getSelectedDataForXY=async(n,r)=>{if(t.selections=null,t.pickingEnabled){if(t._capturedBuffers&&t.captureOn!==LP.MOUSE_MOVE){const e=t._capturedBuffers.area;(ne[2]||re[3])&&await u(n,r,n,r)}else await u(n,r,n,r);t.selections=t._capturedBuffers.generateSelection(n,r,n,r)}return e.getSelectedData()},e.getSelectedData=()=>{if(!t.selections||!t.selections.length)return t.previousSelectedData=null,{};const{propID:e,compositeID:r,prop:o}=t.selections[0].getProperties();let{widget:a,representation:i}=t.selections[0].getProperties();if(t.previousSelectedData&&t.previousSelectedData.prop===o&&t.previousSelectedData.widget===a&&t.previousSelectedData.compositeID===r)return t.previousSelectedData.requestCount++,t.previousSelectedData;if(n.has(o)){const e=n.get(o);a=e.widget,i=e.representation}if(a&&i){const n=i.getSelectedState(o,r);return t.previousSelectedData={requestCount:0,propID:e,compositeID:r,prop:o,widget:a,representation:i,selectedState:n},t.previousSelectedData}return t.previousSelectedData=null,{}},e.grabFocus=e=>{const n=o(e);t.widgetInFocus&&t.widgetInFocus!==n&&t.widgetInFocus.loseFocus(),t.widgetInFocus=n,t.widgetInFocus&&t.widgetInFocus.grabFocus()},e.releaseFocus=()=>e.grabFocus(null);const f=e.delete;e.delete=()=>{for(;r.length;)r.pop().unsubscribe();f()}}const GP={viewId:null,widgets:[],activeWidget:null,renderer:null,viewType:EP.DEFAULT,isAnimating:!1,pickingEnabled:!0,selections:null,previousSelectedData:null,widgetInFocus:null,captureOn:LP.MOUSE_MOVE};function UP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,GP,n),jt.obj(e,t),jt.setGet(e,t,["captureOn",{type:"enum",name:"viewType",enum:EP}]),jt.get(e,t,["selections","widgets","viewId","pickingEnabled","activeWidget"]),_P(e,t)}var zP={newInstance:jt.newInstance(UP,"vtkWidgetManager"),extend:UP,Constants:wP,getPixelWorldHeightAtCoord:FP};function WP(){}function HP(e,t){t.classHierarchy.push("vtkAbstractWidgetFactory");const n={};e.getWidgetForView=r=>{let{viewId:o,renderer:a,viewType:i,initialValues:s}=r;if(!n[o]){if(!a)return null;const{interactor:r,apiSpecificRenderWindow:l,camera:c}=kP(a),u={},d={};jt.obj(d,u),Object.assign(d,{onWidgetChange:e.onWidgetChange}),Object.assign(u,{widgetState:t.widgetState,manipulator:t.manipulator,viewType:i,renderer:a,camera:c,apiSpecificRenderWindow:l,factory:e}),jt.moveToProtected(d,u,["renderer","camera","apiSpecificRenderWindow","factory"]),jt.get(d,u,["viewType"]),jt.safeArrays(u),VP.extend(d,u,s);const p=s;u.representations=e.getRepresentationsForViewType(i).map((e=>{let{builder:t,labels:n,initialValues:r}=e;return t.newInstance({_parentProp:d,labels:n,...r,...p})})),u.representations.forEach((e=>{e.setInputData(u.widgetState),e.getActors().forEach((t=>{u.actorToRepresentationMap.set(t,e)}))})),t.behavior(d,u),["coincidentTopologyParameters",...t.methodsToLink||[]].forEach((e=>{const t=`set${jt.capitalize(e)}`,n=`get${jt.capitalize(e)}`,r={[e]:[],[t]:[],[n]:[]};u.representations.forEach((o=>{o[e]&&r[e].push(o[e]),o[t]&&r[t].push(o[t]),o[n]&&r[n].push(o[n])})),Object.keys(r).forEach((e=>{const t=r[e];1===t.length?d[e]=t[0]:t.length>1&&(d[e]=jt.chain(...t))}))})),d.delete=jt.chain((()=>{delete n[o]}),d.delete),d.setInteractor(r);const f=Object.freeze(d);return n[o]=f,f}return n[o]},e.getViewIds=()=>Object.keys(n),e.getViewWidgets=()=>Object.values(n),e.setVisibility=e=>{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;rt.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e);let r=WP;e.delete=jt.chain(e.delete,(()=>r())),t.widgetState&&(r=t.widgetState.onModified((()=>e.invokeWidgetChange(t.widgetState))).unsubscribe)}function jP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,n),jt.obj(e,t),jt.get(e,t,["widgetState"]),jt.event(e,t,"WidgetChange"),HP(e,t)}var KP={newInstance:jt.newInstance(jP,"vtkAbstractWidget"),extend:jP};const{vtkWarningMacro:$P}=jt;function qP(e,t){t.classHierarchy.push("vtkPlaneSource"),e.requestData=(n,r)=>{if(t.deleted)return;const o=r[0],a=o?o.getPoints().getDataType():t.pointType,i=hu.newInstance(),s=[],l=[];if(zo(t.point1,t.origin,s),zo(t.point2,t.origin,l),!e.updatePlane(s,l))return void $P("Bad plane definition");const c=t.xResolution,u=t.yResolution,d=(c+1)*(u+1),p=c*u,f=jt.newTypedArray(a,3*d);i.getPoints().setData(f,3);const g=new Uint32Array(5*p);i.getPolys().setData(g,1);const m=new Float32Array(3*d),h=Es.newInstance({numberOfComponents:3,values:m,name:"Normals"});i.getPointData().setNormals(h);const v=new Float32Array(2*d),y=Es.newInstance({numberOfComponents:2,values:v,name:"TextureCoordinates"});i.getPointData().setTCoords(y);const b=new Float32Array(2);let x=0;for(let e=0;e{if(Math.abs(n)<1e-6)return;const o=g(new Float64Array(16)),a=[];var i,s;i=a,s=t.center,i[0]=-s[0],i[1]=-s[1],i[2]=-s[2],x(o,o,t.center),C(o,o,n,r),x(o,o,a),Dn(t.origin,t.origin,o),Dn(t.point1,t.point1,o),Dn(t.point2,t.point2,o),_f().rotate(n,r).apply(t.normal),e.modified()},e.setCenter=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.center)){const r=[];zo(t.point1,t.origin,r);const o=[];zo(t.point2,t.origin,o);for(let e=0;e<3;e++)t.center[e]=n[e],t.origin[e]=t.center[e]-.5*(r[e]+o[e]),t.point1[e]=t.origin[e]+r[e],t.point2[e]=t.origin[e]+o[e];e.modified()}},e.setPoint1=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.point1)){const r=[],o=[];t.point1=[...n],zo(t.point1,t.origin,r),zo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.setPoint2=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.point2)){const r=[],o=[];t.point2=[...n],zo(t.point1,t.origin,r),zo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.updatePlane=(e,n)=>{for(let r=0;r<3;r++)t.center[r]=t.origin[r]+.5*(e[r]+n[r]);return $o(e,n,t.normal),0!==Xo(t.normal)}}const XP={xResolution:10,yResolution:10,origin:[0,0,0],point1:[1,0,0],point2:[0,1,0],pointType:"Float64Array"};function YP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XP,n),t.normal=[0,0,1],t.center=[0,0,0],jt.obj(e,t),jt.setGet(e,t,["xResolution","yResolution"]),jt.setGetArray(e,t,["origin"],3),jt.getArray(e,t,["point1","point2","normal","center"],3),jt.algo(e,t,0,1),qP(e,t),e.setPoint1(t.point1),e.setPoint2(t.point2)}var ZP={newInstance:jt.newInstance(YP,"vtkPlaneSource"),extend:YP};function QP(e,t){t.classHierarchy.push("vtkAbstractManipulator"),e.getOrigin=e=>t.userOrigin?t.userOrigin:t.useCameraFocalPoint?e.pokedRenderer.getActiveCamera().getFocalPoint():t.handleOrigin?t.handleOrigin:t.widgetOrigin?t.widgetOrigin:[0,0,0],e.getNormal=e=>t.userNormal?t.userNormal:t.useCameraNormal?e.pokedRenderer.getActiveCamera().getDirectionOfProjection():t.handleNormal?t.handleNormal:t.widgetNormal?t.widgetNormal:[0,0,1]}const JP={useCameraFocalPoint:!1,useCameraNormal:!1};function eA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JP,n),jt.obj(e,t),jt.setGet(e,t,["useCameraFocalPoint","useCameraNormal"]),jt.setGetArray(e,t,["userOrigin","handleOrigin","widgetOrigin","userNormal","handleNormal","widgetNormal"],3),QP(e,t)}var tA={extend:eA,newInstance:jt.newInstance(eA,"vtkAbstractManipulator")};function nA(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ei.intersectWithLine(i,s,n,r).x}function rA(e,t){t.classHierarchy.push("vtkPlaneManipulator"),e.handleEvent=(t,n)=>({worldCoords:nA(t.position.x,t.position.y,e.getOrigin(t),e.getNormal(t),t.pokedRenderer,n)})}function oA(e){return{...e}}function aA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};tA.extend(e,t,oA(n)),rA(e,t)}var iA={intersectDisplayWithPlane:nA,extend:aA,newInstance:jt.newInstance(aA,"vtkPlaneManipulator")};const sA={DIRECTION:0,ROTATION:1,MATRIX:2};var lA={OrientationModes:sA,ScaleModes:{SCALE_BY_CONSTANT:0,SCALE_BY_MAGNITUDE:1,SCALE_BY_COMPONENTS:2}};const{OrientationModes:cA,ScaleModes:uA}=lA,{vtkErrorMacro:dA}=jt;function pA(e,t){t.classHierarchy.push("vtkGlyph3DMapper"),e.getOrientationModeAsString=()=>jt.enumToString(cA,t.orientationMode),e.setOrientationModeToDirection=()=>e.setOrientationMode(cA.DIRECTION),e.setOrientationModeToRotation=()=>e.setOrientationMode(cA.ROTATION),e.setOrientationModeToMatrix=()=>e.setOrientationMode(cA.MATRIX),e.getOrientationArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.orientationArray?n.getPointData().getArray(t.orientationArray):n.getPointData().getVectors():null},e.getScaleModeAsString=()=>jt.enumToString(uA,t.scaleMode),e.setScaleModeToScaleByMagnitude=()=>e.setScaleMode(uA.SCALE_BY_MAGNITUDE),e.setScaleModeToScaleByComponents=()=>e.setScaleMode(uA.SCALE_BY_COMPONENTS),e.setScaleModeToScaleByConstant=()=>e.setScaleMode(uA.SCALE_BY_CONSTANT),e.getScaleArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.scaleArray?n.getPointData().getArray(t.scaleArray):n.getPointData().getScalars():null},e.getBounds=()=>{const n=e.getInputData(0),r=e.getInputData(1);return n&&r?(e.buildArrays(),t.bounds):Na()},e.buildArrays=()=>{const n=e.getInputData(0),r=e.getInputData(1);if(t.buildTime.getMTime()t.bounds[1]&&(t.bounds[1]=u[0]),u[1]>t.bounds[3]&&(t.bounds[3]=u[1]),u[2]>t.bounds[5]&&(t.bounds[5]=u[2]);const r=new Float32Array(y,36*e,9);se(r,n),ge(r,r),fe(r,r)}const O=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),t.colorArray=null;const M=e.getLookupTable();M&&O&&(M.build(),t.colorArray=M.mapScalars(O,t.colorMode,0)),t.buildTime.modified()}},e.getPrimitiveCount=()=>{const t=e.getInputData(1),n=e.getInputData().getPoints().getNumberOfValues()/3;return{points:n*t.getPoints().getNumberOfValues()/3,verts:n*(t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells()),lines:n*(t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells()),triangles:n*(t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells())}},e.setSourceConnection=t=>e.setInputConnection(t,1)}const fA={orient:!0,orientationMode:cA.DIRECTION,orientationArray:null,scaling:!0,scaleFactor:1,scaleMode:uA.SCALE_BY_MAGNITUDE,scaleArray:null,matrixArray:null,normalArray:null,colorArray:null};function gA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fA,n),oc.extend(e,t,n),jt.algo(e,t,2,0),t.buildTime={},jt.obj(t.buildTime,{mtime:0}),t.boundsTime={},jt.obj(t.boundsTime,{mtime:0}),jt.setGet(e,t,["orient","orientationMode","orientationArray","scaleArray","scaleFactor","scaleMode","scaling"]),jt.get(e,t,["colorArray","matrixArray","normalArray","buildTime"]),pA(e,t)}var mA={newInstance:jt.newInstance(gA,"vtkGlyph3DMapper"),extend:gA,...lA};const hA=0,vA=1,{vtkErrorMacro:yA,vtkWarningMacro:bA}=jt;function xA(e,t){e&&e.setResolveCoincidentTopologyToPolygonOffset&&(e.setResolveCoincidentTopologyToPolygonOffset(),Ul.forEach((n=>{if(t[n]){const r=`setRelativeCoincidentTopology${n}OffsetParameters`;if(e[r]){const{factor:o,offset:a}=t[n];e[r](o,a)}}})))}function TA(e,t,n,r,o){let a=e[`get${jt.capitalize(t)}`]?.()||e.getPointData().getArrayByName(t);if(!a||void 0!==r&&a.getDataType()!==r||void 0!==o&&a.getNumberOfComponents()!==o){let i=Es,s=r,l=o;"points"===t?(i=vc,s=s??"Float32Array",l=o??3):uu.includes(t)?(i=dc,s=s??"Uint16Array",l=o??1):(s=s??"Float32Array",l=o??1),a=i.newInstance({name:t,dataType:s,numberOfComponents:l,size:l*n,empty:0===n}),"points"===t||uu.includes(t)?e[`set${jt.capitalize(t)}`](a):e.getPointData().addArray(a)}else a.getNumberOfTuples()!==n&&a.resize(n);return a}function CA(e,t){t.classHierarchy.push("vtkWidgetRepresentation");const n={mtimes:{},states:[]};t._onCoincidentTopologyParametersChanged=()=>{e.getActors().forEach((e=>{xA(e.getMapper(),t.coincidentTopologyParameters)}))},e.getActors=()=>t.actors,e.getNestedProps=e.getActors,e.setLabels=function(){for(var n=arguments.length,r=new Array(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.mtimes.representation===e.getMTime()&&n.mtimes.input===r.getMTime()||(n.mtimes.representation=e.getMTime(),n.mtimes.input=r.getMTime(),n.states=[],t.labels.forEach((e=>{n.states=n.states.concat(r.getStatesWithLabel(e)||[])}))),n.states},e.getSelectedState=(t,n)=>{const r=e.getRepresentationStates();return n0&&void 0!==arguments[0]?arguments[0]:AP.FRONT_BUFFER,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!0;switch(t.behavior){case hA:o=e===AP.PICKING_BUFFER||r;break;case vA:o=n;break;default:o=!0}const a=o;for(let e=0;ee.addActor(t)))},e.addActor=e=>{xA(e.getMapper(),t.coincidentTopologyParameters),Array.prototype.push.apply(t.actors,[e])},e.setLabels(t.labels)}function SA(e){return{activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,actors:[],labels:[],behavior:vA,coincidentTopologyParameters:{Point:{factor:-1,offset:-1},Line:{factor:-1,offset:-1},Polygon:{factor:-1,offset:-1}},scaleInPixels:!1,displayScaleParams:{dispHeightFactor:1,cameraPosition:[0,0,0],cameraDir:[1,0,0],isParallel:!1,rendererPixelDims:[1,1]},_internalArrays:{},...e}}var PA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Zi.extend(e,t,SA(n)),jt.algo(e,t,1,1),jt.get(e,t,["labels","displayScaleParams","coincidentTopologyParameters"]),jt.set(e,t,[{type:"object",name:"displayScaleParams"},{type:"object",name:"coincidentTopologyParameters"}]),jt.setGet(e,t,["scaleInPixels","activeScaleFactor","activeColor","useActiveColor"]),CA(e,t)},AA=function(e){let t=e.source;e.filter&&(t.isA("vtkDataSet")?e.filter.setInputData(t):e.filter.setInputConnection(t.getOutputPort()),t=e.filter),t&&(t.isA("vtkDataSet")?e.mapper.setInputData(t):e.mapper.setInputConnection(t.getOutputPort())),e.glyph&&e.mapper.setInputConnection(e.glyph.getOutputPort(),1),e.actor.setMapper(e.mapper)};function IA(e,t){t.classHierarchy.push("vtkHandleRepresentation")}const wA={behavior:hA,pickable:!0,dragable:!0,scaleInPixels:!0};var OA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...wA,...n};PA(e,t,r),IA(0,t)};function MA(e,t){t.classHierarchy.push("vtkContextRepresentation")}const RA={behavior:vA,pickable:!1,dragable:!0};var VA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...RA,...n};PA(e,t,r),MA(0,t)};function EA(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,n)=>{if(t.deleted)return;let r=n[0];const o=r?r.getPoints().getDataType():t.pointType;r=hu.newInstance();let a=0,{thetaResolution:i}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let c=t.startPhit.startPhi?t.endPhi:t.startPhi;u*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++i;const d=(l-s)/t.thetaResolution,p=t.startPhi<=0?1:0,f=t.phiResolution+(t.endPhi>=180?-1:0),g=t.phiResolution*i+2,m=2*t.phiResolution*t.thetaResolution;let h=0,v=jt.newTypedArray(o,3*g),y=new Float32Array(3*g),b=0,x=new Uint32Array(5*m);t.startPhi<=0&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]+t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=1,h++,a++),t.endPhi>=180&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]-t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=-1,h++,a++);const T=t.phiResolution-a,C=(u-c)/(t.phiResolution-1);for(let e=0;e=180){const e=T-1+a;for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DA,n),jt.obj(e,t),jt.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),jt.setGetArray(e,t,["center"],3),jt.algo(e,t,0,1),EA(e,t)}var BA={newInstance:jt.newInstance(LA,"vtkSphereSource"),extend:LA};function NA(e,t){return(e,n)=>{const r=TA(e,"points",n.length).getData();let o=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=TA(e,"color",n.length,"Uint8Array",4),o=r.getData();let a=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=TA(e,"color",n.length).getData();for(let e=0;e{t._pipeline.mapper.setColorByArrayName(null)}}function GA(e,t){return(n,r)=>{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0),t._pipeline.mapper.setScaleMode(mA.ScaleModes.SCALE_BY_COMPONENTS);const o=TA(n,"scale",r.length,"Float32Array",3).getData();let a=0;for(let n=0;n{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0);const o=TA(n,"scale",r.length).getData();for(let n=0;n{t._pipeline.mapper.setScaleArray(null),t._pipeline.mapper.setScaleFactor(t.defaultScale),t._pipeline.mapper.setScaling(1!==t.defaultScale)}}function WA(e,t){return(e,n)=>{t._pipeline.mapper.setOrientationArray("orientation"),t._pipeline.mapper.setOrientationMode(sA.MATRIX);const r=TA(e,"orientation",n.length,"Float32Array",9).getData();for(let e=0;e{t._pipeline.mapper.setOrientationArray(null)}}function jA(e,t){t.classHierarchy.push("vtkGlyphRepresentation");const n={...e},r=hu.newInstance({mtime:0});function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rnull!=e[0]?.[`get${jt.capitalize(t)}`]?.()))}e.getRepresentationStates=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.getRepresentationStates(e).filter((e=>e.getOrigin?.()&&(e.isVisible?.()??!0)))},e.getMixins=e=>{const n={};return o(e,"origin")?n.position=t.applyMixin.origin:n.position=t.applyMixin.noPosition,o(e,"color3")?n.color=t.applyMixin.color3:o(e,"color")?n.color=t.applyMixin.color:n.color=t.applyMixin.noColor,o(e,"scale3")?n.scale=t.applyMixin.scale3:o(e,"scale1")?n.scale=t.applyMixin.scale1:n.scale=t.applyMixin.noScale,o(e,"direction")?n.orientation=t.applyMixin.direction:n.orientation=t.applyMixin.noOrientation,n},e.requestData=(t,n)=>{const o=e.getRepresentationStates(t[0]);n[0]=r;const a=e.getMixins(o);Object.values(a).forEach((e=>e(r,o))),r.getPoints().modified(),r.modified()},AA(t._pipeline),e.addActor(t._pipeline.actor)}function KA(e,t,n){return{defaultScale:1,...n,_pipeline:{source:n._pipeline?.source??e,glyph:n._pipeline?.glyph??BA.newInstance({phiResolution:8,thetaResolution:8}),mapper:n._pipeline?.mapper??mA.newInstance({scalarMode:vl.USE_POINT_FIELD_DATA}),actor:n._pipeline?.actor??hs.newInstance({parentProp:e}),...n._pipeline},applyMixin:{origin:n.applyMixin?.origin??NA(0,t),noPosition:n.applyMixin?.noPosition??((e,t)=>{TA(e,"points",0)}),color3:n.applyMixin?.color3??kA(0,t),color:n.applyMixin?.color??FA(0,t),noColor:n.applyMixin?.noColor??_A(0,t),scale3:n.applyMixin?.scale3??GA(e,t),scale1:n.applyMixin?.scale1??UA(e,t),noScale:n.applyMixin?.noScale??zA(0,t),direction:n.applyMixin?.direction??WA(0,t),noOrientation:n.applyMixin?.noOrientation??HA(0,t),...n.applyMixin}}}function $A(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.behavior===vA?VA(e,t,KA(e,t,n)):OA(e,t,KA(e,t,n)),"lighting"in n&&t._pipeline.actor.getProperty().setLighting(n.lighting),jt.setGet(e,t._pipeline,["defaultScale"]),jt.get(e,t._pipeline,["glyph","mapper","actor"]),jt.setGet(e,t.applyMixin,Object.keys(t.applyMixin)),jA(e,t)}var qA={newInstance:jt.newInstance($A,"vtkGlyphRepresentation"),extend:$A};function XA(e,t){t.classHierarchy.push("vtkPixelSpaceCallbackMapper"),t.callback||(t.callback=()=>{}),e.invokeCallback=(e,n,r,o,a)=>{if(!t.callback)return;const i=n.getCompositeProjectionMatrix(r,-1,1);m(i,i);const s=e.getPoints(),l=new Float64Array(3),c=o.usize,u=o.vsize,d=c/2,p=u/2,f=[];for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,YA,n),oc.extend(e,t,n),jt.setGet(e,t,["callback","useZValues"]),XA(e,t)}var QA={newInstance:jt.newInstance(ZA,"vtkPixelSpaceCallbackMapper"),extend:ZA};function JA(e,t){t.classHierarchy.push("vtkCylinderSource"),e.requestData=function(e,n){if(t.deleted)return;let r=n[0];const o=2*Math.PI/t.resolution;let a=2*t.resolution,i=5*t.resolution;t.capping&&(a=4*t.resolution,i=7*t.resolution+2);const s=jt.newTypedArray(t.pointType,3*a);let l=0;const c=new Uint32Array(i),u=new Float32Array(3*a),d=Es.newInstance({numberOfComponents:3,values:u,name:"Normals"}),p=new Float32Array(2*a),f=Es.newInstance({numberOfComponents:2,values:p,name:"TCoords"}),g=[0,0,0],m=[0,0,0],h=[0,0,0],v=[0,0,0],y=[0,0],b=[0,0],x=null==t.otherRadius?t.radius:t.otherRadius;for(let e=0;e-1*e))).apply(s),r=hu.newInstance(),r.getPoints().setData(s,3),r.getPolys().setData(c,1),r.getPointData().setNormals(d),r.getPointData().setTCoords(f),n[0]=r}}const eI={height:1,initAngle:0,radius:1,resolution:6,center:[0,0,0],direction:[0,1,0],capping:!0,pointType:"Float64Array"};function tI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eI,n),jt.obj(e,t),jt.setGet(e,t,["height","initAngle","otherRadius","radius","resolution","capping"]),jt.setGetArray(e,t,["center","direction"],3),jt.algo(e,t,0,1),JA(e,t)}var nI={newInstance:jt.newInstance(tI,"vtkCylinderSource"),extend:tI};function rI(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;e{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)};const r=e.getScale3();e.setScale3(((e,n)=>{if(r(e,n),t.infiniteLine){const t=TA(e,"scale",n.length,"Float32Array",3).getData();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};qA.extend(e,t,oI(n)),jt.setGet(e,t,["infiniteLine","glyphResolution"]),rI(e,t)}var iI={newInstance:jt.newInstance(aI,"vtkLineHandleRepresentation"),extend:aI};function sI(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;et._pipeline.glyph.getPhiResolution(),e.setGlyphResolution=e=>t._pipeline.glyph.setPhiResolution(e)||t._pipeline.glyph.setThetaResolution(e),e.setDisplayCallback=e=>{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)}}function lI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};qA.extend(e,t,n),sI(e,t)}var cI={newInstance:jt.newInstance(lI,"vtkSphereHandleRepresentation"),extend:lI};const uI=0,dI=1,pI=2,fI="translateAxis",gI="rotateLine",mI="translateCenter",hI=(PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE,[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE]),vI=(PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE,["X","Y","Z"]),yI={[PP.YZ_PLANE]:"X",[PP.XZ_PLANE]:"Y",[PP.XY_PLANE]:"Z"},bI={X:PP.YZ_PLANE,Y:PP.XZ_PLANE,Z:PP.XY_PLANE};function xI(e,t,n){const r=[...e];return _f().rotate(n,t).apply(r),r}function TI(e){return e[0]}function CI(e){return e[3]}function SI(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vI;const t=[];return e.forEach((n=>{e.forEach((e=>{n!==e&&t.push(`${n}in${e}`)}))})),t}function PI(e,t){const n=TI(t),r=CI(t),o=function(e){return Object.keys(e.getPlanes()).map((e=>yI[e]))}(e).find((e=>e!==n&&e!==r));return`${o}in${r}`}function AI(e,t,n,r){return Wo([...e],t*(r?1:n)/2)}function II(e,t,n){const r=Object.keys(e.getPlanes()).map((e=>yI[e])),o=r.reduce(((t,n)=>(r.filter((e=>n!==e)).forEach((r=>{const o=$o(e.getPlanes()[bI[n]].normal,e.getPlanes()[bI[r]].normal,[]);t[`${n}${r}`]=o,t[`${r}${n}`]=o})),t)),{}),a=e.getImage().getBounds(),i=e.getCenter(),s=Fi.getDiagonalLength(a);e.getCenterHandle().setOrigin(i),SI(r).forEach((r=>{const a=TI(r),l=CI(r),c=o[`${a}${l}`];e[`getRotationHandle${r}0`]().setOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal),e[`getRotationHandle${r}0`]().setOffset(AI(c,n,s,t)),e[`getRotationHandle${r}1`]().setOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal),e[`getRotationHandle${r}1`]().setOffset(AI(c,-n,s,t));const u=e[`getAxis${r}`]();u.setOrigin(i),u.getManipulator()?.setHandleOrigin(i),u.getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal);const d=Xo(c),p=u.getScale3();p[2]=2*d,u.setScale3(p);const f=e.getPlanes()[bI[l]].normal,g=$o(c,f,[]);u.setRight(f),u.setUp(g),u.setDirection(c)}))}function wI(e,t){t._isDragging=!1;let n,r=!1;jt.setGet(e,t,["keepOrthogonality",{type:"object",name:"cursorStyles"}]),e.setCursorStyles({[mI]:"move",[gI]:"alias",[fI]:"pointer",default:"default"}),e.setEnableTranslation=e=>{t.representations[0].setPickable(e),t.representations[2].setPickable(e)},e.setEnableRotation=e=>{t.representations[1].setPickable(e)},e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("rotation").includes(t.activeState)?gI:t.widgetState.getStatesWithLabel("line").includes(t.activeState)?fI:t.widgetState.getStatesWithLabel("center").includes(t.activeState)?mI:null,e.getActiveLineName=()=>function(e){return SI(Object.keys(e.getPlanes()).map((e=>yI[e])))}(t.widgetState).find((e=>t.widgetState.getStatesWithLabel(e).includes(t.activeState))),e.getActiveLineHandle=()=>t.widgetState[`getAxis${e.getActiveLineName()}`]?.(),e.getOtherLineHandle=e=>t.widgetState[`getAxis${PI(t.widgetState,e)}`]?.(),e.getActiveRotationPointName=()=>t.widgetState.getStatesWithLabel("point0").includes(t.activeState)?"point0":t.widgetState.getStatesWithLabel("point1").includes(t.activeState)?"point1":null,e.startScrolling=t=>{t&&(n=t),r=!0,e.startInteraction()},e.endScrolling=()=>{r=!1,e.endInteraction()},e.updateCursor=()=>{const n=e.getCursorStyles();if(n)switch(e.getActiveInteraction()){case mI:t._apiSpecificRenderWindow.setCursor(n.translateCenter);break;case gI:t._apiSpecificRenderWindow.setCursor(n.rotateLine);break;case fI:t._apiSpecificRenderWindow.setCursor(n.translateAxis);break;default:t._apiSpecificRenderWindow.setCursor(n.default)}},e.handleLeftButtonPress=r=>{if(t.activeState&&t.activeState.getActive()){t._isDragging=!0;const o=t.viewType,a=t.widgetState.getPlanes()[o].normal,i=t.activeState?.getManipulator?.()??t.manipulator;i.setWidgetOrigin(t.widgetState.getCenter()),i.setWidgetNormal(a);const{worldCoords:s}=i.handleEvent(r,t._apiSpecificRenderWindow);n=s,e.startInteraction()}else{if(t.widgetState.getScrollingMethod()!==dI)return jt.VOID;e.startScrolling(r.position)}return jt.EVENT_ABORT},e.handleMouseMove=o=>{if(t._isDragging)return e.handleEvent(o);if(r&&n.y!==o.position.y){const t=n.y-o.position.y;e.translateCenterOnPlaneDirection(t),n=o.position,e.invokeInternalInteractionEvent()}return jt.VOID},e.handleLeftButtonRelease=()=>{(t._isDragging||r)&&e.endScrolling(),t._isDragging=!1,t.widgetState.deactivate()},e.handleRightButtonPress=n=>{t.widgetState.getScrollingMethod()===pI&&e.startScrolling(n.position)},e.handleRightButtonRelease=()=>{t.widgetState.getScrollingMethod()===pI&&e.endScrolling()},e.handleStartMouseWheel=()=>{e.startInteraction()},e.handleMouseWheel=t=>{const n=t.spinY;return r=!0,e.translateCenterOnPlaneDirection(n),e.invokeInternalInteractionEvent(),r=!1,jt.EVENT_ABORT},e.handleEndMouseWheel=()=>{e.endScrolling()},e.handleMiddleButtonPress=n=>{t.widgetState.getScrollingMethod()===uI&&e.startScrolling(n.position)},e.handleMiddleButtonRelease=()=>{t.widgetState.getScrollingMethod()===uI&&e.endScrolling()},e.handleEvent=n=>t.activeState.getActive()?(e[e.getActiveInteraction()](n),e.invokeInternalInteractionEvent(),jt.EVENT_ABORT):jt.VOID,e.invokeInternalInteractionEvent=()=>{const t=e.getActiveInteraction(),n=t!==gI,r=t===gI;e.invokeInteractionEvent({computeFocalPointOffset:n,canUpdateFocalPoint:r})},e.startInteraction=()=>{e.invokeStartInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().requestAnimation(e)}))},e.endInteraction=()=>{e.invokeEndInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().cancelAnimation(e)}))},e.translateCenterOnPlaneDirection=n=>{const r=t.widgetState.getPlanes()[t.viewType].normal,o=t.widgetState.getCenter(),a=t.widgetState.getImage().getSpacing(),i=r.map((e=>Math.abs(e))),s=i.indexOf(Math.max(...i)),l=n*a[s]/Math.abs(r[s]);let c=[o[0]+l*r[0],o[1]+l*r[1],o[2]+l*r[2]];c=e.getBoundedCenter(c),t.widgetState.setCenter(c),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[fI]=r=>{const o=e.getActiveLineHandle(),a=e.getActiveLineName(),i=Uo(o.getOrigin(),o.getDirection(),[]),s=o.getDirection();Xo(s);const l=e.getOtherLineHandle(a),c=t.widgetState.getCenter(),u=t.activeState?.getManipulator?.()??t.manipulator;let d=null,p=[];if(t.activeState?.getManipulator?.())d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Uo(c,zo(d,n,[]),p);else if(l){const e=l.getDirection();Xo(e);const n=e,a=Ko(s,e);1!==a&&-1!==a||$o(s,u.getWidgetNormal(),n);const f=[];d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Qc.distanceToLine(d,o.getOrigin(),i,f),p=jo(c,n,Ko(zo(d,f,[]),n),p)}p=e.getBoundedCenter(p),t.widgetState.setCenter(p),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition()),n=d},e.getBoundedCenter=e=>{const n=t.widgetState.getCenter(),r=t.widgetState.getImage().getBounds();return Fi.containsPoint(r,...e)?e:function(e,t,n){const r=[0,0,0];zo(t,e,r);const o=[0,0,0];return Fi.intersectBox(n,e,r,o,[0,0,0]),o}(e,n,r)},e[mI]=r=>{const o=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:a}=o.handleEvent(r,t._apiSpecificRenderWindow),i=zo(a,n,[]);n=a;let s=Uo(t.widgetState.getCenter(),i,[]);s=e.getBoundedCenter(s),t.widgetState.setCenter(s),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[gI]=n=>{const r=e.getActiveLineHandle(),o=t.activeState?.getManipulator?.()??t.manipulator,a=o.getWidgetNormal(),{worldCoords:i}=o.handleEvent(n,t._apiSpecificRenderWindow);if(!i||!i.length)return;const s=[0,0,0];zo(i,t.widgetState.getCenter(),s),Xo(s);const l=r.getDirection();Xo(l);const c=e.getActiveRotationPointName();("point1"===c||!c&&Ko(s,l)<0)&&Wo(l,-1);const u=Qo(l,s,a);e.rotateLineInView(e.getActiveLineName(),u)},e.rotateLineInView=(n,r)=>{const o=bI[TI(n)],a=bI[CI(n)],i=t.widgetState.getPlanes()[a].normal;if(e.rotatePlane(o,r,i),e.getKeepOrthogonality()){const o=TI(PI(t.widgetState,n));e.rotatePlane(bI[o],r,i)}II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.rotatePlane=(e,n,r)=>{const{normal:o,viewUp:a}=t.widgetState.getPlanes()[e],i=xI(o,r,n),s=xI(a,r,n);t.widgetState.getPlanes()[e]={normal:i,viewUp:s}}}const OI="default";function MI(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function RI(e,t){t.classHierarchy.push("vtkWidgetState");const n=[];t.labels={},t.nestedStates=[],e.bindState=function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[OI];if(t.nestedStates.push(r),n.push(r.onModified(e.modified)),Array.isArray(o)&&o.length)for(let e=0;e{for(;n.length;)n.pop().unsubscribe();MI(t.nestedStates,r);for(let r=0;r{MI(t.labels[e],r)}))},e.unbindAll=()=>{for(;n.length;)n.pop().unsubscribe();t.nestedStates=[]},e.activate=()=>e.setActive(!0),e.deactivate=n=>{n!==e&&e.setActive(!1);for(let e=0;e{t&&t.setActive(!0),e.deactivate(t)},e.getStatesWithLabel=e=>t.labels[e],e.getAllNestedStates=()=>t.nestedStates,e.delete=jt.chain(e.unbindAll,e.delete)}const VI={active:!1};var EI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,VI,n),jt.obj(e,t),jt.setGet(e,t,["active"]),RI(e,t)};function DI(e,t){const n=[],r=[...Fi.INIT_BOUNDS];e.containsPoint=(e,t,n)=>Array.isArray(e)?Fi.containsPoint(r,e[0],e[1],e[2]):Fi.containsPoint(r,e,t,n),e.placeWidget=o=>{t.bounds=[];const a=[(o[0]+o[1])/2,(o[2]+o[3])/2,(o[4]+o[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];n[e]=o[e],t.bounds[e]=(o[e]-r)*t.placeFactor+r}Fi.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()},e.setPlaceFactor=o=>{if(t.placeFactor!==o){t.placeFactor=o,t.bounds=[];const a=[(n[0]+n[1])/2,(n[2]+n[3])/2,(n[4]+n[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];t.bounds[e]=(n[e]-r)*t.placeFactor+r}Fi.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()}}}const LI={bounds:[-1,1,-1,1,-1,1],placeFactor:1};var BI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,LI,n),jt.setGetArray(e,t,["bounds"],6),jt.get(e,t,["placeFactor"]),jt.event(e,t,"BoundsChange"),t.bounds=t.bounds.slice(),DI(e,t)}};const NI={color:.5};var kI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,NI,n),jt.setGet(e,t,["color"])}};const FI={color3:[255,255,255],opacity:255};var _I={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FI,n),jt.setGetArray(e,t,["color3"],3,255),jt.setGet(e,t,["opacity"])}};function GI(e,t){e.translate=(t,n,r)=>{const[o,a,i]=e.getCornerByReference();e.setCorner(o+t,a+n,i+r)}}const UI={corner:[0,0,0]};var zI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UI,n),jt.setGetArray(e,t,["corner"],3),GI(e)}};function WI(e,t){const n="degree"===t.angleUnit?Ff():_f();e.rotateFromDirections=(r,o)=>{n.identity().rotateFromDirections(r,o).apply(t.direction),e.modified()},e.rotate=(e,r)=>{n.identity().rotate(e,r).apply(t.direction)},e.rotateX=e=>{n.identity().rotateX(e).apply(t.direction)},e.rotateY=e=>{n.identity().rotateY(e).apply(t.direction)},e.rotateZ=e=>{n.identity().rotateZ(e).apply(t.direction)}}const HI={direction:[1,0,0]};var jI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,HI,n),jt.setGetArray(e,t,["direction"],3),WI(e,t)}};function KI(e,t){e.updateManipulator=()=>{if(t.manipulator){const{origin:e,normal:n,direction:r}=t,{setHandleOrigin:o,setHandleCenter:a,setHandleNormal:i,setHandleDirection:s}=t.manipulator;e&&o?o(e):e&&a&&a(e),r&&s?s(r):r&&!n&&i?i(r):n&&s&&s(n)}}}const $I={manipulator:null};var qI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$I,n),jt.setGet(e,t,["manipulator"]),KI(e,t)}};const XI={name:""};var YI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XI,n),jt.setGet(e,t,["name"])}};function ZI(e,t){return 3===e.length&&3===t.length&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function QI(e,t){const n={o:[],p1:[],p2:[]};e.normalize=()=>{Xo(t.up),Xo(t.right),Xo(t.direction),e.modified()},e.updateFromOriginRightUp=(r,o,a)=>{(function(e,t,n,r){return ZI(e,r.o)&&ZI(t,r.p1)&&ZI(n,r.p2)})(r,o,a,n)||(n.o=r.slice(),n.p1=o.slice(),n.p2=a.slice(),t.up=[a[0]-r[0],a[1]-r[1],a[2]-r[2]],t.right=[o[0]-r[0],o[1]-r[1],o[2]-r[2]],$o(t.up,t.right,t.direction),$o(t.direction,t.up,t.right),e.normalize(),e.modified())}}const JI={up:[0,1,0],right:[1,0,0],direction:[0,0,1]};var ew={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JI,n),jt.setGetArray(e,t,["up","right","direction"],3),QI(e,t)}};function tw(e,t){const n={...e};e.translate=(t,n,r)=>{const[o,a,i]=e.getOriginByReference();e.setOrigin(o+t,a+n,i+r)},e.getOrigin=e=>{const r=n.getOrigin();if(!t.offset)return r;if(!e)return Ga.add(r,t.offset,r);const o=FP(r,e),{rendererPixelDims:a}=e,i=Math.min(a[0],a[1]);return Ga.multiplyAccumulate(r,t.offset,i*o,r)}}const nw={origin:null,offset:null};var rw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nw,n),jt.setGetArray(e,t,["origin","offset"],3),tw(e,t)}};const ow={scale1:.5};var aw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ow,n),jt.setGet(e,t,["scale1"])}};const iw={scale3:[1,1,1]};var sw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iw,n),jt.setGetArray(e,t,["scale3"],3)}};const lw={text:"DefaultText"};var cw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lw,n),jt.setGet(e,t,["text"])}};const uw={visible:!0};var dw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uw,n),jt.setGet(e,t,["visible"]),e.isVisible=e.getVisible}};const pw={shape:""};var fw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pw,n),jt.setGet(e,t,["shape"])}};const{vtkErrorMacro:gw}=jt,mw={bounds:BI,color:kI,color3:_I,corner:zI,direction:jI,manipulator:qI,name:YI,orientation:ew,origin:rw,scale1:aw,scale3:sw,text:cw,visible:dw,shape:fw};function hw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];o||EI(n,r,t);for(let o=0;o{const r=hw(n,{...o,...e});return this.publicAPI.bindState(r,t),this.model[a].push(r),this.publicAPI.modified(),r},this.publicAPI[`remove${jt.capitalize(r)}`]=e=>{let t=this.model[a].indexOf(e);-1===t&&ethis.model[a].slice(),this.publicAPI[`clear${jt.capitalize(r)}List`]=()=>{for(;this.model[a].length;){const e=this.model[a].pop();e&&this.publicAPI.unbindState(e)}this.publicAPI.modified()},this}addStateFromMixin(e){let{labels:t,mixins:n,name:r,initialValues:o}=e;const a=hw(n,o);return this.model[r]=a,this.publicAPI.bindState(a,t),jt.setGet(this.publicAPI,this.model,[r]),this}addStateFromInstance(e){let{labels:t,name:n,instance:r}=e;return this.model[n]=r,this.publicAPI.bindState(r,t),jt.setGet(this.publicAPI,this.model,[n]),this}addField(e){let{name:t,initialValue:n}=e;return Array.isArray(n)?jt.setGetArray(this.publicAPI,this.model,[t],n.length):jt.setGet(this.publicAPI,this.model,[t]),this.model[t]=n,this}build(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:vI;const t=yw().addField({name:"center",initialValue:[0,0,0]}).addField({name:"image",initialValue:null}).addField({name:"activeViewType",initialValue:null}).addField({name:"planes",initialValue:e.reduce(((e,t)=>({...e,[bI[t]]:{normal:bw[t].normal,viewUp:bw[t].viewUp}})),{})}).addField({name:"scrollingMethod",initialValue:uI}).addField({name:"cameraOffsets",initialValue:{}}).addField({name:"viewUpFromViewType",initialValue:{}}).addStateFromMixin({labels:["handles","sphere","center"],mixins:["origin","color3","scale1","visible","manipulator"],name:"centerHandle",initialValues:{scale1:30,color3:[255,255,255]}});return e.reduce(((t,n)=>e.filter((e=>e!==n)).reduce(((e,t)=>{e.addStateFromMixin({labels:["handles","line",`lineIn${n}`,`${t}in${n}`],mixins:["origin","color3","scale3","orientation","visible","manipulator"],name:`axis${t}in${n}`,initialValues:{scale3:[4,4,4],color3:xw[t]}});for(let r=0;r<2;++r)e.addStateFromMixin({labels:["handles","sphere","rotation",`rotationIn${n}`,`${t}in${n}`,`point${r}`],mixins:["origin","color3","scale1","visible","manipulator"],name:`rotationHandle${t}in${n}${r}`,initialValues:{scale1:30,color3:xw[t]}});return e}),t)),t),t.build()}const{vtkErrorMacro:Cw}=jt;function Sw(e,t){t.classHierarchy.push("vtkResliceCursorWidget"),t.methodsToLink=["scaleInPixels"],e.getRepresentationsForViewType=e=>{switch(e){case PP.XY_PLANE:case PP.XZ_PLANE:case PP.YZ_PLANE:return[{builder:iI,labels:[`lineIn${yI[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels}},{builder:cI,labels:[`rotationIn${yI[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}},{builder:cI,labels:["center"],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}}];case PP.DEFAULT:case PP.GEOMETRY:case PP.SLICE:case PP.VOLUME:default:return[]}},e.setImage=e=>{t.widgetState.setImage(e);const n=e.getCenter();t.widgetState.setCenter(n),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)},e.setCenter=n=>{t.widgetState.setCenter(n),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition),e.modified()},e.updateCameraPoints=(n,r,o,a,i)=>{e.resetCamera(n,r,o,a),i&&function(e,n){const r=n.getActiveCamera().getFocalPoint(),o=t.widgetState.getCenter(),a=n.getRenderWindow().getViews()[0].getViewportSize(n),i=a[0]/a[1],s=zo(n.worldToNormalizedDisplay(...r,i),n.worldToNormalizedDisplay(...o,i),[0,0,0]),l=t.widgetState.getCameraOffsets();l[e]=s,t.widgetState.setCameraOffsets(l)}(r,n)},e.resetCamera=(n,r,o,a)=>{const i=t.widgetState.getImage().getCenter(),s=n.getActiveCamera().getFocalPoint(),l=n.getActiveCamera().getPosition(),c=Math.sqrt(Zo(l,s)),u=e.getPlaneNormalFromViewType(r),d=o?i:s,p=jo(d,u,c,[0,0,0]);n.getActiveCamera().setFocalPoint(...d),n.getActiveCamera().setPosition(...p),n.getActiveCamera().setViewUp(t.widgetState.getPlanes()[r].viewUp),function(e,n,r,o,a){const i=e.getActiveCamera().getFocalPoint(),s=e.getActiveCamera().getDistance(),l=jo(i,n,s,[0,0,0]);let c=i;if(o&&(c=ei.intersectWithLine(i,l,t.widgetState.getCenter(),n).x),a){const o=t.widgetState.getCenter(),a=e.getRenderWindow().getViews()[0].getViewportSize(e),i=a[0]/a[1],s=Uo(e.worldToNormalizedDisplay(...o,i),t.widgetState.getCameraOffsets()[r],[0,0,0]),u=e.normalizedDisplayToWorld(...s,i),d=ei.intersectWithLine(u,l,o,n);c[0]=d.x[0],c[1]=d.x[1],c[2]=d.x[2]}e.getActiveCamera().setFocalPoint(c[0],c[1],c[2]);const u=jo(c,n,s,[0,0,0]);e.getActiveCamera().setPosition(u[0],u[1],u[2]);const d=t.widgetState.getImage().getBounds();o&&e.resetCamera(d),e.resetCameraClippingRange(d)}(n,u,r,o,a)},e.getPlaneSource=n=>{const r=function(n){const r=t.widgetState.getImage().getBounds(),o=e.getWidgetState().getCenter(),a=t.widgetState.getImage().getCenter(),i=[];for(let e=0;e<3;e++)i[e]=-Math.abs(o[e]-a[e]),i[e]*=2;const s=ZP.newInstance();return n===PP.XZ_PLANE?(s.setOrigin(r[0]+i[0],o[1],r[4]+i[2]),s.setPoint1(r[1]-i[0],o[1],r[4]+i[2]),s.setPoint2(r[0]+i[0],o[1],r[5]-i[2])):n===PP.XY_PLANE?(s.setOrigin(r[0]+i[0],r[2]+i[1],o[2]),s.setPoint1(r[1]-i[0],r[2]+i[1],o[2]),s.setPoint2(r[0]+i[0],r[3]-i[1],o[2])):n===PP.YZ_PLANE&&(s.setOrigin(o[0],r[2]+i[1],r[4]+i[2]),s.setPoint1(o[0],r[3]-i[1],r[4]+i[2]),s.setPoint2(o[0],r[2]+i[1],r[5]-i[2])),s}(n),{normal:o,viewUp:a}=t.widgetState.getPlanes()[n];!function(e,t,n,r){e.setNormal(n);const o=Qo(zo(e.getPoint2(),e.getOrigin(),[]),r,n);e.rotate(o,n),e.setCenter(t)}(r,t.widgetState.getCenter(),o,a);const i=[...r.getOrigin()],s=[...r.getPoint1()],l=[...r.getPoint2()];return function(e,t,n,r){const o=[];zo(n,t,o),Xo(o);const a=[];zo(r,t,a),Xo(a);const i=[0,0,1];$o(o,a,i),Xo(i);const s=[...e],l=[...i];Wo(l,1e-6),Fi.addBounds(s,e[0]+l[0],e[1]+l[0],e[2]+l[1],e[3]+l[1],e[4]+l[2],e[5]+l[2]),Fi.addBounds(s,e[0]-l[0],e[1]-l[0],e[2]-l[1],e[3]-l[1],e[4]-l[2],e[5]-l[2]);const c=ei.newInstance();c.setOrigin(...t),c.setNormal(...i);const u=jf.newInstance();u.setBounds(s);const d=Lf.newInstance();d.setCutFunction(c),d.setInputConnection(u.getOutputPort());const p=d.getOutputData();if(0===p.getNumberOfPoints())return!1;const f=Ni.computeLocalBounds(p.getPoints(),o,a,i);for(let e=0;e<3;e+=1)t[e]=f[0]*o[e]+f[2]*a[e]+f[4]*i[e],n[e]=f[1]*o[e]+f[2]*a[e]+f[4]*i[e],r[e]=f[0]*o[e]+f[3]*a[e]+f[4]*i[e]}(t.widgetState.getImage().getBounds(),i,s,l),r.setOrigin(...i),r.setPoint1(...s),r.setPoint2(...l),r},e.getResliceAxes=n=>{const r=e.getPlaneSource(n),{normal:o}=t.widgetState.getPlanes()[n],a=r.getOrigin(),i=[];zo(r.getPoint1(),a,i),Xo(i);const s=[];zo(r.getPoint2(),a,s),Xo(s);const l=g(new Float64Array(16));for(let e=0;e<3;e++)l[e]=i[e],l[4+e]=s[e],l[8+e]=o[e],l[12+e]=a[e];return l},e.updateReslicePlane=(n,r)=>{const o=t.widgetState.getImage().getSpacing(),a=e.getPlaneSource(r),i=e.getResliceAxes(r),s=a.getOrigin(),l=zo(a.getPoint1(),s,[]),c=Xo(l),u=zo(a.getPoint2(),s,[]),d=Xo(u),p=Math.abs(l[0]*o[0])+Math.abs(l[1]*o[1])+Math.abs(l[2]*o[2]),f=Math.abs(u[0]*o[0])+Math.abs(u[1]*o[1])+Math.abs(u[2]*o[2]);let g=0,m=0;const h=0===p?Number.MAX_SAFE_INTEGER:c/p,v=1073741823;if(h>v)Cw("Invalid X extent: ",h," on view type : ",r),g=0;else for(g=1;gv)Cw("Invalid Y extent:",y," on view type : ",r),m=0;else for(m=1;m{const n=ZP.newInstance(),r=e.getWidgetState().getCenter(),o=e.getPlaneNormalFromViewType(t);return n.setNormal(o),n.setOrigin(r),n},e.getPlaneNormalFromViewType=t=>e.getWidgetState().getPlanes()[t].normal,e.getOtherPlaneNormals=t=>[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE].filter((e=>e!==t)).map((t=>e.getPlaneNormalFromViewType(t))),e.getResliceMatrix=()=>{const t=g(new Float64Array(16));for(let n=0;n<3;n++)t[4*n+0]=e.getPlaneNormalFromViewType(PP.YZ_PLANE)[n],t[4*n+1]=e.getPlaneNormalFromViewType(PP.XZ_PLANE)[n],t[4*n+2]=e.getPlaneNormalFromViewType(PP.XY_PLANE)[n];const n=e.getWidgetState().getCenter();return _f().translate(...n).multiply(t).translate(...Wo([...n],-1)).getMatrix()},e.getDisplayScaleParams=()=>[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE].reduce(((t,n)=>(t[n]=function(t){const n=function(t){return e.getViewIds().map((t=>e.getWidgetForView({viewId:t}))).find((e=>e.getViewType()===t))}(t);return n?n.getRepresentations():[]}(n)[0]?.getDisplayScaleParams?.(),t)),{}),e.setScaleInPixels=jt.chain(e.setScaleInPixels,(n=>{e.getViewWidgets().forEach((e=>e.setScaleInPixels(n))),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)}))}const Pw=e=>({behavior:wI,widgetState:Tw(e.planes),rotationHandlePosition:.5,scaleInPixels:!0,manipulator:iA.newInstance(),...e});function Aw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pw(n)),KP.extend(e,t,n),jt.setGet(e,t,["scaleInPixels","rotationHandlePosition","manipulator"]),Sw(e,t)}var Iw={newInstance:jt.newInstance(Aw,"vtkResliceCursorWidget"),extend:Aw},ww=Uint8Array,Ow=Uint16Array,Mw=Uint32Array,Rw=new ww([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,0,0,0]),Vw=new ww([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,0,0]),Ew=new ww([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dw=function(e,t){for(var n=new Ow(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Gw)<<1;Uw=(61680&(Uw=(52428&Uw)>>>2|(13107&Uw)<<2))>>>4|(3855&Uw)<<4,_w[Gw]=((65280&Uw)>>>8|(255&Uw)<<8)>>>1}var zw=function(e,t,n){for(var r=e.length,o=0,a=new Ow(t);o>>l]=c}else for(i=new Ow(r),o=0;o>>15-e[o]);return i},Ww=new ww(288);for(Gw=0;Gw<144;++Gw)Ww[Gw]=8;for(Gw=144;Gw<256;++Gw)Ww[Gw]=9;for(Gw=256;Gw<280;++Gw)Ww[Gw]=7;for(Gw=280;Gw<288;++Gw)Ww[Gw]=8;var Hw=new ww(32);for(Gw=0;Gw<32;++Gw)Hw[Gw]=5;var jw=zw(Ww,9,1),Kw=zw(Hw,5,1),$w=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},qw=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Xw=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Yw=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Ow:4==e.BYTES_PER_ELEMENT?Mw:ww)(n-t);return r.set(e.subarray(t,n)),r},Zw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qw=function(e,t,n){var r=new Error(t||Zw[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Qw),!n)throw r;return r},Jw=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new ww(0);var o=!t||n,a=!n||n.i;n||(n={}),t||(t=new ww(3*r));var i,s=function(e){var n=t.length;if(e>n){var r=new ww(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,c=n.p||0,u=n.b||0,d=n.l,p=n.d,f=n.m,g=n.n,m=8*r;do{if(!d){l=qw(e,c,1);var h=qw(e,c+1,3);if(c+=3,!h){var v=e[(i=c,(O=4+((i+7)/8|0))-4)]|e[O-3]<<8,y=O+v;if(y>r){a&&Qw(0);break}o&&s(u+v),t.set(e.subarray(O,y),u),n.b=u+=v,n.p=c=8*y,n.f=l;continue}if(1==h)d=jw,p=Kw,f=9,g=5;else if(2==h){var b=qw(e,c,31)+257,x=qw(e,c+10,15)+4,T=b+qw(e,c+5,31)+1;c+=14;for(var C=new ww(T),S=new ww(19),P=0;P>>4)<16)C[P++]=O;else{var R=0,V=0;for(16==O?(V=3+qw(e,c,3),c+=2,R=C[P-1]):17==O?(V=3+qw(e,c,7),c+=3):18==O&&(V=11+qw(e,c,127),c+=7);V--;)C[P++]=R}}var E=C.subarray(0,b),D=C.subarray(b);f=$w(E),g=$w(D),d=zw(E,f,1),p=zw(D,g,1)}else Qw(1);if(c>m){a&&Qw(0);break}}o&&s(u+131072);for(var L=(1<>>4;if((c+=15&R)>m){a&&Qw(0);break}if(R||Qw(2),k<256)t[u++]=k;else{if(256==k){N=c,d=null;break}var F=k-254;if(k>264){var _=Rw[P=k-257];F=qw(e,c,(1<<_)-1)+Bw[P],c+=_}var G=p[Xw(e,c)&B],U=G>>>4;if(G||Qw(3),c+=15&G,D=Fw[U],U>3&&(_=Vw[U],D+=Xw(e,c)&(1<<_)-1,c+=_),c>m){a&&Qw(0);break}o&&s(u+131072);for(var z=u+F;u>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new ww((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function nO(e,t){return Jw(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&Qw(6,"invalid zlib data"),32&n[1]&&Qw(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function rO(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?tO(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return Jw(e,t)}(e,t):nO(e,t)}var oO="undefined"!=typeof TextDecoder&&new TextDecoder;try{oO.decode(eO,{stream:!0})}catch(e){}function aO(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,Yw(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=o[0];return o[1].length&&Qw(8),a}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;const{vtkErrorMacro:iO,vtkDebugMacro:sO}=jt;let lO=0;function cO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const uO={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,a)=>{let i=null;i=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=cO("GET",i,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++lO&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=aO(rO(new Uint8Array(n.buffer))):n.buffer=rO(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(wb!==n.ref.encode&&wb&&(sO(`Swap bytes of ${n.name}`),Ob(n.buffer,vs[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&iO(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const a=cO("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++lO&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(JSON.parse(aO(rO(new Uint8Array(a.response))))):r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(iO("Supported algorithms are: [gz]"),iO(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const a=cO("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++lO&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(aO(rO(new Uint8Array(a.response)))):r(a.responseText):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(iO("Supported algorithms are: [gz]"),iO(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=cO("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(rO(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};bb("http",(e=>uO));const dO=[[1,0,0],[0,1,0],[0,0,1],[.5,.5,.5]],pO=[],fO=Iw.newInstance(),gO=fO.getWidgetState();gO.getStatesWithLabel("sphere").forEach((e=>e.setScale1(20)));const mO={translateCenter:"move",rotateLine:"alias",translateAxis:"pointer",default:"default"},hO=document.querySelector("body"),vO=document.createElement("div");vO.innerHTML='
    Allow translation:
    Show rotation:
    Allow rotation:
    Keep orthogonality:
    Scale in pixels:
    Opacity : 255
    Slab Mode :
    Slab Number of Slices : 1
    Interpolation mode :
    Window Level:
    ',hO.appendChild(vO);const yO=document.getElementById("checkboxTranslation"),bO=document.getElementById("checkboxShowRotation"),xO=document.getElementById("checkboxRotation"),TO=document.getElementById("checkboxOrthogonality");function CO(e){return 3!==e.length?"rgb(0, 0, 0)":`rgb(${(255*e[0]).toString()}, ${(255*e[1]).toString()}, ${(255*e[2]).toString()})`}const SO={...gO.getPlanes()};let PO=null;for(let e=0;e<4;e++){const t=document.createElement("div");t.setAttribute("class","view"),t.style.width="50%",t.style.height="300px",t.style.display="inline-block",hO.appendChild(t);const n=iS.newInstance();n.setContainer(t),n.resize();const r={renderWindow:n.getRenderWindow(),renderer:n.getRenderer(),GLWindow:n.getApiSpecificRenderWindow(),interactor:n.getInteractor(),widgetManager:zP.newInstance(),orientationWidget:null};r.renderer.getActiveCamera().setParallelProjection(!0),r.renderer.setBackground(...dO[e]),r.renderWindow.addRenderer(r.renderer),r.renderWindow.addView(r.GLWindow),r.renderWindow.setInteractor(r.interactor),r.interactor.setView(r.GLWindow),r.interactor.initialize(),r.interactor.bindEvents(t),r.widgetManager.setRenderer(r.renderer),e<3?(r.interactor.setInteractorStyle(cP.newInstance()),r.widgetInstance=r.widgetManager.addWidget(fO,hI[e]),r.widgetInstance.setScaleInPixels(!0),r.widgetInstance.setKeepOrthogonality(TO.checked),r.widgetInstance.setCursorStyles(mO),r.widgetManager.enablePicking(),r.widgetManager.setCaptureOn(IP.MOUSE_MOVE)):r.interactor.setInteractorStyle(eT.newInstance()),r.reslice=qS.newInstance(),r.reslice.setSlabMode(US.MEAN),r.reslice.setSlabNumberOfSlices(1),r.reslice.setTransformInputSampling(!1),r.reslice.setAutoCropOutput(!0),r.reslice.setOutputDimensionality(2),r.resliceMapper=vS.newInstance(),r.resliceMapper.setInputConnection(r.reslice.getOutputPort()),r.resliceActor=aP.newInstance(),r.resliceActor.setMapper(r.resliceMapper),r.sphereActors=[],r.sphereSources=[];for(let t=0;t<3;t++){const t=BA.newInstance();t.setRadius(10);const n=oc.newInstance();n.setInputConnection(t.getOutputPort());const o=hs.newInstance();o.setMapper(n),o.getProperty().setColor(...dO[e]),o.setVisibility(!0),r.sphereActors.push(o),r.sphereSources.push(t)}e<3?pO.push(r):PO=r;const o=hb.newInstance();o.setDefaultStyle({text:"+X",fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:CO(dO[0]),faceRotation:0,edgeThickness:.1,edgeColor:"black",resolution:400}),o.setXMinusFaceProperty({text:"-X",faceColor:CO(dO[0]),faceRotation:90,fontStyle:"italic"}),o.setYPlusFaceProperty({text:"+Y",faceColor:CO(dO[1]),fontSizeScale:e=>e/4}),o.setYMinusFaceProperty({text:"-Y",faceColor:CO(dO[1]),fontColor:"white"}),o.setZPlusFaceProperty({text:"+Z",faceColor:CO(dO[2])}),o.setZMinusFaceProperty({text:"-Z",faceColor:CO(dO[2]),faceRotation:45}),r.orientationWidget=SP.newInstance({actor:o,interactor:r.renderWindow.getInteractor()}),r.orientationWidget.setEnabled(!0),r.orientationWidget.setViewportCorner(SP.Corners.BOTTOM_RIGHT),r.orientationWidget.setViewportSize(.15),r.orientationWidget.setMinPixelSize(100),r.orientationWidget.setMaxPixelSize(300)}function AO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{viewType:"",reslice:null,actor:null,renderer:null,resetFocalPoint:!1,keepFocalPointPosition:!1,computeFocalPointOffset:!1,spheres:null};const t=fO.updateReslicePlane(e.reslice,e.viewType);if(t){const t=e.reslice.getResliceAxes();e.actor.setUserMatrix(t);const n=fO.getPlaneSource(e.viewType);e.sphereSources[0].setCenter(n.getOrigin()),e.sphereSources[1].setCenter(n.getPoint1()),e.sphereSources[2].setCenter(n.getPoint2())}return fO.updateCameraPoints(e.renderer,e.viewType,e.resetFocalPoint,e.keepFocalPointPosition,e.computeFocalPointOffset),PO.renderWindow.render(),t}const IO=zb.newInstance({fetchGzip:!0});function wO(){pO.forEach(((e,t)=>{AO({viewType:hI[t],reslice:e.reslice,actor:e.resliceActor,renderer:e.renderer,resetFocalPoint:!0,keepFocalPointPosition:!1,computeFocalPointOffset:!0,sphereSources:e.sphereSources,resetViewUp:!0}),e.renderWindow.render()})),PO.renderer.resetCamera(),PO.renderer.resetCameraClippingRange()}IO.setUrl("/vtk-js/data/volume/LIDC2.vti").then((()=>{IO.loadData().then((()=>{const e=IO.getOutputData();fO.setImage(e);const t=hP.newInstance();t.setInputData(e);const n=oc.newInstance();n.setInputData(t.getOutputData());const r=hs.newInstance();r.setMapper(n),PO.renderer.addActor(r),pO.forEach(((t,n)=>{t.reslice.setInputData(e),t.renderer.addActor(t.resliceActor),PO.renderer.addActor(t.resliceActor),t.sphereActors.forEach((e=>{t.renderer.addActor(e),PO.renderer.addActor(e)}));const r=t.reslice,o=hI[n];pO.forEach((e=>{e.widgetInstance.onInteractionEvent((e=>{let{computeFocalPointOffset:n,canUpdateFocalPoint:a}=e;const i=fO.getWidgetState().getActiveViewType()!==o&&a;AO({viewType:o,reslice:r,actor:t.resliceActor,renderer:t.renderer,resetFocalPoint:!1,keepFocalPointPosition:i,computeFocalPointOffset:n,sphereSources:t.sphereSources})}))})),AO({viewType:o,reslice:r,actor:t.resliceActor,renderer:t.renderer,resetFocalPoint:!0,keepFocalPointPosition:!1,computeFocalPointOffset:!0,sphereSources:t.sphereSources}),t.interactor.render()})),PO.renderer.resetCamera(),PO.renderer.resetCameraClippingRange();const o=Sn(e.getDimensions());document.getElementById("slabNumber").max=o}))})),yO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setEnableTranslation(yO.checked)))})),bO.addEventListener("change",(e=>{gO.getStatesWithLabel("rotation").forEach((e=>e.setVisible(bO.checked))),pO.forEach((e=>{e.interactor.render()})),xO.checked=bO.checked,xO.disabled=!bO.checked,xO.dispatchEvent(new Event("change"))})),xO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setEnableRotation(xO.checked))),TO.disabled=!xO.checked,TO.dispatchEvent(new Event("change"))})),TO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setKeepOrthogonality(TO.checked)))}));const OO=document.getElementById("checkboxScaleInPixels");OO.addEventListener("change",(e=>{fO.setScaleInPixels(OO.checked),pO.forEach((e=>{e.interactor.render()}))})),document.getElementById("opacity").addEventListener("input",(e=>{document.getElementById("opacityValue").innerHTML=e.target.value,fO.getWidgetState().getStatesWithLabel("handles").forEach((t=>t.setOpacity(e.target.value))),pO.forEach((e=>{e.interactor.render()}))})),document.getElementById("slabModeMin").value=US.MIN,document.getElementById("slabModeMax").value=US.MAX,document.getElementById("slabModeMean").value=US.MEAN,document.getElementById("slabModeSum").value=US.SUM,document.getElementById("slabMode").addEventListener("change",(e=>{pO.forEach((t=>{t.reslice.setSlabMode(Number(e.target.value))})),wO()})),document.getElementById("slabNumber").addEventListener("change",(e=>{document.getElementById("slabNumberValue").innerHTML=e.target.value,pO.forEach((t=>{t.reslice.setSlabNumberOfSlices(e.target.value)})),wO()})),document.getElementById("buttonReset").addEventListener("click",(()=>{gO.setPlanes({...SO}),fO.setCenter(fO.getWidgetState().getImage().getCenter()),wO()})),document.getElementById("selectInterpolation").addEventListener("change",(e=>{pO.forEach((t=>{t.reslice.setInterpolationMode(Number(e.target.selectedIndex))})),wO()}));const MO=document.getElementById("checkboxWindowLevel");MO.addEventListener("change",(e=>{pO.forEach(((e,t)=>{t<3&&e.interactor.setInteractorStyle(MO.checked?cP.newInstance():eT.newInstance())}))}))},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),a=Object.prototype.toString,i=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),c=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===a.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},a=r(t);o&&(a=i.call(a,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var h=0;h=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),a=n(965),i=n(332),s=n(65),l=n(182),c=n(293);c.alea=r,c.xor128=o,c.xorwow=a,c.xorshift7=i,c.xor4096=s,c.tychei=l,e.exports=c},64:function(e,t,n){var r;!function(e,o,a){function i(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new i(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,a=t.i;return t.w=r=r+1640531527|0,n=o[a+34&127],e=o[a=a+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[a]=n^e,t.i=a,n+(r^r>>>16)|0},function(e,t){var n,r,o,a,i,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,a=-32;a>>15,r^=r<<4,r^=r>>>13,a>=0&&(i=i+1640531527|0,o=0==(n=s[127&a]^=r+i)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,a=512;a>0;--a)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=i,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,a,i){var s,l=256,c=i.pow(l,6),u=i.pow(2,52),d=2*u,p=255;function f(e,t,n){var r=[],p=v(h((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(a)]}}():e,3),r),f=new g(r),b=function(){for(var e=f.g(6),t=c,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),a),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(i.random=e,t):e})(b,p,"global"in t?t.global:this==i,t.state)}function g(e){var t,n=e.length,r=this,o=0,a=r.i=r.j=0,i=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|a>>>20)+n|0)&n|~a&r)+t[2]+606105819|0)<<17|o>>>15)+a|0)&a|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|a>>>20)+n|0)&n|~a&r)+t[6]-1473231341|0)<<17|o>>>15)+a|0)&a|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|a>>>20)+n|0)&n|~a&r)+t[10]-42063|0)<<17|o>>>15)+a|0)&a|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|a>>>20)+n|0)&n|~a&r)+t[14]-1502002290|0)<<17|o>>>15)+a|0)&a|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|a>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+a|0)&n|a&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|a>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+a|0)&n|a&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|a>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+a|0)&n|a&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|a>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+a|0)&n|a&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|a>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+a|0)^a^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|a>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+a|0)^a^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|a>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+a|0)^a^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|a>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+a|0)^a^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[14]-1416354905|0)<<15|o>>>17)+a|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[10]-1051523|0)<<15|o>>>17)+a|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[6]-1560198380|0)<<15|o>>>17)+a|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[2]+718787259|0)<<15|o>>>17)+a|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function a(e){var t,o,a,i,s,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}function i(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tc?new ArrayBuffer(0):(r=c-l,o=new ArrayBuffer(r),a=new Uint8Array(o),i=new Uint8Array(this,l,r),a.set(i),o)}}(),u.prototype.append=function(e){return this.appendBinary(l(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},u.prototype.end=function(e){var t,n,r=this._buff,o=r.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,t){var r,o,a,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(n(this._hash,e),i=0;i<16;i+=1)e[i]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),a=parseInt(r[1],16)||0,e[14]=o,e[15]=a,n(this._hash,e)},u.hash=function(e,t){return u.hashBinary(l(e),t)},u.hashBinary=function(e,t){var n=s(a(e));return t?c(n):n},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var t,r,a,i,s,l=(r=this._buff.buffer,a=e,i=!0,(s=new Uint8Array(r.byteLength+a.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(a),r.byteLength),i?s:s.buffer),c=l.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),a=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}(new Uint8Array(e)));return t?c(r):r},u}()},782:function(e,t,n){var r=n(860),o=n(903);void 0===o.ResliceCursorWidget&&(o.ResliceCursorWidget=r),e.exports=r},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n(782)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},860:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return Q},adjoint:function(){return v},clone:function(){return u},copy:function(){return d},create:function(){return c},determinant:function(){return y},equals:function(){return re},exactEquals:function(){return ne},frob:function(){return Z},fromQuat:function(){return _},fromQuat2:function(){return D},fromRotation:function(){return O},fromRotationTranslation:function(){return E},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return F},fromScaling:function(){return w},fromTranslation:function(){return I},fromValues:function(){return p},fromXRotation:function(){return M},fromYRotation:function(){return R},fromZRotation:function(){return V},frustum:function(){return G},getRotation:function(){return N},getScaling:function(){return B},getTranslation:function(){return L},identity:function(){return g},invert:function(){return h},lookAt:function(){return q},mul:function(){return oe},multiply:function(){return b},multiplyScalar:function(){return ee},multiplyScalarAndAdd:function(){return te},ortho:function(){return K},orthoNO:function(){return j},orthoZO:function(){return $},perspective:function(){return z},perspectiveFromFieldOfView:function(){return H},perspectiveNO:function(){return U},perspectiveZO:function(){return W},rotate:function(){return C},rotateX:function(){return S},rotateY:function(){return P},rotateZ:function(){return A},scale:function(){return T},set:function(){return f},str:function(){return Y},sub:function(){return ae},subtract:function(){return J},targetTo:function(){return X},translate:function(){return x},transpose:function(){return m}});var o={};n.r(o),n.d(o,{add:function(){return Re},adjoint:function(){return me},clone:function(){return le},copy:function(){return ce},create:function(){return ie},determinant:function(){return he},equals:function(){return Be},exactEquals:function(){return Le},frob:function(){return Me},fromMat2d:function(){return Pe},fromMat4:function(){return se},fromQuat:function(){return Ae},fromRotation:function(){return Ce},fromScaling:function(){return Se},fromTranslation:function(){return Te},fromValues:function(){return ue},identity:function(){return pe},invert:function(){return ge},mul:function(){return Ne},multiply:function(){return ve},multiplyScalar:function(){return Ee},multiplyScalarAndAdd:function(){return De},normalFromMat4:function(){return Ie},projection:function(){return we},rotate:function(){return be},scale:function(){return xe},set:function(){return de},str:function(){return Oe},sub:function(){return ke},subtract:function(){return Ve},translate:function(){return ye},transpose:function(){return fe}}),n(334);var a=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var s=Math.PI/180;function l(e){return e*s}function c(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function p(e,t,n,r,o,a,s,l,c,u,d,p,f,g,m,h){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=d,v[11]=p,v[12]=f,v[13]=g,v[14]=m,v[15]=h,v}function f(e,t,n,r,o,a,i,s,l,c,u,d,p,f,g,m,h){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=g,e[14]=m,e[15]=h,e}function g(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function m(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],a=t[6],i=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=o,e[13]=i,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function h(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,P=u*m-d*g,A=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*A+S*P;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(o*O-r*M-a*w)*R,e[2]=(m*S-h*C+v*T)*R,e[3]=(p*C-d*S-f*T)*R,e[4]=(l*I-i*M-c*A)*R,e[5]=(n*M-o*I+a*A)*R,e[6]=(h*x-g*S-v*b)*R,e[7]=(u*S-p*x+f*b)*R,e[8]=(i*O-s*I+c*P)*R,e[9]=(r*I-n*O-a*P)*R,e[10]=(g*C-m*x+v*y)*R,e[11]=(d*x-u*C-f*y)*R,e[12]=(s*A-i*w-l*P)*R,e[13]=(n*w-r*A+o*P)*R,e[14]=(m*b-g*T-h*y)*R,e[15]=(u*T-d*b+p*y)*R,e):null}function v(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15];return e[0]=s*(p*v-f*h)-d*(l*v-c*h)+m*(l*f-c*p),e[1]=-(r*(p*v-f*h)-d*(o*v-a*h)+m*(o*f-a*p)),e[2]=r*(l*v-c*h)-s*(o*v-a*h)+m*(o*c-a*l),e[3]=-(r*(l*f-c*p)-s*(o*f-a*p)+d*(o*c-a*l)),e[4]=-(i*(p*v-f*h)-u*(l*v-c*h)+g*(l*f-c*p)),e[5]=n*(p*v-f*h)-u*(o*v-a*h)+g*(o*f-a*p),e[6]=-(n*(l*v-c*h)-i*(o*v-a*h)+g*(o*c-a*l)),e[7]=n*(l*f-c*p)-i*(o*f-a*p)+u*(o*c-a*l),e[8]=i*(d*v-f*m)-u*(s*v-c*m)+g*(s*f-c*d),e[9]=-(n*(d*v-f*m)-u*(r*v-a*m)+g*(r*f-a*d)),e[10]=n*(s*v-c*m)-i*(r*v-a*m)+g*(r*c-a*s),e[11]=-(n*(s*f-c*d)-i*(r*f-a*d)+u*(r*c-a*s)),e[12]=-(i*(d*h-p*m)-u*(s*h-l*m)+g*(s*p-l*d)),e[13]=n*(d*h-p*m)-u*(r*h-o*m)+g*(r*p-o*d),e[14]=-(n*(s*h-l*m)-i*(r*h-o*m)+g*(r*l-o*s)),e[15]=n*(s*p-l*d)-i*(r*p-o*d)+u*(r*l-o*s),e}function y(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],h=e[15];return(t*i-n*a)*(d*h-p*m)-(t*s-r*a)*(u*h-p*g)+(t*l-o*a)*(u*m-d*g)+(n*s-r*i)*(c*h-p*f)-(n*l-o*i)*(c*m-d*f)+(r*l-o*s)*(c*g-u*f)}function b(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],m=t[12],h=t[13],v=t[14],y=t[15],b=n[0],x=n[1],T=n[2],C=n[3];return e[0]=b*r+x*s+T*d+C*m,e[1]=b*o+x*l+T*p+C*h,e[2]=b*a+x*c+T*f+C*v,e[3]=b*i+x*u+T*g+C*y,b=n[4],x=n[5],T=n[6],C=n[7],e[4]=b*r+x*s+T*d+C*m,e[5]=b*o+x*l+T*p+C*h,e[6]=b*a+x*c+T*f+C*v,e[7]=b*i+x*u+T*g+C*y,b=n[8],x=n[9],T=n[10],C=n[11],e[8]=b*r+x*s+T*d+C*m,e[9]=b*o+x*l+T*p+C*h,e[10]=b*a+x*c+T*f+C*v,e[11]=b*i+x*u+T*g+C*y,b=n[12],x=n[13],T=n[14],C=n[15],e[12]=b*r+x*s+T*d+C*m,e[13]=b*o+x*l+T*p+C*h,e[14]=b*a+x*c+T*f+C*v,e[15]=b*i+x*u+T*g+C*y,e}function x(e,t,n){var r,o,a,i,s,l,c,u,d,p,f,g,m=n[0],h=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*h+t[8]*v+t[12],e[13]=t[1]*m+t[5]*h+t[9]*v+t[13],e[14]=t[2]*m+t[6]*h+t[10]*v+t[14],e[15]=t[3]*m+t[7]*h+t[11]*v+t[15]):(r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=t[9],f=t[10],g=t[11],e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=d,e[9]=p,e[10]=f,e[11]=g,e[12]=r*m+s*h+d*v+t[12],e[13]=o*m+l*h+p*v+t[13],e[14]=a*m+c*h+f*v+t[14],e[15]=i*m+u*h+g*v+t[15]),e}function T(e,t,n){var r=n[0],o=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function C(e,t,n,r){var o,i,s,l,c,u,d,p,f,g,m,h,v,y,b,x,T,C,S,P,A,I,w,O,M=r[0],R=r[1],V=r[2],E=Math.hypot(M,R,V);return E0?(n[0]=2*(l*s+d*r+c*a-u*o)/p,n[1]=2*(c*s+d*o+u*r-l*a)/p,n[2]=2*(u*s+d*a+l*o-c*r)/p):(n[0]=2*(l*s+d*r+c*a-u*o),n[1]=2*(c*s+d*o+u*r-l*a),n[2]=2*(u*s+d*a+l*o-c*r)),E(e,t,n),e}function L(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function B(e,t){var n=t[0],r=t[1],o=t[2],a=t[4],i=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(a,i,s),e[2]=Math.hypot(l,c,u),e}function N(e,t){var n=new i(3);B(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,c=t[2]*a,u=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,g=t[9]*o,m=t[10]*a,h=s+d+m,v=0;return h>0?(v=2*Math.sqrt(h+1),e[3]=.25*v,e[0]=(p-g)/v,e[1]=(f-c)/v,e[2]=(l-u)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-g)/v,e[0]=.25*v,e[1]=(l+u)/v,e[2]=(f+c)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-c)/v,e[0]=(l+u)/v,e[1]=.25*v,e[2]=(p+g)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-u)/v,e[0]=(f+c)/v,e[1]=(p+g)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],a=t[1],i=t[2],s=t[3],l=o+o,c=a+a,u=i+i,d=o*l,p=o*c,f=o*u,g=a*c,m=a*u,h=i*u,v=s*l,y=s*c,b=s*u,x=r[0],T=r[1],C=r[2];return e[0]=(1-(g+h))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*T,e[5]=(1-(d+h))*T,e[6]=(m+v)*T,e[7]=0,e[8]=(f+y)*C,e[9]=(m-v)*C,e[10]=(1-(d+g))*C,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function F(e,t,n,r,o){var a=t[0],i=t[1],s=t[2],l=t[3],c=a+a,u=i+i,d=s+s,p=a*c,f=a*u,g=a*d,m=i*u,h=i*d,v=s*d,y=l*c,b=l*u,x=l*d,T=r[0],C=r[1],S=r[2],P=o[0],A=o[1],I=o[2],w=(1-(m+v))*T,O=(f+x)*T,M=(g-b)*T,R=(f-x)*C,V=(1-(p+v))*C,E=(h+y)*C,D=(g+b)*S,L=(h-y)*S,B=(1-(p+m))*S;return e[0]=w,e[1]=O,e[2]=M,e[3]=0,e[4]=R,e[5]=V,e[6]=E,e[7]=0,e[8]=D,e[9]=L,e[10]=B,e[11]=0,e[12]=n[0]+P-(w*P+R*A+D*I),e[13]=n[1]+A-(O*P+V*A+L*I),e[14]=n[2]+I-(M*P+E*A+B*I),e[15]=1,e}function _(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[1]=u+v,e[2]=p-h,e[3]=0,e[4]=u-v,e[5]=1-c-g,e[6]=f+m,e[7]=0,e[8]=p+h,e[9]=f-m,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function G(e,t,n,r,o,a,i){var s=1/(n-t),l=1/(o-r),c=1/(a-i);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(i+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*a*2*c,e[15]=0,e}function U(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=(o+r)*a,e[14]=2*o*r*a):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var z=U;function W(e,t,n,r,o){var a,i=1/Math.tan(t/2);return e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(a=1/(r-o),e[10]=o*a,e[14]=o*r*a):(e[10]=-1,e[14]=-r),e}function H(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(i+s),c=2/(o+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(i-s)*l*.5,e[9]=(o-a)*c*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function j(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(i+a)*c,e[15]=1,e}var K=j;function $(e,t,n,r,o,a,i){var s=1/(t-n),l=1/(r-o),c=1/(a-i);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=a*c,e[15]=1,e}function q(e,t,n,r){var o,i,s,l,c,u,d,p,f,m,h=t[0],v=t[1],y=t[2],b=r[0],x=r[1],T=r[2],C=n[0],S=n[1],P=n[2];return Math.abs(h-C)0&&(u*=f=1/Math.sqrt(f),d*=f,p*=f);var g=l*p-c*d,m=c*u-s*p,h=s*d-l*u;return(f=g*g+m*m+h*h)>0&&(g*=f=1/Math.sqrt(f),m*=f,h*=f),e[0]=g,e[1]=m,e[2]=h,e[3]=0,e[4]=d*h-p*m,e[5]=p*g-u*h,e[6]=u*m-d*g,e[7]=0,e[8]=u,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=a,e[14]=i,e[15]=1,e}function Y(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Z(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Q(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function J(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function te(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function ne(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function re(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=e[9],f=e[10],g=e[11],m=e[12],h=e[13],v=e[14],y=e[15],b=t[0],x=t[1],T=t[2],C=t[3],S=t[4],P=t[5],A=t[6],I=t[7],w=t[8],O=t[9],M=t[10],R=t[11],V=t[12],E=t[13],D=t[14],L=t[15];return Math.abs(n-b)<=a*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=a*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-T)<=a*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-C)<=a*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(s-S)<=a*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-P)<=a*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-A)<=a*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(u-I)<=a*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-w)<=a*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-O)<=a*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(f-M)<=a*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(g-R)<=a*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(m-V)<=a*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(h-E)<=a*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(v-D)<=a*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-L)<=a*Math.max(1,Math.abs(y),Math.abs(L))}var oe=b,ae=J;function ie(){var e=new i(9);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function se(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function le(e){var t=new i(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ce(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ue(e,t,n,r,o,a,s,l,c){var u=new i(9);return u[0]=e,u[1]=t,u[2]=n,u[3]=r,u[4]=o,u[5]=a,u[6]=s,u[7]=l,u[8]=c,u}function de(e,t,n,r,o,a,i,s,l,c){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=i,e[6]=s,e[7]=l,e[8]=c,e}function pe(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function fe(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function ge(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*i-s*c,p=-u*a+s*l,f=c*a-i*l,g=n*d+r*p+o*f;return g?(g=1/g,e[0]=d*g,e[1]=(-u*r+o*c)*g,e[2]=(s*r-o*i)*g,e[3]=p*g,e[4]=(u*n-o*l)*g,e[5]=(-s*n+o*a)*g,e[6]=f*g,e[7]=(-c*n+r*l)*g,e[8]=(i*n-r*a)*g,e):null}function me(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=i*u-s*c,e[1]=o*c-r*u,e[2]=r*s-o*i,e[3]=s*l-a*u,e[4]=n*u-o*l,e[5]=o*a-n*s,e[6]=a*c-i*l,e[7]=r*l-n*c,e[8]=n*i-r*a,e}function he(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],i=e[5],s=e[6],l=e[7],c=e[8];return t*(c*a-i*l)+n*(-c*o+i*s)+r*(l*o-a*s)}function ve(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1],g=n[2],m=n[3],h=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*i+g*c,e[1]=p*o+f*s+g*u,e[2]=p*a+f*l+g*d,e[3]=m*r+h*i+v*c,e[4]=m*o+h*s+v*u,e[5]=m*a+h*l+v*d,e[6]=y*r+b*i+x*c,e[7]=y*o+b*s+x*u,e[8]=y*a+b*l+x*d,e}function ye(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=n[0],f=n[1];return e[0]=r,e[1]=o,e[2]=a,e[3]=i,e[4]=s,e[5]=l,e[6]=p*r+f*i+c,e[7]=p*o+f*s+u,e[8]=p*a+f*l+d,e}function be(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],p=Math.sin(n),f=Math.cos(n);return e[0]=f*r+p*i,e[1]=f*o+p*s,e[2]=f*a+p*l,e[3]=f*i-p*r,e[4]=f*s-p*o,e[5]=f*l-p*a,e[6]=c,e[7]=u,e[8]=d,e}function xe(e,t,n){var r=n[0],o=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Te(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Ce(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Se(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Pe(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function Ae(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=n+n,s=r+r,l=o+o,c=n*i,u=r*i,d=r*s,p=o*i,f=o*s,g=o*l,m=a*i,h=a*s,v=a*l;return e[0]=1-d-g,e[3]=u-v,e[6]=p+h,e[1]=u+v,e[4]=1-c-g,e[7]=f-m,e[2]=p-h,e[5]=f+m,e[8]=1-c-d,e}function Ie(e,t){var n=t[0],r=t[1],o=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],p=t[10],f=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*i,b=n*l-o*i,x=n*c-a*i,T=r*l-o*s,C=r*c-a*s,S=o*c-a*l,P=u*m-d*g,A=u*h-p*g,I=u*v-f*g,w=d*h-p*m,O=d*v-f*m,M=p*v-f*h,R=y*M-b*O+x*w+T*I-C*A+S*P;return R?(R=1/R,e[0]=(s*M-l*O+c*w)*R,e[1]=(l*I-i*M-c*A)*R,e[2]=(i*O-s*I+c*P)*R,e[3]=(o*O-r*M-a*w)*R,e[4]=(n*M-o*I+a*A)*R,e[5]=(r*I-n*O-a*P)*R,e[6]=(m*S-h*C+v*T)*R,e[7]=(h*x-g*S-v*b)*R,e[8]=(g*C-m*x+v*y)*R,e):null}function we(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function Oe(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Me(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Re(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}function Ve(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}function Ee(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}function De(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e}function Le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Be(e,t){var n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=t[0],f=t[1],g=t[2],m=t[3],h=t[4],v=t[5],y=t[6],b=t[7],x=t[8];return Math.abs(n-p)<=a*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(r-f)<=a*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-g)<=a*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(i-m)<=a*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-h)<=a*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(l-v)<=a*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=a*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=a*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(d-x)<=a*Math.max(1,Math.abs(d),Math.abs(x))}var Ne=ve,ke=Ve,Fe=n(152),_e=n.n(Fe),Ge=n(177);const Ue=n.n(Ge)()(),ze={vtkObject:()=>null};function We(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return Ue.console&&Ue.console.error&&Ue.console.error("Invalid VTK object"),null;const t=ze[e.vtkClass];if(!t)return Ue.console&&Ue.console.error&&Ue.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=We(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}We.register=function(e,t){ze[e]=t};class He extends Array{push(){for(let e=0;e{$e[e]=qe})),Ue.console=console.hasOwnProperty("log")?console:$e;const Xe={debug:qe,error:Ue.console.error||qe,info:Ue.console.info||qe,log:Ue.console.log||qe,warn:Ue.console.warn||qe};function Ye(e,t){Xe[e]&&(Xe[e]=t||qe)}function Ze(){Xe.log(...arguments)}function Qe(){Xe.info(...arguments)}function Je(){Xe.debug(...arguments)}function et(){Xe.error(...arguments)}function tt(){Xe.warn(...arguments)}const nt={};function rt(e){nt[e]||(Xe.error(e),nt[e]=!0)}const ot=Object.create(null);ot.Float32Array=Float32Array,ot.Float64Array=Float64Array,ot.Uint8Array=Uint8Array,ot.Int8Array=Int8Array,ot.Uint16Array=Uint16Array,ot.Int16Array=Int16Array,ot.Uint32Array=Uint32Array,ot.Int32Array=Int32Array,ot.Uint8ClampedArray=Uint8ClampedArray;try{ot.BigInt64Array=BigInt64Array,ot.BigUint64Array=BigUint64Array}catch{}function at(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),a="B";for(;o>n;)o/=n,a=r.pop();return`${o.toFixed(t)} ${a}`}function dt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function pt(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function ft(e){return Object.values(ot).some((t=>e instanceof t))}function gt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function yt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++je),"classHierarchy"in t){if(!(t.classHierarchy instanceof He)){const e=new He;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?et("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return et("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!1;return Object.keys(n).forEach((i=>{const s=o?null:e[`set${st(i)}`];s&&Array.isArray(n[i])&&s.length>1?a=s(...n[i])||a:s?a=s(n[i])||a:(-1!==["mtime"].indexOf(i)||r||tt(`Warning: Set value to model directly ${i}, ${n[i]}`),a=t[i]!==n[i]||a,t[i]=n[i])})),a},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(mt):ft(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),a=Object.keys(t).sort(),i=Object.keys(o).sort();i.forEach((e=>{const n=a.indexOf(e);-1===n?r&&Je(`add ${e} in shallowCopy`):a.splice(n,1),t[e]=o[e]})),a.length&&r&&Je(`Untouched keys: ${a.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const bt={object:(e,t,n)=>function(){return{...t[n.name]}}};function xt(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=bt[n.type];e[`get${lt(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${lt(n)}`]=()=>t[n]}))}const Tt={enum(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw et(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}throw et(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw et(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${lt(n.name)}Changed`;return o=>{if(!_e()(t[n.name],o)){const a=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,a),e.modified(),!0}return!1}}};function Ct(e){if("object"==typeof e){const t=Tt[e.type];if(t)return(n,r)=>t(n,r,e);throw et(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${lt(e)}Changed`;return function(o){if(n.deleted)return et("instance deleted - cannot call any method"),!1;if(n[e]!==o){const a=n[e.name];return n[e]=o,n[r]?.(t,n,o,a),t.modified(),!0}return!1}}}function St(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${lt(n.name)}`]=Ct(n)(e,t):e[`set${lt(n)}`]=Ct(n)(e,t)}))}function Pt(e,t,n){xt(e,t,n),St(e,t,n)}function At(e,t,n){n.forEach((n=>{e[`get${lt(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${lt(n)}ByReference`]=()=>t[n]}))}function It(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const a=`_on${lt(n)}Changed`;e[`set${lt(n)}`]=function(){if(t.deleted)return et("instance deleted - cannot call any method"),!1;for(var i=arguments.length,s=new Array(i),l=0;l=0)&&(u=u[0],d=!0),null==u)c=t[n]!==u;else{if(r&&u.length!==r){if(!(u.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function wt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;At(e,t,n),It(e,t,n,r,o)}function Ot(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?et("instance deleted - cannot call any method"):r>=t.numberOfInputs?et(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function a(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)et("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void et(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function i(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(et("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(We):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(We):t.inputConnection=[],t.output?t.output=t.output.map(We):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(We):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,a=r;for(;a--;){if(!t.output[a]||t.output[a].isDeleted())return!0;const e=t.output[a].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=a,e.addInputData=function(e){t.deleted?et("instance deleted - cannot call any method"):o(e,i())},e.addInputConnection=function(e){t.deleted?et("instance deleted - cannot call any method"):a(e,i())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===Rt)break}},e[`on${lt(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return et("instance deleted - cannot call any method"),null;const i=a++;return r.push([i,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(i)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return i(t)}))}}function Et(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&We.register(t,n),n}function Dt(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function Lt(e){return e&&e.isA&&e.isA("vtkObject")}function Bt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(Lt(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const a=e.get();Object.keys(a).forEach((e=>{const o=a[e];Array.isArray(o)?o.forEach((e=>{Bt(e,t,n,r)})):Bt(o,t,n,r)}))}return n}function Nt(e,t,n){var r=this;let o;const a=function(){for(var a=arguments.length,i=new Array(a),s=0;s{o=null,n||e.apply(l,i)},u=n&&!o;clearTimeout(o),o=setTimeout(c,t),u&&e.apply(l,i)};return a.cancel=()=>clearTimeout(o),a}function kt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(a(...r),r=null)}function a(){for(var a=arguments.length,i=new Array(a),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let _t=1;const Gt="__root__";function Ut(e,t){Ft(e,t);const n=e.delete;t.proxyId=""+_t++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),xt(e,t,["proxyId","proxyGroup","proxyName"]),Pt(e,t,["proxyManager"]);const r={},o={};function a(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:Gt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gt;const r=[],o=t.proxyId,a=i(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),a(t.ui,Gt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${lt(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let a=0,i=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i)return null;const l=[];let c=null;for(a=o.length;a--;){const e=o[a];e.instance===n?c=e:l.push(e)}if(!c)return null;const u=c.instance[`get${lt(c.propertyName)}`]();if(!gt(u,r)||s){for(r=u,i=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}i=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=u),u}function l(e,t){const n=[];for(a=o.length;a--;){const r=o[a];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(a))}for(;n.length;)o.splice(n.pop(),1)}function c(n,r){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=n.onModified(s),c=o[0];return o.push({instance:n,propertyName:r,subscription:i}),a&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):c&&s(c.instance,!0)),{unsubscribe:()=>l(n,r)}}function u(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:c,unbind:l,unsubscribe:u,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,ht((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function Wt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const a=Object.keys(r);let i=a.length;for(;i--;){const s=a[i];t[s]=r[s];const l=n[s];e[`set${lt(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}a.length&&xt(e,t,a)}function Ht(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var jt={algo:Mt,capitalize:st,chain:Dt,debounce:Nt,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:Vt,EVENT_ABORT:Rt,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,get:xt,getArray:At,getCurrentGlobalMTime:function(){return je},getStateArrayMapFunc:mt,isVtkObject:Lt,keystore:Ft,measurePromiseExecution:vt,moveToProtected:Ot,newInstance:Et,newTypedArray:at,newTypedArrayFrom:it,normalizeWheel:Ht,obj:yt,proxy:Ut,proxyPropertyMapping:zt,proxyPropertyState:Wt,safeArrays:pt,set:St,setArray:It,setGet:Pt,setGetArray:wt,setImmediate:ht,setLoggerFunction:Ye,throttle:kt,traverseInstanceTree:Bt,TYPED_ARRAYS:ot,uncapitalize:ct,VOID:Ke,vtkDebugMacro:Je,vtkErrorMacro:et,vtkInfoMacro:Qe,vtkLogMacro:Ze,vtkOnceErrorMacro:rt,vtkWarningMacro:tt},Kt=Object.freeze({__proto__:null,VOID:Ke,setLoggerFunction:Ye,vtkLogMacro:Ze,vtkInfoMacro:Qe,vtkDebugMacro:Je,vtkErrorMacro:et,vtkWarningMacro:tt,vtkOnceErrorMacro:rt,TYPED_ARRAYS:ot,newTypedArray:at,newTypedArrayFrom:it,capitalize:st,_capitalize:lt,uncapitalize:ct,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:dt,setImmediateVTK:ht,measurePromiseExecution:vt,obj:yt,get:xt,set:St,setGet:Pt,getArray:At,setArray:It,setGetArray:wt,moveToProtected:Ot,algo:Mt,EVENT_ABORT:Rt,event:Vt,newInstance:Et,chain:Dt,isVtkObject:Lt,traverseInstanceTree:Bt,debounce:Nt,throttle:kt,keystore:Ft,proxy:Ut,proxyPropertyMapping:zt,proxyPropertyState:Wt,normalizeWheel:Ht,default:jt});const{vtkErrorMacro:$t}=jt;function qt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return $t("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xt,n),jt.obj(e,t),jt.event(e,t,"event"),t._renderableChildMap=new Map,jt.get(e,t,["visited"]),jt.setGet(e,t,["_parent","renderable","myFactory"]),jt.getArray(e,t,["children"]),jt.moveToProtected(e,t,["parent"]),qt(e,t)}var Zt={newInstance:jt.newInstance(Yt,"vtkViewNode"),extend:Yt,PASS_TYPES:["Build","Render"]};function Qt(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),a=!1;const i=Object.keys(t.overrides);for(;o&&!a;)-1!==i.indexOf(o)?a=!0:o=n.getClassName(r++);if(!a)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const Jt={};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jt,n),jt.obj(e,t),Qt(e,t)}var tn={newInstance:jt.newInstance(en,"vtkViewNodeFactory"),extend:en};const nn=Object.create(null);function rn(e,t){nn[e]=t}function on(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const an={};function sn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,an,n),t.overrides=nn,tn.extend(e,t,n),on(0,t)}var ln={newInstance:jt.newInstance(sn,"vtkOpenGLViewNodeFactory"),extend:sn};function cn(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){d(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),se(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();d(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),m(t.keyMatrices.vcpc,t.keyMatrices.vcpc),b(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const un={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const dn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,un,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},Pt(e,t,["context","keyMatrixTime"]),cn(e,t)}));rn("vtkCamera",dn);const{vtkDebugMacro:pn}=Kt;function fn(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(pn("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const gn={context:null,_openGLRenderWindow:null,selector:null};const mn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gn,n),Zt.extend(e,t,n),xt(e,t,["shaderCache"]),Pt(e,t,["selector"]),Ot(0,t,["openGLRenderWindow"]),fn(e,t)}),"vtkOpenGLRenderer");function hn(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=n=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(n,r)=>{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?pe(t.keyMatrices.normalMatrix):(se(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),ge(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),fe(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkRenderer",mn);const vn={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};const yn=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vn,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),xt(e,t,["activeTextures"]),hn(e,t)}));function bn(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=n=>{if(n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOverlayActorCount()}},e.traverseOpaquePass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&!t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.traverseOverlayPass=n=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable)&&(e.apply(n,!0),t.oglmapper.traverse(n),e.apply(n,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(n)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xn,n),Zt.extend(e,t,n),Pt(e,t,["context"]),xt(e,t,["activeTextures"]),bn(e,t)}));function Cn(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sn(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function Pn(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function An(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function In(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function wn(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function On(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Mn(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Rn(e,t){var n=t[0],r=t[1],o=t[2],a=n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Vn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function En(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[0],s=n[1],l=n[2];return e[0]=o*l-a*s,e[1]=a*i-r*l,e[2]=r*s-o*i,e}function Dn(e,t,n){var r=t[0],o=t[1],a=t[2],i=n[3]*r+n[7]*o+n[11]*a+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*o+n[8]*a+n[12])/i,e[1]=(n[1]*r+n[5]*o+n[9]*a+n[13])/i,e[2]=(n[2]*r+n[6]*o+n[10]*a+n[14])/i,e}function Ln(e,t,n){var r=t[0],o=t[1],a=t[2];return e[0]=r*n[0]+o*n[3]+a*n[6],e[1]=r*n[1]+o*n[4]+a*n[7],e[2]=r*n[2]+o*n[5]+a*n[8],e}function Bn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Nn(e,t){var n=e[0],r=e[1],o=e[2],i=t[0],s=t[1],l=t[2];return Math.abs(n-i)<=a*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-s)<=a*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-l)<=a*Math.max(1,Math.abs(o),Math.abs(l))}rn("vtkActor2D",Tn);var kn=wn,Fn=Sn,_n=(Cn(),Math.sqrt(50)),Gn=Math.sqrt(10),Un=Math.sqrt(2);function zn(e,t,n){var r=(t-e)/Math.max(0,n),o=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,o);return o>=0?(a>=_n?10:a>=Gn?5:a>=Un?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(a>=_n?10:a>=Gn?5:a>=Un?2:1)}function Wn(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function Hn(e){let t=e,n=e,r=e;function o(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<0?o=n+1:a=n}while(oe(t)-n,n=Wn,r=(t,n)=>Wn(e(t),n)),{left:o,center:function(e,n,r=0,a=e.length){const i=o(e,n,r,a-1);return i>r&&t(e[i-1],n)>-t(e[i],n)?i-1:i},right:function(e,t,o=0,a=e.length){if(o>>1;r(e[n],t)<=0?o=n+1:a=n}while(o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?gr(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?gr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=rr.exec(e))?new vr(t[1],t[2],t[3],1):(t=or.exec(e))?new vr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ar.exec(e))?gr(t[1],t[2],t[3],t[4]):(t=ir.exec(e))?gr(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=sr.exec(e))?Sr(t[1],t[2]/100,t[3]/100,1):(t=lr.exec(e))?Sr(t[1],t[2]/100,t[3]/100,t[4]):cr.hasOwnProperty(e)?fr(cr[e]):"transparent"===e?new vr(NaN,NaN,NaN,0):null}function fr(e){return new vr(e>>16&255,e>>8&255,255&e,1)}function gr(e,t,n,r){return r<=0&&(e=t=n=NaN),new vr(e,t,n,r)}function mr(e){return e instanceof Yn||(e=pr(e)),e?new vr((e=e.rgb()).r,e.g,e.b,e.opacity):new vr}function hr(e,t,n,r){return 1===arguments.length?mr(e):new vr(e,t,n,null==r?1:r)}function vr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function yr(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}`}function br(){const e=xr(this.opacity);return`${1===e?"rgb(":"rgba("}${Tr(this.r)}, ${Tr(this.g)}, ${Tr(this.b)}${1===e?")":`, ${e})`}`}function xr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Tr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Cr(e){return((e=Tr(e))<16?"0":"")+e.toString(16)}function Sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ar(e,t,n,r)}function Pr(e){if(e instanceof Ar)return new Ar(e.h,e.s,e.l,e.opacity);if(e instanceof Yn||(e=pr(e)),!e)return new Ar;if(e instanceof Ar)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),i=NaN,s=a-o,l=(a+o)/2;return s?(i=t===a?(n-r)/s+6*(n0&&l<1?0:i,new Ar(i,s,l,e.opacity)}function Ar(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Ir(e){return(e=(e||0)%360)<0?e+360:e}function wr(e){return Math.max(0,Math.min(1,e||0))}function Or(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Mr(e,t,n,r,o){var a=e*e,i=a*e;return((1-3*e+3*a-i)*t+(4-6*a+3*i)*n+(1+3*e+3*a-3*i)*r+i*o)/6}qn(Yn,pr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ur,formatHex:ur,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Pr(this).formatHsl()},formatRgb:dr,toString:dr}),qn(vr,hr,Xn(Yn,{brighter(e){return e=null==e?Qn:Math.pow(Qn,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Zn:Math.pow(Zn,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vr(Tr(this.r),Tr(this.g),Tr(this.b),xr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:yr,formatHex:yr,formatHex8:function(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}${Cr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:br,toString:br})),qn(Ar,(function(e,t,n,r){return 1===arguments.length?Pr(e):new Ar(e,t,n,null==r?1:r)}),Xn(Yn,{brighter(e){return e=null==e?Qn:Math.pow(Qn,e),new Ar(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Zn:Math.pow(Zn,e),new Ar(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new vr(Or(e>=240?e-240:e+120,o,r),Or(e,o,r),Or(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ar(Ir(this.h),wr(this.s),wr(this.l),xr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=xr(this.opacity);return`${1===e?"hsl(":"hsla("}${Ir(this.h)}, ${100*wr(this.s)}%, ${100*wr(this.l)}%${1===e?")":`, ${e})`}`}}));var Rr=e=>()=>e;function Vr(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Rr(isNaN(e)?t:e)}var Er=function e(t){var n=function(e){return 1==(e=+e)?Vr:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Rr(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=hr(e)).r,(t=hr(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),i=Vr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=a(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function Dr(e){return function(t){var n,r,o=t.length,a=new Array(o),i=new Array(o),s=new Array(o);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),o=e[r],a=e[r+1],i=r>0?e[r-1]:2*o-a,s=ra&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:Nr(n,r)})),a=_r.lastIndex;return at&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Xr:qr,o=a=null,d}function d(t){return null==t||isNaN(t=+t)?n:(o||(o=r(i.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,i.map(e),Nr)))(n)))},d.domain=function(e){return arguments.length?(i=Array.from(e,Hr),u()):i.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Wr,u()},d.clamp=function(e){return arguments.length?(c=!!e||Kr,u()):c!==Kr},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}()(Kr,Kr)}function Qr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}var Jr,eo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function to(e){if(!(t=eo.exec(e)))throw new Error("invalid format: "+e);var t;return new no({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function no(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function ro(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function oo(e){return(e=ro(Math.abs(e)))?e[1]:NaN}function ao(e,t){var n=ro(e,t);if(!n)return e+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}to.prototype=no.prototype,no.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var io={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ao(100*e,t),r:ao,s:function(e,t){var n=ro(e,t);if(!n)return e+"";var r=n[0],o=n[1],a=o-(Jr=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ro(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function so(e){return e}var lo,co,uo,po=Array.prototype.map,fo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function go(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){var r,o,a,i,s=-1;if(n=+n,(e=+e)==(t=+t)&&n>0)return[e];if((r=t0){let n=Math.round(e/i),r=Math.round(t/i);for(n*it&&--r,a=new Array(o=r-n+1);++st&&--r,a=new Array(o=r-n+1);++s=_n?o*=10:a>=Gn?o*=5:a>=Un&&(o*=2),t0;){if((o=zn(l,c,n))===r)return a[i]=l,a[s]=c,t(a);if(o>0)l=Math.floor(l/o)*o,c=Math.ceil(c/o)*o;else{if(!(o<0))break;l=Math.ceil(l*o)/o,c=Math.floor(c*o)/o}r=o}return e},e}function mo(){var e=Zr();return e.copy=function(){return Yr(e,mo())},Qr.apply(e,arguments),go(e)}lo=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?so:(t=po.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var o=e.length,a=[],i=0,s=t[0],l=0;o>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(o-=s,o+s)),!((l+=s+1)>r));)s=t[i=(i+1)%t.length];return a.reverse().join(n)}),o=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?so:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(po.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=to(e)).fill,n=e.align,d=e.sign,p=e.symbol,f=e.zero,g=e.width,m=e.comma,h=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):io[y]||(void 0===h&&(h=12),v=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===p?o:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===p?a:/[%p]/.test(y)?l:"",T=io[y],C=/[defgprs%]/.test(y);function S(e){var o,a,l,p=b,S=x;if("c"===y)S=T(e)+S,e="";else{var P=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:T(Math.abs(e),h),v&&(e=function(e){e:for(var t,n=e.length,r=1,o=-1;r0&&(o=0)}return o>0?e.slice(0,o)+e.slice(t+1):e}(e)),P&&0==+e&&"+"!==d&&(P=!1),p=(P?"("===d?d:c:"-"===d||"("===d?"":d)+p,S=("s"===y?fo[8+Jr/3]:"")+S+(P&&"("===d?")":""),C)for(o=-1,a=e.length;++o(l=e.charCodeAt(o))||l>57){S=(46===l?i+e.slice(o+1):e.slice(o))+S,e=e.slice(0,o);break}}m&&!f&&(e=r(e,1/0));var A=p.length+e.length+S.length,I=A>1)+p+e+S+I.slice(A);break;default:e=I+p+e+S}return s(e)}return h=void 0===h?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h)),S.toString=function(){return e+""},S}return{format:d,formatPrefix:function(e,t){var n=d(((e=to(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(oo(t)/3))),o=Math.pow(10,-r),a=fo[8+r/3];return function(e){return n(o*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),co=lo.format,uo=lo.formatPrefix;var ho=n(640),vo=n.n(ho);const yo=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],bo=[1,0,0,0,1,0,0,0,1],xo=1e-6,To=1e-12,{vtkErrorMacro:Co,vtkWarningMacro:So}=jt;let Po=0;function Ao(e){return()=>Co(`vtkMath::${e} - NOT IMPLEMENTED`)}function Io(e,t,n,r){let o;for(let a=0;a0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r=0?o:-o}function Jo(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ea(e){const t=Jo(e);return 0!==t&&(e[0]/=t,e[1]/=t),t}function ta(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:xo;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const sa=ia;function la(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function ca(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function pa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=da(e[0],n),t[1]=da(e[1],n),t[2]=da(e[2],n),t}function fa(e,t,n,r){let o,a,i,s,l,c,u,d,p,f,g,m,h,v,y,b;const x=Oo(t),T=Oo(t),C=(e,t,n)=>{v=e[t],h=e[n],e[t]=v-m*(h+v*f),e[n]=h+m*(v-h*f)};for(ca(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>u){for(h=n[s]-n[l],Math.abs(h)+v===Math.abs(h)?p=e[l*t+s]/h:(d=.5*h/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),h=p*e[l*t+s],T[l]-=h,T[s]+=h,n[l]-=h,n[s]+=h,e[l*t+s]=0,a=0;a<=l-1;a++)C(e,a*t+l,a*t+s);for(a=l+1;a<=s-1;a++)C(e,l*t+a,a*t+s);for(a=s+1;a=20)return So("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(a=0;a=b||Math.abs(n[o]-b)>1)+(1&t);for(c=0,o=0;o=0&&c++;if(cr?a:r,o=i>o?i:o,n[e]=1,0!==o&&(n[e]/=o)}const a=Math.abs(t[0])*n[0],i=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=a,i>=o&&(o=i,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(wo(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],c=Math.abs(t[7])*n[2];r[1]=1,o=l,c>=o&&(r[1]=2,wo(t,3,1,2)),r[2]=2;let u=0;if(aa(t)<0){u=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=Oo(4);if(ga(t,d),ua(d,t),u)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&wo(t,3,r[1],1),0!==r[0]&&wo(t,3,r[0],0)}function ha(e,t,n){let r,o,a,i,s,l;if(fa([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(oa(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),i=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,i=o);i!==r&&(s=t[i],t[i]=t[r],t[r]=s,Io(n,3,r,i)),n[3*i+i]<0&&(n[3*i]=-n[3*i],n[3*i+1]=-n[3*i+1],n[3*i+2]=-n[3*i+2]),o=(i+1)%3,a=(i+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=$o([n[3*i],n[3*i+1],n[3*i+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Xo(e);const c=$o(e,[n[3*i],n[3*i+1],n[3*i+2]],[]);for(let t=0;t<3;t++)n[3*a+t]=e[t],n[3*o+t]=c[t];return void oa(n,n)}for(l=Math.abs(n[0]),i=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,i=r);if(0!==i){const e=t[i];t[i]=t[0],t[0]=e,Io(n,3,i,0)}if(Math.abs(n[4])i&&(i=c);if(0===i)return So("Unable to factor linear system"),0;d[r]=1/i}for(o=0;o=i&&(i=l,u=r)}if(o!==u){for(a=0;a=0)for(a=i;a<=o-1;a++)l-=e[o*r+a]*n[a];else 0!==l&&(i=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],a=o+1;a3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const a=r||Oo(n),i=o||Oo(n);if(0===va(e,a,n))return null;for(let r=0;ri&&n<=a?(u=1,c=(a-n)/i,d=0):n>a&&n<=.5?(u=1,d=(n-a)/i,c=0):n>.5&&n<=s?(d=1,u=(s-n)/i,c=0):n>s&&n<=l?(d=1,c=(n-s)/i,u=0):n>l&&n<=1?(c=1,d=(1-n)/i,u=0):(c=1,u=n/i,d=0),c=r*c+(1-r),u=r*u+(1-r),d=r*d+(1-r),c*=o,u*=o,d*=o,t[0]=c,t[1]=u,t[2]=d}function Sa(e,t){const[n,r,o]=e;let a=(n+16)/116,i=r/500+a,s=a-o/200;a**3>.008856?a**=3:a=(a-16/116)/7.787,i**3>.008856?i**=3:i=(i-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*i,t[1]=1*a,t[2]=1.089*s}function Pa(e,t){const[n,r,o]=e;let a=n/.9505,i=r/1,s=o/1.089;a>.008856?a**=1/3:a=7.787*a+16/116,i>.008856?i**=1/3:i=7.787*i+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*i-16,t[1]=500*(a-i),t[2]=200*(i-s)}function Aa(e,t){const[n,r,o]=e;let a=3.2406*n+-1.5372*r+-.4986*o,i=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=a;l1&&(a/=l,i/=l,s/=l),a<0&&(a=0),i<0&&(i=0),s<0&&(s=0),t[0]=a,t[1]=i,t[2]=s}function Ia(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function wa(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function Oa(e){return!(e[1]-e[0]<0)}function Ma(e,t,n){return en?n:e}function Ra(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=Ma(e[0],t[0],n[0]),r[1]=Ma(e[1],t[1],n[1]),r[2]=Ma(e[2],t[2],n[2]),r}const Va=Ao("GetScalarTypeFittingRange"),Ea=Ao("GetAdjustedScalarRange");const{isFinite:Da,isNaN:La}=Number,Ba=La;function Na(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function ka(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let a=-1/0,i=0,s=0;for(let l=0;l<=o;++l){const c=n[l];for(let n=0;n<=o;++n){const o=r[n],u=Math.abs(e[c+t*o]);u>a&&(a=u,i=l,s=n)}}[n[o],n[i]]=[n[i],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let a=0;a15?t.toString(16):`0${t.toString(16)}`}function _a(e){return Math.round(255*e)}var Ga={Pi:()=>Math.PI,radiansFromDegrees:Mo,degreesFromRadians:Ro,round:Vo,floor:Eo,ceil:Do,ceilLog2:No,min:Lo,max:Bo,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let a=t,i=e.length;a=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Go,add:Uo,subtract:zo,multiplyScalar:Wo,multiplyScalar2D:Ho,multiplyAccumulate:jo,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ko,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:$o,norm:qo,normalize:Xo,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],a=e[1]*e[1],i=e[2]*e[2],s=Math.sqrt(o+a+i);let l,c,u;o>a&&o>i?(l=0,c=1,u=2):a>i?(l=1,c=2,u=0):(l=2,c=0,u=1);const d=e[l]/s,p=e[c]/s,f=e[u]/s,g=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/g,t[c]=e*g,t[u]=(-d*o-p*f*e)/g),n&&(n[l]=(-f*e-d*p*o)/g,n[c]=o*g,n[u]=(d*e-p*f*o)/g)}else t&&(t[l]=f/g,t[c]=0,t[u]=-d/g),n&&(n[l]=-d*p/g,n[c]=g,n[u]=-p*f/g)},projectVector:function(e,t,n){const r=Ko(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ko(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Wo(n,o),!0},projectVector2D:function(e,t,n){const r=Yo(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Yo(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Ho(n,o),!0},distance2BetweenPoints:Zo,angleBetweenVectors:function(e,t){const n=[0,0,0];return $o(e,t,n),Math.atan2(qo(n),Ko(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Yo,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:Jo,normalize2D:ea,determinant2x2:ta,LUFactor3x3:function(e,t){let n,r,o;const a=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),a[t]=1/o;o=a[0]*Math.abs(e[0]),n=0,(r=a[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=a[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(Io(e,3,n,0),a[n]=a[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=a[1]*Math.abs(e[4]),n=1,(r=a[2]*Math.abs(e[7]))>=o&&(n=2,Io(e,3,1,2),a[2]=a[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],a=e[2],i=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],p=+ta(s,u,l,d),f=-ta(i,c,l,d),g=+ta(i,c,s,u),m=-ta(o,u,a,d),h=+ta(r,c,a,d),v=-ta(r,c,o,u),y=+ta(o,s,a,l),b=-ta(r,i,a,l),x=+ta(r,i,o,s),T=r*p+o*f+a*g,C=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+h*t[1]+b*t[2],P=g*t[0]+v*t[1]+x*t[2];n[0]=C/T,n[1]=S/T,n[2]=P/T},multiply3x3_vect3:na,multiply3x3_mat3:ra,multiplyMatrix:function(e,t,n,r,o,a,i){r!==o&&Co("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:xo;return sa(e,yo,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xo;return sa(e,bo,t)},determinant3x3:aa,quaternionToMatrix3x3:ua,areEquals:ia,areMatricesEqual:sa,roundNumber:da,roundVector:pa,matrix3x3ToQuaternion:ga,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],a=e[0]*t[2],i=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],c=e[1]*t[2],u=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],g=e[2]*t[3],m=e[3]*t[0],h=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+g-v,n[2]=a-u+d+h,n[3]=i+c-p+m},orthogonalize3x3:ma,diagonalize3x3:ha,singularValueDecomposition3x3:function(e,t,n,r){let o;const a=[...e],i=aa(a);if(i<0)for(o=0;o<9;o++)a[o]=-a[o];ma(a,t),oa(a,a),ra(a,t,r),ha(r,n,r),ra(t,r,t),oa(r,r),i<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:ba,invertMatrix:xa,luFactorLinearSystem:va,luSolveLinearSystem:ya,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(eTo&&(p=0,s[u]=0);if(p&&1===o)return So("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),Ta(e,t,n,a);if(p)g=1;else for(u=0;u1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:function(e,t){let n,r;const[o,a,i]=e,s=1/6;let l=o,c=o;a>l?l=a:al?l=i:i0?(l-c)/l:0,r>0?(n=o===l?s*(a-i)/(l-c):a===l?.3333333333333333+s*(i-o)/(l-c):.6666666666666666+s*(o-a)/(l-c),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=u},hsv2rgb:Ca,lab2xyz:Sa,xyz2lab:Pa,xyz2rgb:Aa,rgb2xyz:Ia,rgb2lab:function(e,t){const n=[0,0,0];Ia(e,n),Pa(n,t)},lab2rgb:function(e,t){const n=[0,0,0];Sa(e,n),Aa(n,t)},uninitializeBounds:wa,areBoundsInitialized:Oa,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:Ma,clampVector:Ra,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Va,getAdjustedScalarRange:Ea,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=Oo(3),a=Oo(3),i=Oo(3),s=Oo(3),l=Oo(3),c=Oo(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],a[r]=t[r]-n[r],i[r]=n[r]-e[r],s[r]=-o[r],l[r]=-a[r],c[r]=-i[r];const u=qo(s),d=qo(l),p=qo(i),f=Oo(3);$o(o,a,f);const g=qo(f),m=u*d*p/(2*g),h=2*g*g,v=d*d*Ko(o,c)/h,y=p*p*Ko(s,a)/h,b=u*u*Ko(i,l)/h;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:e=>!Number.isFinite(e),isNan:La,isNaN:La,isFinite:Da,createUninitializedBounds:Na,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:ka,floatToHex2:Fa,floatRGB2HexCode:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Fa).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(_a).join(", ")})`:`rgba(${_a(e[0]||0)}, ${_a(e[1]||0)}, ${_a(e[2]||0)}, ${e[3]||0})`}};const Ua=1e-6,za="coincide",Wa="disjoint";function Ha(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function ja(e,t,n,r){const o=[];zo(e,t,o);const a=Ko(n,o);r[0]=e[0]-a*n[0],r[1]=e[1]-a*n[1],r[2]=e[2]-a*n[2]}function Ka(e,t,n){const r=Ko(e,t);let o=Ko(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function $a(e,t,n,r){const o=[];zo(e,t,o);const a=Ko(n,o),i=Ko(n,n);0!==i?(r[0]=e[0]-a*n[0]/i,r[1]=e[1]-a*n[1]/i,r[2]=e[2]-a*n[2]/i):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function qa(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},a=[],i=[];zo(t,e,a),zo(n,e,i);const s=Ko(r,i),l=Ko(r,a);let c,u;return c=l<0?-l:l,u=s<0?-s*Ua:s*Ua,c<=u||(o.t=s/l,o.x[0]=e[0]+o.t*a[0],o.x[1]=e[1]+o.t*a[1],o.x[2]=e[2]+o.t*a[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function Xa(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},a=[];$o(t,r,a);const i=a.map((e=>Math.abs(e)));if(i[0]+i[1]+i[2]i[1]&&i[0]>i[2]?"x":i[1]>i[2]?"y":"z";const l=[],c=-Ko(t,e),u=-Ko(r,n);switch(s){case"x":l[0]=0,l[1]=(u*t[2]-c*r[2])/a[0],l[2]=(c*r[1]-u*t[1])/a[0];break;case"y":l[0]=(c*r[2]-u*t[2])/a[1],l[1]=0,l[2]=(u*t[0]-c*r[0])/a[1];break;case"z":l[0]=(u*t[1]-c*r[1])/a[2],l[1]=(c*r[0]-u*t[0])/a[2],l[2]=0}return o.l0=l,Uo(l,a,o.l1),o.intersection=!0,o}const Ya={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:Ha,projectPoint:ja,projectVector:Ka,generalizedProjectPoint:$a,intersectWithLine:qa,intersectWithPlane:Xa,DISJOINT:Wa,COINCIDE:za};function Za(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>Ha(e,t.origin,t.normal),e.projectPoint=(e,n)=>{ja(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>Ka(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{$a(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>qa(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>Xa(e,n,t.origin,t.normal)}const Qa={normal:[0,0,1],origin:[0,0,0]};function Ja(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qa,n),jt.obj(e,t),jt.setGetArray(e,t,["normal","origin"],3),Za(e,t)}var ei={newInstance:jt.newInstance(Ja,"vtkPlane"),extend:Ja,...Ya};const ti=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function ni(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function ri(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function oi(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ai(e){return oi(e,ti)}function ii(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=ot?a:t,e[2]=in?s:n,e[4]=lr?c:r,e}function si(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;na?t:a,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>c?r:c,o!==t||i!==n||l!==r}function ui(e,t,n,r){const[o,a,i,s,l,c]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function fi(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function gi(e,t){return e[2*t+1]-e[2*t]}function mi(e){return[gi(e,0),gi(e,1),gi(e,2)]}function hi(e){return e.slice(0,2)}function vi(e){return e.slice(2,4)}function yi(e){return e.slice(4,6)}function bi(e){const t=mi(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function xi(e){if(ri(e)){const t=mi(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function Ti(e){return[e[0],e[2],e[4]]}function Ci(e){return[e[1],e[3],e[5]]}function Si(e,t){return e<=0&&t>=0||e>=0&&t<=0}function Pi(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let a=4;a<6;a++)t[n++]=[e[r],e[o],e[a]];return t}function Ai(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function Ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=Pi(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function Oi(e,t,n,r){const o=[].concat(ti),a=e.getData();for(let e=0;ee[2*n+1]?(i[n]=0,c[n]=e[2*n+1],a=!1):i[n]=2;if(a)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==i[e]&&0!==n[e]?l[e]=(c[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=c[o];return 1}function Ri(e,t,n){const r=[];let o=0,a=1,i=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=ei.evaluate(n,t,r),i&&(a=o>=0?1:-1,i=0),0===o||a>0&&o<0||a<0&&o>0)return 1}}return 0}function Vi(e,t){if(!ri(e)||!ri(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function Ei(e,t){if(!ri(e)||!ri(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function Di(e,t,n,r){return!(te[1]||ne[3]||re[5])}function Li(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let a=0;for(let r=0;r<2;r++)for(let i=2;i<4;i++)for(let s=4;s<6;s++){const l=[e[r],e[i],e[s]];o[a++]=ei.evaluate(n,t,l)}let i=2;for(;i--&&!(Si(o[r[i][0]],o[r[i][4]])&&Si(o[r[i][1]],o[r[i][5]])&&Si(o[r[i][2]],o[r[i][6]])&&Si(o[r[i][3]],o[r[i][7]])););if(i<0)return!1;const s=Math.sign(n[i]),l=Math.abs((e[2*i+1]-e[2*i])*n[i]);let c=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[i][e]])/l;s>0&&tc&&(c=t)}const u=(1-c)*e[2*i]+c*e[2*i+1];return s>0?e[2*i]=u:e[2*i+1]=u,!0}class Bi{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(ti))}getBounds(){return this.bounds}equals(e){return ni(this.bounds,e)}isValid(){return ri(this.bounds)}setBounds(e){return oi(this.bounds,e)}reset(){return ai(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return Ii(this.bounds,e,t)}computeScale3(e){return wi(this.bounds,e)}cutWithPlane(e,t){return Li(this.bounds,e,t)}intersectBox(e,t,n,r){return Mi(this.bounds,e,t,n,r)}intersectPlane(e,t){return Ri(this.bounds,e,t)}intersect(e){return Vi(this.bounds,e)}intersects(e){return Ei(this.bounds,e)}containsPoint(e,t,n){return Di(this.bounds,e,t,n)}contains(e){return Ei(this.bounds,e)}}const Ni={equals:ni,isValid:ri,setBounds:oi,reset:ai,addPoint:ii,addPoints:si,addBounds:li,setMinPoint:ci,setMaxPoint:ui,inflate:di,scale:pi,scaleAboutCenter:function(e,t,n,r){if(!ri(e))return!1;const o=fi(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],pi(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:fi,getLength:gi,getLengths:mi,getMaxLength:bi,getDiagonalLength:xi,getMinPoint:Ti,getMaxPoint:Ci,getXRange:hi,getYRange:vi,getZRange:yi,getCorners:Pi,computeCornerPoints:Ai,computeLocalBounds:Oi,transformBounds:Ii,computeScale3:wi,cutWithPlane:Li,intersectBox:Mi,intersectPlane:Ri,intersect:Vi,intersects:Ei,containsPoint:Di,contains:function(e,t){return!!Ei(e,t)&&!!Di(e,...Ti(t))&&!!Di(e,...Ci(t))},INIT_BOUNDS:ti};var ki,Fi={newInstance:function(e){const t=e&&e.bounds;return new Bi(t)},...Ni};function _i(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Gi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*a+n[12]*i,e[1]=n[1]*r+n[5]*o+n[9]*a+n[13]*i,e[2]=n[2]*r+n[6]*o+n[10]*a+n[14]*i,e[3]=n[3]*r+n[7]*o+n[11]*a+n[15]*i,e}function Ui(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function zi(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Wi(e,t,n){var r=t[0],o=t[1],a=t[2],i=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=r*u+i*s+o*c-a*l,e[1]=o*u+i*l+a*s-r*c,e[2]=a*u+i*c+r*l-o*s,e[3]=i*u-r*s-o*l-a*c,e}ki=new i(4),i!=Float32Array&&(ki[0]=0,ki[1]=0,ki[2]=0,ki[3]=0);var Hi=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Cn(),Pn(1,0,0),Pn(0,1,0),Ui(),Ui(),ie();var ji={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:Ki}=ji;function $i(e){return()=>jt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function qi(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=$i("pick"),e.hasKey=$i("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(Ki.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(Ki.DISPLAY)}const Xi={allocatedRenderTime:10,coordinateSystem:Ki.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Yi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xi,n),jt.obj(e,t),jt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),jt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),jt.moveToProtected(e,t,["parentProp"]),qi(e,t)}var Zi={newInstance:jt.newInstance(Yi,"vtkProp"),extend:Yi,...ji};function Qi(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ui();N(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>a?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[Ro(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(S(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateY=n=>{0!==n&&(P(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateZ=n=>{0!==n&&(A(t.rotation,t.rotation,Mo(n)),e.modified())},e.rotateWXYZ=(n,r,o,a)=>{if(0===n||0===r&&0===o&&0===a)return;const i=Mo(n),s=Ui();zi(s,[r,o,a],i);const l=new Float64Array(16);_(l,s),b(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],g(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!sa(t.userMatrix,n)&&(d(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){g(t.matrix),t.userMatrix&&b(t.matrix,t.matrix,t.userMatrix),x(t.matrix,t.matrix,t.origin),x(t.matrix,t.matrix,t.position),b(t.matrix,t.matrix,t.rotation),T(t.matrix,t.matrix,t.scale),x(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),m(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>Fi.getCenter(t.bounds),e.getLength=()=>Fi.getLength(t.bounds),e.getXRange=()=>Fi.getXRange(t.bounds),e.getYRange=()=>Fi.getYRange(t.bounds),e.getZRange=()=>Fi.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Ji={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function es(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ji,n),Zi.extend(e,t,n),t.matrixMTime={},jt.obj(t.matrixMTime),jt.get(e,t,["bounds","isIdentity"]),jt.getArray(e,t,["orientation"]),jt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=g(new Float64Array(16)),t.rotation=g(new Float64Array(16)),t.userMatrix=g(new Float64Array(16)),t.transform=null,Qi(e,t)}var ts={newInstance:jt.newInstance(es,"vtkProp3D"),extend:es};const ns={FLAT:0,GOURAUD:1,PHONG:2},rs={POINTS:0,WIREFRAME:1,SURFACE:2};var os={Shading:ns,Representation:rs,Interpolation:ns};const{Representation:as,Interpolation:is}=os;function ss(e){return()=>jt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function ls(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=ss("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=ss("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(is.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(is.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(is.PHONG),e.getInterpolationAsString=()=>jt.enumToString(is,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(as.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(as.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(as.POINTS),e.getRepresentationAsString=()=>jt.enumToString(as,t.representation)}const cs={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:is.GOURAUD,representation:as.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function us(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cs,n),jt.obj(e,t),jt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),jt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),ls(e,t)}var ds={newInstance:jt.newInstance(us,"vtkProperty"),extend:us,...os};const{vtkDebugMacro:ps}=jt;function fs(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=ds.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){ps("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];Fi.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);m(o,t.matrix),r.forEach((e=>Dn(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const gs={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function ms(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gs,n),ts.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),fs(e,t)}var hs={newInstance:jt.newInstance(ms,"vtkActor"),extend:ms};const vs={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ys={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var bs={DefaultDataType:ys.FLOAT,DataTypeByteSize:vs,VtkDataTypes:ys};const{vtkErrorMacro:xs}=Kt,{DefaultDataType:Ts}=bs,Cs=1e-6;function Ss(e,t,n){const r=e.length;let o,a,i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(a=t;as&&(s=o);return{min:i,max:s}}function Ps(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,a=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Is(e){return Object.prototype.toString.call(e).slice(8,-1)}const ws={computeRange:Ps,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Ss,getDataType:Is,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=a)}return n}};function Os(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=at(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,a=n%t.numberOfComponents;e.setComponent(o,a,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=As(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=Ps(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=As(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const a=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cs;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,a=(r??e.getNumberOfTuples())*t.numberOfComponents,i=e.getData().subarray(o,a);return i.length>0?i:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Vs({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Is(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,a,i,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===a.getNumberOfComponents()||xs("numberOfComponents must match");const c=r.getTuple(o),u=a.getTuple(i),d=[];switch(d.length=l,l){case 4:d[3]=c[3]+(u[3]-c[3])*s;case 3:d[2]=c[2]+(u[2]-c[2])*s;case 2:d[1]=c[1]+(u[1]-c[1])*s;case 1:d[0]=c[0]+(u[0]-c[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ms,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=it(t.dataType,t.values)):t.values=at(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Is(t.values)),yt(e,t),St(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Os(e,t)}const Vs=Et(Rs,"vtkDataArray");var Es={newInstance:Vs,extend:Rs,...ws,...bs};function Ds(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,a=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),jt.obj(e,t),jt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Ds(e,t)};function Ns(e,t){e.getBounds=()=>(jt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Na()),e.getCenter=()=>{const n=e.getBounds();return t.center=Fi.isValid(n)?Fi.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return Fi.getDiagonalLength(t)}}const ks=e=>({bounds:[...Fi.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Fs=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ks(n)),Bs(e,t,n),jt.setGet(e,t,["viewSpecificProperties"]),Ns(e,t)};const{vtkErrorMacro:_s,vtkWarningMacro:Gs}=jt;function Us(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:We(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:a}=e.getArrayWithIndex(r);return null!=o?(t.arrays[a]={data:n},a):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((a=>{const i=e.getFlag(a.getName());if(!1!==i&&(!t.doCopyAllOff||!0===i)&&a){let t=e.getArrayByName(a.getName());if(t)if(a.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,a.getTuple(r))}else t.insertTuples(0,a.getTuples());else _s("Unhandled case in passData");else if(r<0||r>a.getNumberOfTuples())e.addArray(a),n.getAttributes(a).forEach((t=>{e.setAttribute(a,t)}));else{const i=a.getNumberOfComponents();let s=a.getNumberOfValues();const l=o>-1?o:r;s<=l*i&&(s=(l+1)*i),t=Es.newInstance({name:a.getName(),dataType:a.getDataType(),numberOfComponents:i,values:jt.newTypedArray(a.getDataType(),s),size:0}),t.insertTuple(l,a.getTuple(r)),e.addArray(t),n.getAttributes(a).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?a:r;t.interpolateTuple(e,s,r,s,o,i),Gs("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else _s("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let c=s.getNumberOfValues();const u=a>-1?a:r;c<=u*l&&(c=(u+1)*l),t=Es.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:jt.newTypedArray(s.getDataType(),c),size:0}),t.interpolateTuple(u,s,r,s,o,i),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const zs={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Ws(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),jt.obj(e,t),Us(e,t)}var Hs={newInstance:jt.newInstance(Ws,"vtkFieldData"),extend:Ws},js={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:Ks,AttributeCopyOperations:$s}=js,{vtkWarningMacro:qs}=jt;function Xs(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>Ks[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const a=r(o);if(n&&"PEDIGREEIDS"===a.toUpperCase()&&!n.isA("vtkDataArray"))return qs(`Cannot set attribute ${a}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,a))return qs(`Cannot set attribute ${a}. Incorrect number of components.`),-1;let i=t[`active${a}`];if(i>=0&&in.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const a=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[$s.PASSDATA][Ks[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[$s.PASSDATA][Ks[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys($s).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[$s[e]]=Object.keys(Ks).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[Ks[t]]=!0,e)),[])})),t.copyAttributeFlags[$s.COPYTUPLE][Ks.GLOBALIDS]=!1,t.copyAttributeFlags[$s.INTERPOLATE][Ks.GLOBALIDS]=!1,t.copyAttributeFlags[$s.COPYTUPLE][Ks.PEDIGREEIDS]=!1},e.initialize=jt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Es.newInstance(t.dataArrays[n]))}));const a=e.shallowCopy;e.shallowCopy=(e,n)=>{a(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const Ys={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function Zs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ys,n),Hs.extend(e,t,n),jt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),Xs(e,t)}var Qs={newInstance:jt.newInstance(Zs,"vtkDataSetAttributes"),extend:Zs,...js};const Js={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};var el={FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:Js};const tl=["pointData","cellData","fieldData"];function nl(e,t){t.classHierarchy.push("vtkDataSet"),tl.forEach((e=>{t[e]?t[e]=We(t[e]):t[e]=Qs.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),tl.forEach((n=>{t[n]=Qs.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const rl={};function ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rl,n),jt.obj(e,t),jt.setGet(e,t,tl),nl(e,t)}var al={newInstance:jt.newInstance(ol,"vtkDataSet"),extend:ol,...el};const il={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var sl={StructuredType:il};const{StructuredType:ll}=sl;var cl={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?ll.EMPTY:3===t?ll.XYZ_GRID:2===t?e[0]===e[1]?ll.YZ_PLANE:e[2]===e[3]?ll.XZ_PLANE:ll.XY_PLANE:1===t?e[0]e!==a[t]));return i&&(t.extent=a.slice(),t.dataDescription=cl.getDataDescriptionFromExtent(t.extent),e.modified()),i},e.setDimensions=function(){let n,r,o;if(t.deleted)ul("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void ul("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return ul("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case il.EMPTY:return null;case il.SINGLE_POINT:break;case il.X_LINE:o[0]=n;break;case il.Y_LINE:o[1]=n;break;case il.Z_LINE:o[2]=n;break;case il.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case il.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case il.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case il.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:ul("Invalid dataDescription")}const a=[0,0,0];return e.indexToWorld(o,a),a},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>Fi.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>Fi.inflate([...t.extent],.5),e.computeTransforms=()=>{I(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],T(t.indexToWorld,t.indexToWorld,t.spacing),h(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Dn(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Dn(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fi.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fi.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>Fi.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],a=[0,0,0];Fi.computeCornerPoints(r,o,a),pa(o,o),pa(a,a);const i=e.getDimensions();Ra(o,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],o),Ra(a,[0,0,0],[i[0]-1,i[1]-1,i[2]-1],a);const s=i[0],l=i[0]*i[1],c=e.getPointData().getScalars().getData();let u=-1/0,d=1/0,p=0,f=0,g=0;for(let e=o[2];e<=a[2];e++)for(let t=o[1];t<=a[1];t++){let i=o[0]+t*s+e*l;for(let s=o[0];s<=a[0];s++){if(!n||n([s,t,e],r)){const e=c[i];e>u&&(u=e),e0?f/g:0,h=g?Math.abs(p/g-m*m):0,v=Math.sqrt(h);return{minimum:d,maximum:u,average:m,variance:h,sigma:v,count:g}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const a=e.getExtent(),i=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(a,i);return Math.floor((Math.round(n)-a[0])*s[0]+(Math.round(r)-a[2])*s[1]+(Math.round(o)-a[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return ul(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return ul(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const pl={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:il.EMPTY};function fl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pl,n),al.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=pe(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),jt.get(e,t,["indexToWorld","worldToIndex"]),jt.setGetArray(e,t,["origin","spacing"],3),jt.setGetArray(e,t,["direction"],9),jt.getArray(e,t,["extent"],6),dl(e,t)}var gl={newInstance:jt.newInstance(fl,"vtkImageData"),extend:fl};const ml={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var hl={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:ml};const vl={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5};var yl={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:vl};const{ScalarMappingTarget:bl,VectorMode:xl}=hl,{VtkDataTypes:Tl}=Es,{ColorMode:Cl}=yl,{vtkErrorMacro:Sl}=jt;function Pl(e){return e}function Al(e){return Math.floor(255*e+.5)}function Il(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(xl.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(xl.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(xl.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)Sl("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),a=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,a=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,a=!0),a&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let a=null;if(n===Cl.DEFAULT&&t.getDataType()===Tl.UNSIGNED_CHAR||n===Cl.DIRECT_SCALARS&&t)a=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:Tl.UNSIGNED_CHAR},i=jt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=i,n.size=i.length,a=Es.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,a,bl.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,a,bl.RGBA,s))}return a},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),a=t.getData(),i=e.getData();for(let e=0;e{let i=e.getVectorMode(),s=a,l=o;const c=t.getNumberOfComponents();i===xl.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=c&&(l=c-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=c):(l<0&&(l=0),l>=c&&(l=c-1),l+s>c&&(s=c-l)),i!==xl.MAGNITUDE||1!==c&&1!==s||(i=xl.COMPONENT));let u=0;switch(l>0&&(u=l),i){case xl.COMPONENT:e.mapScalarsThroughTable(t,n,r,u);break;case xl.RGBCOLORS:break;case xl.MAGNITUDE:default:{const o=Es.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{const o=Al(n),a=t.getData(),i=e.getData(),s=a.length;let l=0;for(let e=0;e{const o=t.getData(),a=e.getData(),i=o.length;let s=0;for(let e=0;e{let{alpha:a}=t;if(4===r&&a>=1&&n.getDataType()===Tl.UNSIGNED_CHAR)return n;const i=Es.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:Tl.UNSIGNED_CHAR});if(o<=0)return i;a=a>0?a:0,a=a<1?a:1;let s=Pl;switch(n.getDataType()!==Tl.FLOAT&&n.getDataType()!==Tl.DOUBLE||(s=Al),r){case 1:e.luminanceToRGBA(i,n,a,s);break;case 2:e.luminanceAlphaToRGBA(i,n,s);break;case 3:e.rGBToRGBA(i,n,a,s);break;case 4:e.rGBAToRGBA(i,n,a,s);break;default:return Sl("Cannot convert colors"),null}return i},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const a=n.getNumberOfComponents();return(r!==Cl.DEFAULT||n.getDataType()!==Tl.UNSIGNED_CHAR)&&r!==Cl.DIRECT_SCALARS||(3===a||1===a?t.alpha>=1:255===n.getRange(a-1)[0])}}const wl={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:xl.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wl,n),jt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],jt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),jt.setArray(e,t,["mappingRange"],2),jt.getArray(e,t,["mappingRange"]),Il(e,t)}var Ml={newInstance:jt.newInstance(Ol,"vtkScalarsToColors"),extend:Ol,...hl};const{vtkErrorMacro:Rl}=jt;function Vl(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Ba(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const a=4*o;return n.slice(a,a+4)},e.indexedLookupFunction=(n,r,o)=>{let a=e.getAnnotatedValueIndexInternal(n);-1===a&&(a=t.numberOfColors+2);const i=4*a;return[r[i],r[i+1],r[i+2],r[i+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,a)=>{let i=e.linearLookup;t.indexedLookup&&(i=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const c=e.getAlpha(),u=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(c>=1){if(o===ml.RGBA)for(let e=0;e{let n=0,r=0,o=0,a=0;const i=t.numberOfColors-1;i&&(n=(t.hueRange[1]-t.hueRange[0])/i,r=(t.saturationRange[1]-t.saturationRange[0])/i,o=(t.valueRange[1]-t.valueRange[0])/i,a=(t.alphaRange[1]-t.alphaRange[0])/i),t.table.length=4*i+16;const s=[],l=[];for(let e=0;e<=i;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,Ca(s,l),l[3]=t.alphaRange[0]+e*a,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let a=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const El={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Dl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,El,n),Ml.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},jt.obj(t.buildTime),t.opaqueFlagBuildTime={},jt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},jt.obj(t.insertTime,{mtime:0}),jt.get(e,t,["buildTime"]),jt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),jt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),jt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),jt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Vl(e,t)}var Ll={newInstance:jt.newInstance(Dl,"vtkLookupTable"),extend:Dl};let Bl=1,Nl=0;const kl=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function Fl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;Nl=e}var _l={getResolveCoincidentTopologyAsString:function(){return kl[Nl]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return Bl},getResolveCoincidentTopology:function(){return Nl},setResolveCoincidentTopology:Fl,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){Bl=e},setResolveCoincidentTopologyToDefault:function(){Fl(0)},setResolveCoincidentTopologyToOff:function(){Fl(0)},setResolveCoincidentTopologyToPolygonOffset:function(){Fl(1)}};function Gl(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const Ul=["Polygon","Line","Point"],zl={};Gl(zl,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},Ul.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var Wl={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),jt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(_l).forEach((t=>{e[t]=_l[t]})),Object.keys(zl).forEach((t=>{e[t]=zl[t]})),Gl(e,t.topologyOffset,Ul.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=zl.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=zl.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=zl.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:zl,otherStaticMethods:_l,CATEGORIES:Ul};const Hl={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var jl={PassTypes:Hl};const{FieldAssociations:Kl}=al,{staticOffsetAPI:$l,otherStaticMethods:ql}=Wl,{ColorMode:Xl,ScalarMode:Yl,GetArray:Zl}=yl,{VectorMode:Ql}=hl,{VtkDataTypes:Jl}=Es;function ec(e){return()=>jt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function tc(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Na(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Ll.newInstance()},e.getColorModeAsString=()=>jt.enumToString(Xl,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(Yl,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===Yl.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===Yl.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===Yl.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===Yl.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===Yl.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===Yl.USE_FIELD_DATA){const t=e.getFieldData();i=r===Zl.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==a){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Ba(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,a,i,s,l,c)=>{const u=(i[1]-i[0])/l,d=[];d[0]=i[0]-u,d[1]=i[1]+u;const p=1/(d[1]-d[0]),f=n.getData(),g=t.getData();let m=0,h=0;if(a<0||a>=o)for(let t=0;t{const o=t.lookupTable.getRange(),a=t.lookupTable.usingLogScale();a&&Ll.getLogRange(o,o);const i=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),i=n.getNumberOfTuples();t.colorCoordinates=Es.newInstance({numberOfComponents:2,values:new Float32Array(2*i)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===Ql.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,i,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,a)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===Xl.DEFAULT&&o.getDataType()===Jl.UNSIGNED_CHAR||t.colorMode===Xl.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=ec("AcquireInvertibleLookupTable"),e.valueToColor=ec("ValueToColor"),e.colorToValue=ec("ColorToValue"),e.useInvertibleColorFor=ec("UseInvertibleColorFor"),e.clearInvertibleColor=ec("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(Hl.ID_LOW24),o=e.getRawPixelBuffer(Hl.ID_HIGH24),a=e.getCurrentPass(),i=e.getFieldAssociation();let s=null;i===Kl.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:i===Kl.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(a===Hl.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const a=s[n],i=e.getPixelBuffer(Hl.ID_LOW24);i[t]=255&a,i[t+1]=(65280&a)>>8,i[t+2]=(16711680&a)>>16}else if(a===Hl.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const a=s[n];e.getPixelBuffer(Hl.ID_HIGH24)[t]=(4278190080&a)>>24}}))}}const nc={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function rc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nc,n),Fs(e,t,n),jt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),jt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),Wl.implementCoincidentTopologyMethods(e,t),tc(e,t)}var oc={newInstance:jt.newInstance(rc,"vtkMapper"),extend:rc,...$l,...ql,...yl};function ac(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function ic(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=ic(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=ac(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const a=e.getNumberOfTuples();a{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function cc(e){return{empty:!0,numberOfComponents:1,dataType:ys.UNSIGNED_INT,...e}}function uc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Es.extend(e,t,cc(n)),lc(e,t)}var dc={newInstance:jt.newInstance(uc,"vtkCellArray"),extend:uc,...sc};const{vtkErrorMacro:pc}=jt,fc=[1,-1,1,-1,1,-1];function gc(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=jt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return pc(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),fc;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const mc={empty:!0,numberOfComponents:3,dataType:ys.FLOAT,bounds:[1,-1,1,-1,1,-1]};function hc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),Es.extend(e,t,n),gc(e,t)}var vc={newInstance:jt.newInstance(hc,"vtkPoints"),extend:hc};function yc(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=jt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,a=3*t;r[a]=o[n],r[++a]=o[++n],r[++a]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else wa(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,a,i)=>{},e.evaluatePosition=(e,t,n,r,o,a)=>{jt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const bc={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function xc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bc,n),jt.obj(e,t),t.points||(t.points=vc.newInstance()),jt.get(e,t,["points","pointsIds"]),yc(e,t)}var Tc={newInstance:jt.newInstance(xc,"vtkCell"),extend:xc};function Cc(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,a[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const Sc={array:null,maxId:0,extend:0};function Pc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sc,n),jt.obj(e,t),Cc(e,t)}var Ac={newInstance:jt.newInstance(Pc,"vtkCellLinks"),extend:Pc};const Ic=0,wc=1,Oc=2,Mc=3,Rc=4,Vc=5,Ec=6,Dc=7,Lc=9,Bc=21,Nc=41,kc=42,Fc=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],_c={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=Ic},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Uc={size:0,maxId:-1,extend:1e3};function zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uc,n),jt.obj(e,t),jt.get(e,t,["size","maxId","extend"]),jt.getArray(e,t,["typeArray","locationArray"]),Gc(e,t)}var Wc={newInstance:jt.newInstance(zc,"vtkCellTypes"),extend:zc,..._c},Hc={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};const{IntersectionState:jc}=Hc;function Kc(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},a=[];let i;a[0]=n[0]-t[0],a[1]=n[1]-t[1],a[2]=n[2]-t[2];const s=a[0]*(e[0]-t[0])+a[1]*(e[1]-t[1])+a[2]*(e[2]-t[2]),l=Ko(a,a);let c=1e-5*s;return 0!==l&&(o.t=s/l),c<0&&(c=-c),-c1?i=n:(i=a,a[0]=t[0]+o.t*a[0],a[1]=t[1]+o.t*a[1],a[2]=t[2]+o.t*a[2]),r&&(r[0]=i[0],r[1]=i[1],r[2]=i[2]),o.distance=Zo(i,e),o}function $c(e,t,n,r,o,a){const i=[],s=[],l=[];o[0]=0,a[0]=0,zo(t,e,i),zo(r,n,s),zo(n,e,l);const c=[Ko(i,i),-Ko(i,s),-Ko(i,s),Ko(s,s)],u=[];if(u[0]=Ko(i,l),u[1]=-Ko(s,l),0===ba(c,u,2)){let i=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],c=[r,r,t,t];let u;a[0],a[0],o[0],o[0],o[0],o[0],a[0],a[0];for(let e=0;e<4;e++)u=Kc(s[e],l[e],c[e]),u.distance=0&&o[0]<=1&&a[0]>=0&&a[0]<=1?jc.YES_INTERSECTION:jc.NO_INTERSECTION}const qc={distanceToLine:Kc,intersection:$c};function Xc(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,a)=>{const i={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};a[1]=0,a[2]=0;const s=[],l=[],c=[];t.points.getPoint(0,l),t.points.getPoint(1,c);const u=[],d=[],p=$c(e,n,l,c,u,d);var f;if(i.t=u[0],i.betweenPoints=(f=i.t)>=0&&f<=1,a[0]=d[0],p===jc.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+a[0]*(c[t]-l[t]),s[t]=e[t]+i.t*(n[t]-e[t]);if(Zo(o,s)<=r*r)return i.intersect=1,i}else{let t;if(i.t<0)return t=Kc(e,l,c,o),t.distance<=r*r?(i.t=0,i.intersect=1,i.betweenPoints=!0,i):i;if(i.t>1)return t=Kc(n,l,c,o),t.distance<=r*r?(i.t=1,i.intersect=1,i.betweenPoints=!0,i):i;if(a[0]<0)return a[0]=0,t=Kc(l,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i;if(a[0]>1)return a[0]=1,t=Kc(c,e,n,o),i.t=t.t,t.distance<=r*r?(i.intersect=1,i):i}return i},e.evaluateLocation=(e,n,r)=>{const o=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,a);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(a[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var o,i,s,l,c,u=t[0],d=t[1],p=t[2],f=t[3],g=n[0],m=n[1],h=n[2],v=n[3];(i=u*g+d*m+p*h+f*v)<0&&(i=-i,g=-g,m=-m,h=-h,v=-v),1-i>a?(o=Math.acos(i),s=Math.sin(o),l=Math.sin((1-r)*o)/s,c=Math.sin(r*o)/s):(l=1-r,c=r),e[0]=l*u+c*g,e[1]=l*d+c*m,e[2]=l*p+c*h,e[3]=l*f+c*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Yc={orientations:null};function Zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yc,n),Tc.extend(e,t,n),jt.setGet(e,t,["orientations"]),Xc(e,t)}var Qc={newInstance:jt.newInstance(Zc,"vtkLine"),extend:Zc,...qc,...Hc};function Jc(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=We(t.points):t.points=vc.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=vc.newInstance(),t.points.shallowCopy(e.getPoints())}}const eu={};function tu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eu,n),al.extend(e,t,n),jt.setGet(e,t,["points"]),Jc(e,t)}var nu={newInstance:jt.newInstance(tu,"vtkPointSet"),extend:tu};function ru(e,t,n,r){const o=n[0]-t[0],a=n[1]-t[1],i=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],c=e[2]-t[2];r[0]=a*c-i*l,r[1]=i*s-o*c,r[2]=o*l-a*s}function ou(e,t,n,r){ru(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const au={computeNormalDirection:ru,computeNormal:ou,intersectWithTriangle:function(e,t,n,r,o,a){let i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],c=[],u=[],d=[],p=[];ou(e,t,n,d),ou(r,o,a,p);const f=-Ko(d,e),g=-Ko(p,r),m=[Ko(p,e)+g,Ko(p,t)+g,Ko(p,n)+g];if(m[0]*m[1]>i&&m[0]*m[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const h=[Ko(d,r)+f,Ko(d,o)+f,Ko(d,a)+f];if(h[0]*h[1]>i&&h[0]*h[2]>i)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-g)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};const v=[e,t,n],y=[r,o,a],b=Ko(d,p),x=(f-g*b)/(b*b-1),T=(g-f*b)/(b*b-1),C=[x*d[0]+T*p[0],x*d[1]+T*p[1],x*d[2]+T*p[2]],S=$o(d,p,[]);Xo(S);let P=0,A=0;const I=[],w=[];let O,M,R=50,V=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,a=ei.intersectWithLine(v[n],v[o],r,p);a.intersection&&a.t>0-i&&a.t<1+i&&(a.t<1+i&&a.t>1-i&&(R=P),I[P++]=Ko(a.x,S)-Ko(C,S));const s=ei.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-i&&s.t<1+i&&(s.t<1+i&&s.t>1-i&&(V=A),w[A++]=Ko(s.x,S)-Ko(C,S))}if(P>2){P--;const e=I[2];I[2]=I[R],I[R]=e}if(A>2){A--;const e=w[2];w[2]=w[V],w[V]=e}if(2!==P||2!==A)return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(Number.isNaN(I[0])||Number.isNaN(I[1])||Number.isNaN(w[0])||Number.isNaN(w[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:c,surfaceId:u};if(I[0]>I[1]){const e=I[1];I[1]=I[0],I[0]=e}if(w[0]>w[1]){const e=w[1];w[1]=w[0],w[0]=e}return I[1]2,e.intersectWithLine=(n,r,o,a,i)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};i[2]=0;const l=[],c=o*o,u=[],d=[],p=[];t.points.getPoint(0,u),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],g=[];if(ou(u,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=ei.intersectWithLine(n,r,u,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,a[0]=t.x[0],a[1]=t.x[1],a[2]=t.x[2],!t.intersection)return i[0]=0,i[1]=0,s.intersect=0,s;const o=e.evaluatePosition(a,l,i,g);if(o.evaluation>=0)return o.dist2<=c?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=Zo(u,d),h=Zo(d,p),v=Zo(p,u);t.line||(t.line=Qc.newInstance()),m>h&&m>v?(t.line.getPoints().setPoint(0,u),t.line.getPoints().setPoint(1,d)):h>v&&h>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,u));const y=t.line.intersectWithLine(n,r,o,a,i);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=u[r]-p[r],t[r]=d[r]-p[r],n[r]=a[r]-p[r];return i[0]=Ko(n,e)/v,i[1]=Ko(n,t)/h,s.intersect=1,s}return i[0]=0,i[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const a={subId:0,dist2:0,evaluation:-1};let i,s;const l=[],c=[],u=[],d=[];let p;const f=[],g=[],m=[];let h=0,v=0;const y=[];let b,x,T,C=[];const S=[],P=[],A=[];a.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,c),t.points.getPoint(0,u),ru(l,c,u,d),ei.generalizedProjectPoint(e,l,d,A);let I=0;for(i=0;i<3;i++)p=d[i]<0?-d[i]:d[i],p>I&&(I=p,v=i);for(s=0,i=0;i<3;i++)i!==v&&(y[s++]=i);for(i=0;i<2;i++)f[i]=A[y[i]]-u[y[i]],g[i]=l[y[i]]-u[y[i]],m[i]=c[y[i]]-u[y[i]];if(h=ta(g,m),0===h)return r[0]=0,r[1]=0,a.evaluation=-1,a;if(r[0]=ta(f,m)/h,r[1]=ta(g,f)/h,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(a.dist2=Zo(A,e),n[0]=A[0],n[1]=A[1],n[2]=A[2]),a.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=Zo(e,u),x=Qc.distanceToLine(e,l,u,t,S),T=Qc.distanceToLine(e,u,c,t,P),b{const o=[],a=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,a),t.points.getPoint(2,i);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+a[t]*e[0]+i[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const su={};function lu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,su,n),Tc.extend(e,t,n),iu(e,t)}var cu={newInstance:jt.newInstance(lu,"vtkTriangle"),extend:lu,...au};const uu=["verts","lines","polys","strips"],{vtkWarningMacro:du}=jt,pu={[Mc]:Qc,[Rc]:Qc,[Vc]:cu};function fu(e,t){t.classHierarchy.push("vtkPolyData"),uu.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=We(t[n]):t[n]=dc.newInstance()})),e.getNumberOfCells=()=>uu.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),uu.forEach((n=>{t[n]=dc.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),a=e.getNumberOfStrips(),i=n+r+o+a,s=new Uint8Array(i);let l=s;const c=new Uint32Array(i);let u=c;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>1?Oc:wc,e+=t+1})),u=u.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{u[n]=e,l[n]=t>2?Rc:Mc,1===t&&du("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),u=u.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(u[n]=e,t){case 3:l[n]=Vc;break;case 4:l[n]=Lc;break;default:l[n]=Dc}t<3&&du("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),u+=u.subarray(o),l+=l.subarray(o)}if(a){let e=0;l.fill(Ec,0,a),t.strips.getCellSizes().forEach(((t,n)=>{u[n]=e,e+=t+1}))}t.cells=Wc.newInstance(),t.cells.setCellTypes(i,s,c)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=Ac.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case wc:case Oc:o=t.verts;break;case Mc:case Rc:o=t.lines;break;case Vc:case Lc:case Dc:o=t.polys;break;case Ec:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const a=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(a)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),a=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==a.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||pu[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const gu={};function mu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gu,n),nu.extend(e,t,n),jt.get(e,t,["cells","links"]),jt.setGet(e,t,["verts","lines","polys","strips"]),fu(e,t)}var hu={newInstance:jt.newInstance(mu,"vtkPolyData"),extend:mu};function vu(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const yu={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function bu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yu,n),jt.obj(e,t),jt.algo(e,t,6,0),jt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),jt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),vu(e,t)}const xu={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],a=e.length/(t*n);let i=t,s=n,l=e;const c=[l];for(let e=0;ea&&(u+=t),d<-a&&(u-=t),r[u]?c+=r[u]*o[l]:s-=o[l],i+=1}l[e+n]=c/s}r=[...l];for(let e=0;e{t.renderable!==n&&(t.renderable=n,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),e.modified())},e.createPolyDataForOneLabel=(e,n,r,o,a,i,s)=>{const l=t.renderable.get_tmAtlas().get(e);if(!l)return;const c=t.renderable.getTextPolyData().getPoints().getData(),u=t.lastSize;wu[0]=c[3*n],wu[1]=c[3*n+1],wu[2]=c[3*n+2],Dn(Mu,wu,r),Mu[0]+=.1,Dn(Ou,Mu,o),wn(Vu,Ou,wu),Mu[0]-=.1,Mu[1]+=.1,Dn(Ou,Mu,o),wn(Eu,Ou,wu);for(let e=0;e<3;e++)Vu[e]/=.05*u[0],Eu[e]/=.05*u[1];let d=s.ptIdx,p=s.cellIdx;wu[0]=c[3*n],wu[1]=c[3*n+1],wu[2]=c[3*n+2],a[0]<-.5?On(Mu,Vu,a[0]*i-l.width):a[0]>.5?On(Mu,Vu,a[0]*i):On(Mu,Vu,a[0]*i-l.width/2),In(wu,wu,Mu),On(Mu,Eu,a[1]*i-l.height/2),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,On(Mu,Vu,l.width),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,On(Mu,Eu,l.height),In(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,On(Mu,Vu,l.width),wn(wu,wu,Mu),s.points[3*d]=wu[0],s.points[3*d+1]=wu[1],s.points[3*d+2]=wu[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{const n=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);m(n,n);const r=t.renderable.getTextValues().length,o=4*r,a=2*r,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o);h(Du,n);const c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l};let u=0,d=0,p=0;const f=t.renderable.getTextPolyData().getPoints().getData(),g=t.renderable.getTextValues();for(;u{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0),t.camera=r,e.updateTexturePolyData()}}const Nu=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),t.tmPolyData=hu.newInstance(),t.tmMapper=oc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=hs.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),jt.setGet(e,t,["renderable"]),jt.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},jt.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],Bu(e,t)}),"vtkCubeAxesActorHelper");function ku(e,t){t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=n=>{t.camera!==n&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=n,n&&(t.cameraModifiedSub=n.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{const e=t.camera.getViewMatrix();m(e,e);let n=!1;const r=Fi.getDiagonalLength(t.dataBounds),o=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let a=0;a<6;a++){let i=!1;const s=Math.floor(a/2),l=(s+1)%3,c=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*c]!==t.dataBounds[2*c+1]&&(wu[s]=t.dataBounds[a]-.1*r*Cu[a][s],wu[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),wu[c]=.5*(t.dataBounds[2*c]+t.dataBounds[2*c+1]),Dn(Mu,wu,e),wu[s]=t.dataBounds[a],Dn(Ru,wu,e),wn(Mu,Ru,Mu),Rn(Mu,Mu),i=Mu[2]>o,t.camera.getParallelProjection()||(Rn(Ru,Ru),i=Vn(Ru,Mu)>o)),i!==t.lastFacesToDraw[a]&&(t.lastFacesToDraw[a]=i,n=!0)}return n},e.updatePolyData=(e,n,r)=>{let o=0,a=0;o+=8;let i=0;for(let e=0;e<12;e++)n[e]>0&&i++;if(a+=i,t.gridLines)for(let t=0;t<6;t++)e[t]&&(o+=2*r[Iu[t][0]].length+2*r[Iu[t][1]].length,a+=r[Iu[t][0]].length+r[Iu[t][1]].length);const s=new Float64Array(3*o),l=new Uint32Array(3*a);let c=0,u=0;for(let e=0;e<2;e++)for(let n=0;n<2;n++)for(let r=0;r<2;r++)s[3*c]=t.dataBounds[r],s[3*c+1]=t.dataBounds[2+n],s[3*c+2]=t.dataBounds[4+e],c++;for(let e=0;e<12;e++)n[e]>0&&(l[3*u]=2,l[3*u+1]=Pu[e][0],l[3*u+2]=Pu[e][1],u++);if(t.gridLines)for(let n=0;n<6;n++)if(e[n]){const e=Math.floor(n/2);let o=r[Iu[n][0]];for(let r=0;r{let a=0;for(let e=0;e<12;e++)1===n[e]&&(a+=2,a+=r[Au[e]].length);const i=t.polyData.getPoints().getData(),s=new Float64Array(3*a);let l=0,c=0,u=0;for(let a=0;a<6;a++)if(e[a])for(let e=0;e<4;e++){const d=Su[a][e];if(1===n[d]){const e=Au[d],n=3*Pu[d][0],p=3*Pu[d][1];s[3*l]=.5*(i[n]+i[p]),s[3*l+1]=.5*(i[n+1]+i[p+1]),s[3*l+2]=.5*(i[n+2]+i[p+2]),l++,s[3*l+Math.floor(a/2)]=t.dataBounds[a],s[3*l+Iu[a][0]]=.5*(t.dataBounds[2*Iu[a][0]]+t.dataBounds[2*Iu[a][0]+1]),s[3*l+Iu[a][1]]=.5*(t.dataBounds[2*Iu[a][1]]+t.dataBounds[2*Iu[a][1]+1]),l++,t.textValues[c]=t.axisLabels[e],c++;const f=(e+1)%3,g=(e+2)%3,m=r[e],h=o[e];t.tickCounts[u]=m.length;for(let r=0;r{if(!t.camera)return;const n=e.computeFacesToDraw(),r=t.lastFacesToDraw;let o=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(o=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(n||o||t.forceUpdate){const n=new Array(12).fill(0);for(let e=0;e<6;e++)if(r[e])for(let t=0;t<4;t++)n[Su[e][t]]++;const a=[],i=[];for(let e=0;e<3;e++){const n=mo().domain([t.dataBounds[2*e],t.dataBounds[2*e+1]]);a[e]=n.ticks(5);const r=n.tickFormat(5);i[e]=a[e].map(r)}e.updatePolyData(r,n,a),e.updateTextData(r,n,a,i),(o||t.forceUpdate)&&e.updateTextureAtlas(i)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let n=0,r=1;for(let o=0;o<3;o++){if(!t._tmAtlas.has(t.axisLabels[o])){Lu(t.tmContext,t.axisTextStyle);const e=t.tmContext.measureText(t.axisLabels[o]),a={height:e.actualBoundingBoxAscent+2,startingHeight:r,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[o],a),r+=a.height,n{e.tcoords=[0,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight-e.height)/r,e.width/n,(r-e.startingHeight)/r,0,(r-e.startingHeight)/r]})),t.tmCanvas.width=n,t.tmCanvas.height=r,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,n,r),t._tmAtlas.forEach(((e,n)=>{Lu(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified((()=>{t.forceUpdate=!0,e.update()})),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.getBounds=()=>(e.update(),Fi.setBounds(t.bounds,t.gridActor.getBounds()),Fi.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor),t.bounds);const n=jt.chain(e.setProperty,t.gridActor.setProperty);e.setProperty=e=>n(e)[0]}function Fu(e){return{boundsScaleFactor:1.3,camera:null,dataBounds:[...Fi.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:12,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},...e}}function _u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fu(n)),hs.extend(e,t,n),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=Tu.newInstance(),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=oc.newInstance(),t.polyData=hu.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=hs.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=hu.newInstance(),jt.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset"]),jt.setGetArray(e,t,["dataBounds"],6),jt.setGetArray(e,t,["axisLabels"],3),jt.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),ku(e,t)}var Gu={newInstance:jt.newInstance(_u,"vtkCubeAxesActor"),extend:_u,newCubeAxesActorHelper:Nu};function Uu(e,t){t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const zu={};const Wu=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zu,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Gu.newCubeAxesActorHelper(),Uu(e,t)}),"vtkOpenGLCubeAxesActor");rn("vtkCubeAxesActor",Wu);const Hu={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var ju={ObjectType:Hu};const{ObjectType:Ku}=ju;function $u(e,t){function n(e){switch(e){case Ku.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case Ku.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case Ku.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,a=!0,i="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===a,e.generateBuffer=e=>{const a=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===a},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,a=!1,!0):(i="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>i}const qu={objectType:Ku.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function Xu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qu,n),jt.obj(e,t),jt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),$u(e,t)}var Yu={newInstance:jt.newInstance(Xu),extend:Xu,...ju};const{vtkErrorMacro:Zu}=jt;function Qu(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(Hu.ARRAY_BUFFER),e.createVBO=function(n,r,o,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=a.points.getData();let l=null,c=null,u=null;const d=a.colors?a.colors.getNumberOfComponents():0,p=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),a.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,c=a.tcoords.getData()),a.colors?(t.colorComponents=a.colors.getNumberOfComponents(),t.colorOffset=0,u=a.colors.getData(),t.colorBO||(t.colorBO=Yu.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,g=0,m=0,h=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let C=null,S=null;o===rs.POINTS||"verts"===r?(C=x.anythingToPoints,S=T.anythingToPoints):o===rs.WIREFRAME||"lines"===r?(C=x[`${r}ToWireframe`],S=T[`${r}ToWireframe`]):(C=x[`${r}ToSurface`],S=T[`${r}ToSurface`]);const P=n.getData(),A=P.length;let I=0;for(let e=0;e0&&(Math.abs(E)/V>1e6||Math.abs(Math.log10(V))>3||0===V&&E>1e6);if(D){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=a.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(i)if(i.points||i.cells){const e=new Int32Array(I+i.points.length);e.set(i.points),i.points=e;const t=new Int32Array(I+i.cells.length);t.set(i.cells),i.cells=t}else i.points=new Int32Array(I),i.cells=new Int32Array(I);let L=a.vertexOffset;f=function(e){if(i&&(i.points[L]=e,i.cells[L]=b+a.cellOffset),++L,g=3*e,t.coordShiftAndScaleEnabled?(O[M++]=(s[g++]-t.coordShift[0])*t.coordScale[0],O[M++]=(s[g++]-t.coordShift[1])*t.coordScale[1],O[M++]=(s[g++]-t.coordShift[2])*t.coordScale[2]):(O[M++]=s[g++],O[M++]=s[g++],O[M++]=s[g++]),null!==l&&(m=a.haveCellNormals?3*(b+a.cellOffset):3*e,O[M++]=l[m++],O[M++]=l[m++],O[M++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&Nn(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&Nn(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Bn(e,[0,0,0])&&Bn(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Mn(n,t);const r=new Float64Array(16);return k(r,Ui(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):Zu("Wrong type for coordScale, expected vec3 or null"):Zu("Wrong type for coordShift, expected vec3 or null")}}const Ju={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ed(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ju,n),Yu.extend(e,t,n),jt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),jt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),Qu(e,t)}var td={newInstance:jt.newInstance(ed),extend:ed};const{vtkErrorMacro:nd}=jt;function rd(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return nd(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const od={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ad(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,od,n),jt.obj(e,t),jt.setGet(e,t,["shaderType","source","error","handle","context"]),rd(e,t)}var id={newInstance:jt.newInstance(ad,"vtkShader"),extend:ad};const{vtkErrorMacro:sd}=jt;function ld(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(sd(`Links failed: ${t.error}`),0):(sd(t.error),0):(sd(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),sd(t.fragmentShader.getError()),0):(sd(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),sd(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return sd(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,a),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,a),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(a,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(a,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,a)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(i,r,o,a),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(sd("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return sd("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const cd={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function ud(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cd,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=id.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=id.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=id.newInstance(),t.geometryShader.setShaderType("Geometry"),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),ld(e,t)}var dd={newInstance:jt.newInstance(ud,"vtkShaderProgram"),extend:ud,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),a=!1===r?t:new RegExp(t,"g"),i=e.replace(a,o);return{replace:i!==o,result:i}}};function pd(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,a,i,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,a,i,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,a,i,s,l,c,u,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==Hu.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=a,f.stride=i,f.type=s,f.size=l,f.normalize=c,f.isMatrix=d,f.divisor=u,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),u>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,a,i,s,l,c,u,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const fd={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function gd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fd,n),t.buffers=[],jt.obj(e,t),jt.get(e,t,["supported"]),jt.setGet(e,t,["forceEmulation"]),pd(e,t)}var md={newInstance:jt.newInstance(gd,"vtkOpenGLVertexArrayObject"),extend:gd};const hd={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function vd(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,a)=>{if(t.CABO.getElementCount()){const i=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,c=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),i===l.LINES&&s?(e.updateShaders(n,r,a),l.drawArraysInstanced(i,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,a),l.drawArrays(i,0,t.CABO.getElementCount()),l.lineWidth(1));const u=(i===l.POINTS?1:0)||(i===l.LINES?2:3);return t.pointPicking&&l.depthMask(c),t.CABO.getElementCount()/u}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===rs.POINTS||n===hd.Points?t.context.POINTS:e===rs.WIREFRAME||n===hd.Lines||n===hd.TrisEdges||n===hd.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(a,n,r);const i=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==e.getProgram()&&(e.setProgram(i),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===hd.Points||r.getProperty().getRepresentation()===rs.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let a=n.Vertex;a=dd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(a=dd.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=a},e.getPointPickingPrimitiveSize=()=>t.primitiveType===hd.Points?2:t.primitiveType===hd.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const yd={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function bd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yd,n),jt.obj(e,t),t.shaderSourceTime={},jt.obj(t.shaderSourceTime),t.attributeUpdateTime={},jt.obj(t.attributeUpdateTime),jt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=dd.newInstance(),t.VAO=md.newInstance(),t.CABO=td.newInstance(),vd(e,t)}var xd={newInstance:jt.newInstance(bd),extend:bd,primTypes:hd};const Td={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Cd={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Sd={Wrap:Td,Filter:Cd};const Pd=new Float32Array(1),Ad=new Int32Array(Pd.buffer);var Id={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){Pd[0]=e;const t=Ad[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:wd,Filter:Od}=Sd,{VtkDataTypes:Md}=Es,{vtkDebugMacro:Rd,vtkErrorMacro:Vd,vtkWarningMacro:Ed}=Kt,{toHalf:Dd}=Id;function Ld(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let a=t.width*t.height*t.components;if(r&&(a*=t.depth),e!==Md.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==Md.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ea?n[e].subarray(0,a):n[e];o.push(new Uint8Array(t))}else o.push(null);let i=!1;if(t._openGLRenderWindow.getWebgl2())i=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");i=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(i)for(let e=0;e=o&&(c=o-1);const m=i-l,h=1-m;l=l*r*a,c=c*r*a;for(let t=0;t=r&&(p=r-1);const v=i-s;s*=a,p*=a;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||a);t.useHalfFloat=s}(a,c.offset,c.scale,r),t.useHalfFloat||e.getOpenGLDataType(a,!0),{numComps:o,dataType:a,data:i,scaleOffsets:c}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(Od.LINEAR),e.setMagnificationFilter(Od.LINEAR)):(e.setMinificationFilter(Od.NEAREST),e.setMagnificationFilter(Od.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(wd.REPEAT),e.setWrapS(wd.REPEAT),e.setWrapT(wd.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,Md.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(Od.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,Md.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),a=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:Ed("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||Rd(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(Rd("Unsupported internal texture type!"),Rd(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case Md.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&Md.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&Md.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&Md.SHORT:case t.useHalfFloat&&Md.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case Md.FLOAT:case Md.VOID:default:return t.context.FLOAT}switch(e){case Md.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Md.FLOAT:case Md.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case Od.NEAREST:return t.context.NEAREST;case Od.LINEAR:return t.context.LINEAR;case Od.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case Od.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case Od.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case Od.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case wd.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case wd.REPEAT:return t.context.REPEAT;case wd.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(a,i,s,l,c){let u=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[c],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),u&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(a,i,s,l,c)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=a,t.height=i,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=c.length/6-1,e.createTexture(),e.bind();const u=r(n(l,c)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&a>=1;){let i=null;n<=t.maxLevel&&(i=d[6*n+e]),o(l)?null!=i&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,a,t.format,t.openGLDataType,i):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,a,0,t.format,t.openGLDataType,i),n++,r/=2,a/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,a,i)=>(e.getOpenGLDataType(a),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?a===Md.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=i&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(a,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(Vd("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(Md.UNSIGNED_CHAR),e.getInternalFormat(Md.UNSIGNED_CHAR,4),e.getFormat(Md.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||_o(n.width)&&_o(n.height)),a=document.createElement("canvas");a.width=r?Fo(n.width):n.width,a.height=r?Fo(n.height):n.height,t.width=a.width,t.height=a.height;const i=a.getContext("2d");i.translate(0,a.height),i.scale(1,-1),i.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);const s=a;return o(Md.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(Md.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,a){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Es.newInstance({numberOfComponents:r,dataType:o,values:a}),i)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:i,dataType:s,data:l}=a(r,o);e.create2DFromRaw(t,n,i,s,l)},e.create3DFromRaw=(a,i,s,l,c,u)=>{if(e.getOpenGLDataType(c),e.getInternalFormat(c,l),e.getFormat(c,l),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=a,t.height=i,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(c,[u],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(c)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(c,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,a,i){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Es.newInstance({numberOfComponents:o,dataType:a,values:i}),s)},e.create3DFilterableFromDataArray=function(n,r,i,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:c,dataType:u,data:d,scaleOffsets:p}=a(s,l),f=n*r*i,g=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=Md.UNSIGNED_CHAR;if(u===Md.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=Md.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,c),e.getFormat(y,c),!t.internalFormat||!t.format||!t.openGLDataType)return Vd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===Md.FLOAT||c>=3)&&(b=4096);let x=1,T=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),T=x);let C=Math.sqrt(f)/x;C=Fo(C);const S=Math.floor(C*x/n),P=Math.ceil(i/S),A=Fo(r*P/T);let I;t.width=C,t.height=A,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=P,t.volumeInfo.xstride=x,t.volumeInfo.ystride=T,t.volumeInfo.offset=h.offset,t.volumeInfo.scale=h.scale;const w=C*A*c;I=y===Md.FLOAT?new Float32Array(w):new Uint8Array(w);let O=0;const M=Math.floor(n/x),R=Math.floor(r/T);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const Bd={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:wd.CLAMP_TO_EDGE,wrapT:wd.CLAMP_TO_EDGE,wrapR:wd.CLAMP_TO_EDGE,minificationFilter:Od.NEAREST,magnificationFilter:Od.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function Nd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bd,n),Zt.extend(e,t,n),t.sendParametersTime={},yt(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},yt(t.textureBuildTime,{mtime:0}),St(e,t,["format","openGLDataType"]),Pt(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),xt(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ot(0,t,["openGLRenderWindow"]),Ld(e,t)}const kd=Et(Nd,"vtkOpenGLTexture");var Fd={newInstance:kd,extend:Nd,...Sd};rn("vtkTexture",kd);var _d="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Gd="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",Ud=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const a=e.getCoincidentParameters(r,o);if(a&&(0!==a.factor||0!==a.offset)){let e=n.Fragment;e=dd.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==a.factor?(e=dd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==a.factor?(e=dd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=dd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},zd=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const a=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,a,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,a)},e.getReplacedShaderTemplate=(n,r,o)=>{const a=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let i=n.Vertex;if(a){const e=a.VertexShaderCode;void 0!==e&&""!==e&&(i=e)}n.Vertex=i;let s=n.Fragment;if(a){const e=a.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(a){const e=a.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};const{FieldAssociations:Wd}=al,{primTypes:Hd}=xd,{Representation:jd,Shading:Kd}=ds,{ScalarMode:$d}=oc,{Filter:qd,Wrap:Xd}=Fd,{vtkErrorMacro:Yd}=Kt,Zd={type:"StartEvent"},Qd={type:"EndEvent"},{CoordinateSystem:Jd}=Zi;function ep(e,t){function n(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=Hd.Start;e{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;const s=t.lastBoundBO.getReferenceByName("lastLightComplexity");let l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let c=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(c=c.concat([" vec3 specularColor;"," float specularPower;"])),c=c.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(c=c.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),o=dd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=dd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,a=dd.substitute(a,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,a=dd.substitute(a,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?t.renderable.getInterpolateScalarsBeforeMapping()&&t.renderable.getColorCoordinates()&&!t.drawingEdges?i=dd.substitute(i,"//VTK::Color::Impl",c.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(r.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):c=c.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),i=dd.substitute(i,"//VTK::Color::Impl",c).result):i=dd.substitute(i,"//VTK::Color::Impl",c.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,i=dd.substitute(i,"//VTK::Color::Dec",l).result,e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderLight=(e,n,r)=>{let o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity"),i=t.lastBoundBO.getReferenceByName("lastLightCount");let s=[];switch(a){case 0:o=dd.substitute(o,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:o=dd.substitute(o,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5,\n dot(reflect(lightDirectionVC${e},\n normalVCVSOutput),\n normalize(-vertexVC.xyz))),\n specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),o=dd.substitute(o,"//VTK::Light::Impl",s,!1).result;break;default:Yd("bad light complexity")}e.Fragment=o},e.replaceShaderNormal=(e,n,r)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex,o=e.Geometry,a=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(n=dd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=dd.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=dd.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,a=dd.substitute(a,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(a=dd.substitute(a,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(r.getProperty().getRepresentation())===t.context.LINES?(a=dd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(a=dd.substitute(a,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,a=dd.substitute(a,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,a=dd.substitute(a,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=n,e.Geometry=o,e.Fragment=a}},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r);let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=dd.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=dd.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,o=dd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=dd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=dd.substitute(o,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;n=dd.substitute(n,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const a=t.openGLActor.getActiveTextures();let i=2,s=2;if(a&&a.length>0&&(i=a[0].getComponents(),a[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(i=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(n=dd.substitute(n,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=dd.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,a&&a.length>=1)switch(i){case 1:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(n=dd.substitute(n,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=dd.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,i){case 1:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=dd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes();o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,o=dd.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,a=dd.substitute(a,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getCoincidentParameters=(e,n)=>{let r={factor:0,offset:0};const o=n.getProperty();if(t.renderable.getResolveCoincidentTopology()||o.getEdgeVisibility()&&o.getRepresentation()===jd.SURFACE){const e=t.lastBoundBO.getPrimitiveType();e===Hd.Points||o.getRepresentation()===jd.POINTS?r=t.renderable.getCoincidentTopologyPointOffsetParameter():e===Hd.Lines||o.getRepresentation()===jd.WIREFRAME?r=t.renderable.getCoincidentTopologyLineOffsetParameters():e!==Hd.Tris&&e!==Hd.TriStrips||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),e!==Hd.TrisEdges&&e!==Hd.TriStripsEdges||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),r.factor/=2,r.offset/=2)}const a=t._openGLRenderer.getSelector();return a&&a.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(r.offset-=2),r},e.replaceShaderPicking=(e,n,r)=>{let o=e.Fragment,a=e.Vertex;if(o=dd.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch(t.lastSelectionState!==Hl.ID_LOW24&&t.lastSelectionState!==Hl.ID_HIGH24||(a=dd.substitute(a,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,a=dd.substitute(a,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,o=dd.substitute(o,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,o=dd.substitute(o,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case Hl.ID_LOW24:o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case Hl.ID_HIGH24:o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=dd.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=dd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=o,e.Vertex=a}},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderColor(n,r,o),e.replaceShaderNormal(n,r,o),e.replaceShaderLight(n,r,o),e.replaceShaderTCoord(n,r,o),e.replaceShaderPicking(n,r,o),e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=dd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=dd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}},e.getNeedToRebuildShaders=(e,n,r)=>{let o=0,a=0;const i=e.getPrimitiveType(),s=t.currentInput;let l=!1;const c=s.getPointData().getNormals(),u=s.getCellData().getNormals(),d=r.getProperty().getInterpolation()===Kd.FLAT,p=r.getProperty().getRepresentation(),f=e.getOpenGLMode(p,i);if(f===t.context.TRIANGLES||u&&!c||!d&&c?l=!0:d||f!==t.context.LINES||(l=!0),r.getProperty().getLighting()&&l){o=0;const e=n.getLightsByReference();for(let t=0;t0&&(a++,0===o&&(o=1)),1===o&&(a>1||1!==n.getIntensity()||!n.lightTypeIsHeadLight())&&(o=2),o<3&&n.getPositional()&&(o=3)}}let g=!1;const m=t.lastBoundBO.getReferenceByName("lastLightComplexity"),h=t.lastBoundBO.getReferenceByName("lastLightCount");return m===o&&h===a||(t.lastBoundBO.set({lastLightComplexity:o},!0),t.lastBoundBO.set({lastLightCount:a},!0),g=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(g=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(n,r,o)=>{if(n.getProgram().isUniformUsed("PrimitiveIDOffset")&&n.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),n.getProgram().isUniformUsed("VertexIDOffset")&&n.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){const e=t.lastBoundBO.getReferenceByName("lastLightComplexity");n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||Yd("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("normalMC")&&n.getCABO().getNormalOffset()&&e>0?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"normalMC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||Yd("Error setting normalMC in shader VAO."):n.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach(((e,r)=>{n.getProgram().isAttributeUsed(`${e}MC`)&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),`${e}MC`,n.getCABO().getCustomData()[r].offset,n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getCustomData()[r].components,!1)||Yd(`Error setting ${e}MC in shader VAO.`))})),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),!1)||Yd("Error setting tcoordMC in shader VAO."):n.getVAO().removeAttributeArray("tcoordMC"),n.getProgram().isAttributeUsed("scalarColor")&&n.getCABO().getColorComponents()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO().getColorBO(),"scalarColor",n.getCABO().getColorOffset(),n.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||Yd("Error setting scalarColor in shader VAO."):n.getVAO().removeAttributeArray("scalarColor"),n.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes(),r=[],a=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=a?d(t.tmpMat4,o.getMatrix()):o.getMatrix();a&&(m(i,i),b(i,i,a),m(i,i));for(let n=0;n{const o=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const a=e.getProgram();let i=0;const s=n.getLightsByReference();for(let e=0;e0){const e=r.getColorByReference(),o=r.getIntensity();t.lightColor[0]=e[0]*o,t.lightColor[1]=e[1]*o,t.lightColor[2]=e[2]*o;const s=r.getDirection(),l=n.getActiveCamera().getViewMatrix(),c=[...s];r.lightTypeIsSceneLight()&&(c[0]=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],c[1]=l[4]*s[0]+l[5]*s[1]+l[6]*s[2],c[2]=l[8]*s[0]+l[9]*s[1]+l[10]*s[2],Xo(c)),t.lightDirection[0]=c[0],t.lightDirection[1]=c[1],t.lightDirection[2]=c[2],Xo(t.lightDirection),a.setUniform3fArray(`lightColor${i}`,t.lightColor),a.setUniform3fArray(`lightDirectionVC${i}`,t.lightDirection),i++}}if(o<3)return;const l=n.getActiveCamera().getViewMatrix();m(l,l),i=0;for(let e=0;e0){const e=t.getTransformedPosition(),n=new Float64Array(3);Dn(n,e,l),a.setUniform3fArray(`lightAttenuation${i}`,t.getAttenuationValuesByReference()),a.setUniformi(`lightPositional${i}`,t.getPositional()),a.setUniformf(`lightExponent${i}`,t.getExponent()),a.setUniformf(`lightConeAngle${i}`,t.getConeAngle()),a.setUniform3fArray(`lightPositionVC${i}`,[n[0],n[1],n[2]]),i++}}},e.setCameraShaderParameters=(e,a,i)=>{const s=e.getProgram(),l=t.openGLCamera.getKeyMatrices(a),c=a.getActiveCamera(),u=t.openGLCamera.getKeyMatrixTime().getMTime(),d=s.getLastCameraMTime(),p=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,f=i.getIsIdentity(),m=f?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(i.getCoordinateSystem()===Jd.DISPLAY){const e=t._openGLRenderer.getTiledSizeAndOrigin();g(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b(t.tmpMat4,t.tmpMat4,p),s.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else s.setUniformMatrix("MCPCMatrix",n([l.wcpc,m.mcwc,p],r,t.tmpMat4));s.isUniformUsed("MCVCMatrix")&&s.setUniformMatrix("MCVCMatrix",n([l.wcvc,m.mcwc,p],r,t.tmpMat4)),s.isUniformUsed("normalMatrix")&&s.setUniformMatrix3x3("normalMatrix",n([l.normalMatrix,m.normalMatrix],o,t.tmpMat3)),d!==u&&(s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",c.getParallelProjection()),s.setLastCameraMTime(u)),f||s.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram();let a=r.getProperty(),i=a.getOpacity(),s=t.drawingEdges?a.getEdgeColorByReference():a.getAmbientColorByReference(),l=t.drawingEdges?a.getEdgeColorByReference():a.getDiffuseColorByReference(),c=t.drawingEdges?1:a.getAmbient(),u=t.drawingEdges?0:a.getDiffuse(),d=t.drawingEdges?0:a.getSpecular();const p=a.getSpecularPower();o.setUniformf("opacityUniform",i),o.setUniform3fArray("ambientColorUniform",s),o.setUniform3fArray("diffuseColorUniform",l),o.setUniformf("ambient",c),o.setUniformf("diffuse",u);const f=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(f<1)return;let g=a.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",g),o.setUniformf("specularPowerUniform",p),o.setUniformf("specular",d),o.isUniformUsed("ambientIntensityBF")){if(a=r.getBackfaceProperty(),i=a.getOpacity(),s=a.getAmbientColor(),c=a.getAmbient(),l=a.getDiffuseColor(),u=a.getDiffuse(),g=a.getSpecularColor(),d=a.getSpecular(),o.setUniformf("ambientIntensityBF",c),o.setUniformf("diffuseIntensityBF",u),o.setUniformf("opacityUniformBF",i),o.setUniform3fArray("ambientColorUniformBF",s),o.setUniform3fArray("diffuseColorUniformBF",l),f<1)return;o.setUniformf("specularIntensityBF",d),o.setUniform3fArray("specularColorUniformBF",g),o.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,n)=>{const r=t._openGLRenderer.getSelector();if(r){if(t.selectionWebGLIdsToVTKIds?.points?.length){const e=t.selectionWebGLIdsToVTKIds.points.length;r.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){const e=t.selectionWebGLIdsToVTKIds.cells.length;r.setMaximumCellId(e-1)}r.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;const o=function(e){const t=e.getSelector();return t?t.getCurrentPass():Hl.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==o&&(t.selectionStateChanged.modified(),t.lastSelectionState=o),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(r),e.updateBufferObjects(n,r),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=r.getProperty().getEdgeVisibility()&&o===jd.SURFACE,i=t._openGLRenderer.getSelector(),s=i&&i.getFieldAssociation()===Wd.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===Hl.ID_LOW24||t.lastSelectionState===Hl.ID_HIGH24);for(let i=Hd.Start;i=0)||(t.lastBoundBO=t.primitives[i],t.primitiveIDOffset+=t.primitives[i].drawArrays(n,r,o,e),t.vertexIDOffset+=t.primitives[i].getCABO().getElementCount()))},e.renderPieceFinish=(e,n)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(n,r)=>{if(e.invokeEvent(Zd),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(Qd),!t.currentInput)return void Yd("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context,a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const o=t.currentInput;if(null===o)return;t.renderable.mapScalars(o,1);const a=t.renderable.getColorMapColors();t.haveCellScalars=!1;const i=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(i!==$d.USE_CELL_DATA&&i!==$d.USE_CELL_FIELD_DATA&&i!==$d.USE_FIELD_DATA&&o.getPointData().getScalars()||i===$d.USE_POINT_FIELD_DATA||!a||(t.haveCellScalars=!0));let s=r.getProperty().getInterpolation()!==Kd.FLAT?o.getPointData().getNormals():null;null===s&&o.getCellData().getNormals()&&(t.haveCellNormals=!0,s=o.getCellData().getNormals());const l=r.getProperty().getRepresentation();let c=o.getPointData().getTCoords();if(t.openGLActor.getActiveTextures()||(c=null),t.renderable.getColorCoordinates()){c=t.renderable.getColorCoordinates(),t.internalColorTexture||(t.internalColorTexture=Fd.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(qd.NEAREST),e.setMagnificationFilter(qd.NEAREST),e.setWrapS(Xd.CLAMP_TO_EDGE),e.setWrapT(Xd.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t.renderable.getColorTextureMap(),r=n.getExtent(),o=n.getPointData().getScalars();e.create2DFromRaw(r[1]-r[0]+1,r[3]-r[2]+1,o.getNumberOfComponents(),o.getDataType(),o.getData()),e.activate(),e.sendParameters(),e.deactivate()}const u=`${o.getMTime()}A${l}B${o.getMTime()}C${s?s.getMTime():1}D${a?a.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${c?c.getMTime():1}`;if(t.VBOBuildString!==u){const n={points:o.getPoints(),normals:s,tcoords:c,colors:a,cellOffset:0,vertexOffset:0,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:t.renderable.getCustomShaderAttributes().map((e=>o.getPointData().getArrayByName(e)))};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});const i=[{inRep:"verts",cells:o.getVerts()},{inRep:"lines",cells:o.getLines()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()},{inRep:"polys",cells:o.getPolys()},{inRep:"strips",cells:o.getStrips()}],d=r.getProperty().getEdgeVisibility()&&l===jd.SURFACE;for(let e=Hd.Start;e{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const tp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:Hl.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};function np(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tp,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.primitives=[],t.primTypes=Hd,t.tmpMat3=pe(new Float64Array(9)),t.tmpMat4=g(new Float64Array(16));for(let e=Hd.Start;e{t.lookupTable=Ll.newInstance()},e.getColorModeAsString=()=>jt.enumToString(ap,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>jt.enumToString(ip,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,a)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let i=null,s=!1;if(n===ip.DEFAULT)i=e.getPointData().getScalars(),i||(i=e.getCellData().getScalars(),s=!0);else if(n===ip.USE_POINT_DATA)i=e.getPointData().getScalars();else if(n===ip.USE_CELL_DATA)i=e.getCellData().getScalars(),s=!0;else if(n===ip.USE_POINT_FIELD_DATA){const t=e.getPointData();i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ip.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}else if(n===ip.USE_FIELD_DATA){const t=e.getFieldData();i=r===sp.BY_ID?t.getArrayByIndex(o):t.getArrayByName(a)}return{scalars:i,cellFlag:s}},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString===a)return;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]);const i=e.getLookupTable();i&&(i.build(),t.colorMapColors=i.mapScalars(o,t.colorMode,t.fieldDataTupleId)),t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}}}const cp={static:!1,lookupTable:null,scalarVisibility:!1,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,transformCoordinate:null,viewSpecificProperties:null,customShaderAttributes:[]};function up(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cp,n),Bs(e,t,n),jt.get(e,t,["colorMapColors"]),jt.setGet(e,t,["arrayAccessMode","colorByArrayName","colorMode","lookupTable","renderTime","scalarMode","scalarVisibility","static","transformCoordinate","useLookupTableScalarRange","viewSpecificProperties","customShaderAttributes"]),jt.setGetArray(e,t,["scalarRange"],2),t.viewSpecificProperties||(t.viewSpecificProperties={}),lp(e,t)}var dp={newInstance:jt.newInstance(up,"vtkMapper2D"),extend:up};const pp={BACKGROUND:0,FOREGROUND:1};var fp={DisplayLocation:pp};const{primTypes:gp}=xd,{ScalarMode:mp}=dp,{vtkErrorMacro:hp}=Kt,vp={type:"StartEvent"},yp={type:"EndEvent"};function bp(e,t){t.classHierarchy.push("vtkOpenGLPolyDataMapper2D"),e.buildPass=n=>{n&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{const n=t._openGLRenderWindow.getContext();if(t.context!==n){t.context=n;for(let e=gp.Start;e{e.invokeEvent(vp),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(yp),t.currentInput?t.currentInput.getPoints&&t.currentInput.getPoints().getNumberOfValues()&&(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):hp("No input!")},e.renderPieceStart=(n,r)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(r)),e.updateBufferObjects(n,r),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,n,r)=>e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return!!(o{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,n.getProperty().getOpacity());const o=t.renderable.getColorMapColors();t.haveCellScalars=!1;const a=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(a!==mp.USE_CELL_DATA&&a!==mp.USE_CELL_FIELD_DATA&&a!==mp.USE_FIELD_DATA&&r.getPointData().getScalars()||a===mp.USE_POINT_FIELD_DATA||!o||(t.haveCellScalars=!0));const i=n.getProperty().getRepresentation();let s=r.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(s=null);const l=t.renderable.getTransformCoordinate(),c=e.getRenderWindow().getViews()[0].getViewportSize(e),u=`${r.getMTime()}A${i}B${r.getMTime()}C${o?o.getMTime():1}D${s?s.getMTime():1}E${l?e.getMTime():1}F${c}`;if(t.VBOBuildString!==u){let n=r.getPoints();if(l){const t=vc.newInstance(),r=n.getNumberOfPoints();t.setNumberOfPoints(r);const o=[];for(let a=0;ar.getPointData().getArrayByName(e)))};a.cellOffset+=t.primitives[gp.Points].getCABO().createVBO(r.getVerts(),"verts",i,a),a.cellOffset+=t.primitives[gp.Lines].getCABO().createVBO(r.getLines(),"lines",i,a),a.cellOffset+=t.primitives[gp.Tris].getCABO().createVBO(r.getPolys(),"polys",i,a),a.cellOffset+=t.primitives[gp.TriStrips].getCABO().createVBO(r.getStrips(),"strips",i,a),t.VBOBuildTime.modified(),t.VBOBuildString=u}},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation();t.context.depthMask(!0);for(let a=gp.Start;a{t.lastBoundBO&&t.lastBoundBO.getVAO().release()},e.replaceShaderValues=(t,n,r)=>{e.replaceShaderColor(t,n,r),e.replaceShaderTCoord(t,n,r),e.replaceShaderPicking(t,n,r),e.replaceShaderPositionVC(t,n,r)},e.replaceShaderColor=(e,n,r)=>{let o=e.Vertex,a=e.Geometry,i=e.Fragment;t.haveCellScalars&&(i=dd.substitute(i,"//VTK::Color::Dec",["uniform samplerBuffer texture1;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = texelFetchBuffer(texture1, gl_PrimitiveID + PrimitiveIDOffset);"]).result),0!==t.lastBoundBO.getCABO().getColorComponents()?(o=dd.substitute(o,"//VTK::Color::Dec",["in vec4 diffuseColor;","out vec4 fcolorVSOutput;"]).result,o=dd.substitute(o,"//VTK::Color::Impl",["fcolorVSOutput = diffuseColor;"]).result,a=dd.substitute(a,"//VTK::Color::Dec",["in vec4 fcolorVSOutput[];\n","out vec4 fcolorGSOutput;"]).result,a=dd.substitute(a,"//VTK::Color::Impl",["fcolorGSOutput = fcolorVSOutput[i];"]).result,i=dd.substitute(i,"//VTK::Color::Dec",["in vec4 fcolorVSOutput;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = fcolorVSOutput;"]).result):(i=dd.substitute(i,"//VTK::Color::Dec",["uniform vec4 diffuseColor;"]).result,i=dd.substitute(i,"//VTK::Color::Impl",["gl_FragData[0] = diffuseColor;"]).result),e.Vertex=o,e.Geometry=a,e.Fragment=i},e.replaceShaderTCoord=(e,n,r)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getCABO().getTCoordComponents();1===a?(n=dd.substitute(n,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,r=dd.substitute(r,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=dd.substitute(o,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===a&&(n=dd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,r=dd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,r=dd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=dd.substitute(o,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.haveCellScalars&&(r=dd.substitute(r,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=n,e.Geometry=r,e.Fragment=o}},e.replaceShaderPicking=(e,t,n)=>{let r=e.Fragment;r=dd.substitute(r,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,r=dd.substitute(r,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=r},e.replaceShaderPositionVC=(e,n,r)=>{t.lastBoundBO.replaceShaderPositionVC(e,n,r)},e.invokeShaderCallbacks=(e,n,r)=>{const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach((t=>{t.callback(t.userData,e,n,r)}))},e.setMapperShaderParameters=(e,n,r)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)||hp("Error setting vertexWC in shader VAO.")),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach(((n,r)=>{e.getProgram().isAttributeUsed(`${n}MC`)&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${n}MC`,e.getCABO().getCustomData()[r].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[r].components,!1)||hp(`Error setting ${n}MC in shader VAO.`))})),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||hp("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());const o=t.openGLActor2D.getActiveTextures();if(o)for(let t=0;t{const o=t.renderable.getColorMapColors();if(!o||0===o.getNumberOfComponents()){const t=e.getProgram(),n=r.getProperty(),o=n.getOpacity(),a=n.getColor(),i=[a[0],a[1],a[2],o];t.setUniform4f("diffuseColor",i)}},e.setLightingShaderParameters=(e,t,n)=>{},e.setCameraShaderParameters=(e,n,o)=>{const a=e.getProgram(),i=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=n.getRenderWindow().getViews()[0].getViewportSize(n),l=n.getViewport(),c=o.getActualPositionCoordinate().getComputedDoubleViewportValue(n),u=[0,0,1,1],d=[0,0,1,1];if(d[0]=l[0]>=u[0]?l[0]:u[0],d[1]=l[1]>=u[1]?l[1]:u[1],d[2]=l[2]<=u[2]?l[2]:u[2],d[3]=l[3]<=u[3]?l[3]:u[3],d[0]>=d[2])return;if(d[1]>=d[3])return;s[0]=Vo(s[0]*(d[2]-d[0])/(l[2]-l[0])),s[1]=Vo(s[1]*(d[3]-d[1])/(l[3]-l[1]));const p=t._openGLRenderer.getParent().getSize(),f=Vo(c[0]-(d[0]-l[0])*p[0]),h=Vo(c[1]-(d[1]-l[1])*p[1]),v=-f;let y=-f+s[0];const b=-h;let x=-h+s[1];v===y&&(y=v+1),b===x&&(x=b+1);const T=g(new Float64Array(16));var C,S,P;T[0]=2/(y-v),T[5]=2/(x-b),T[3]=-1*(y+v)/(y-v),T[7]=-1*(x+b)/(x-b),T[10]=0,T[11]=o.getProperty().getDisplayLocation()===pp.FOREGROUND?-1:1,T[15]=1,m(T,T),a.setUniformMatrix("WCVCMatrix",(C=[T,i],S=r,P=t.tmpMat4,S.identity(P),C.reduce(((e,t,n)=>0===n?t?S.copy(e,t):S.identity(e):t?S.multiply(e,e,t):e),P)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach((t=>{e+=t.getAllocatedGPUMemoryInBytes()})),e}}const xp={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null};const Tp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.primitives=[],t.primTypes=gp,t.tmpMat4=g(new Float64Array(16));for(let e=gp.Start;e{const n=e.getLastSize(),r=(n[0]/700)**.8,o=(n[1]/700)**.8,a=Math.min(r,o),i=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(i,t.axisTextStyle),Object.assign(s,t.tickTextStyle),i.fontSize=Math.max(24*a,12),e.getLastAspectRatio()>1?s.fontSize=Math.max(20*a,10):s.fontSize=Math.max(16*a,10);const l=e.updateTextureAtlas();e.setTopTitle(!1);const c=e.getBoxSizeByReference();if(e.getLastAspectRatio()>1)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.98-c[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),c[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/n[0],e.setBoxPosition([.99-c[0],-.92])),c[1]=Math.max(1.2,Math.min(1.84/o,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);const t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/n[1],r=2*l.tickWidth/n[0];c[0]=Math.min(1.9,Math.max(1.4,1.4*r*(e.getTicks().length+3))),c[1]=t,e.setBoxPosition([-.5*c[0],-.97])}e.recomputeBarSegments(l)}}function Ap(e,t){return e=>{const t=e.getLastTickBounds(),n=mo().domain([t[0],t[1]]),r=n.ticks(5),o=n.tickFormat(5);e.setTicks(r),e.setTickStrings(r.map(o))}}function Ip(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=n=>{t.renderable!==n&&(t.renderable=n,t.barActor.setProperty(n.getProperty()),t.barActor.setParentProp(n),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(n.getProperty()),t.tmActor.setParentProp(n),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=n.generateTicks,t.axisTextStyle={...n.getAxisTextStyle()},t.tickTextStyle={...n.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(n,r,o)=>{t.lastSize[0]===n[0]&&t.lastSize[1]===n[1]||(t.lastSize[0]=n[0],t.lastSize[1]=n[1],t.lastAspectRatio=n[0]/n[1],t.forceUpdate=!0);const a=t.renderable.getScalarsToColors();if(a&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(a),t.camera=r,t.renderWindow=o,t.forceUpdate||Math.max(a.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){const n=a.getMappingRange();if(t.lastTickBounds=[...n],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();const n=e.updateTextureAtlas();e.recomputeBarSegments(n)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";const n={},r=new Map;let o=0,a=1;Sp(t.tmContext,t.axisTextStyle);let i=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:i.actualBoundingBoxAscent+2,startingHeight:a,width:i.width+2,textStyle:t.axisTextStyle};r.set(t.renderable.getAxisLabel(),s),a+=s.height,o=s.width,n.titleWidth=s.width,n.titleHeight=s.height,n.tickWidth=0,n.tickHeight=0,Sp(t.tmContext,t.tickTextStyle);const l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight-e.height)/a,e.width/o,(a-e.startingHeight)/a,0,(a-e.startingHeight)/a]})),t.tmCanvas.width=o,t.tmCanvas.height=a,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,o,a),r.forEach(((e,n)=>{Sp(t.tmContext,e.textStyle),t.tmContext.fillText(n,1,e.startingHeight+e.height-1)})),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=r,n},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];const n=2*e.tickHeight/t.lastSize[1],r=[1,1];if(t.vertical){const o=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-o,t.barSize[1]=t.boxSize[1]-n}else{const n=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-n-o,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+o,t.barPosition[1]=t.boxPosition[1],r[1]=n}else{const n=(2*e.tickWidth-8)/t.lastSize[0],o=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-o,t.barPosition[1]=t.boxPosition[1],r[0]=n}return r},e.recomputeBarSegments=n=>{const r=e.computeBarSize(n);t.barSegments=[];const o=[0,0],a=t.vertical?1:0,i=t.vertical?.01:.02;function s(e,n){t.barSegments.push({corners:[[...o],[o[0]+r[0],o[1]],[o[0]+r[0],o[1]+r[1]],[o[0],o[1]+r[1]]],scalars:n,title:e}),o[a]+=r[a]+i}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);const l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();o[a]+=i;const c=r[a];r[a]=l?1-2*i-r[a]-o[a]:1-i-o[a],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(r[a]=c,o[a]+=i,s("Above",[1.1,1.1,1.1,1.1]))};const n=new Float64Array(3);e.createPolyDataForOneLabel=(e,r,o,a,i,s)=>{const l=t._tmAtlas.get(e);if(!l)return;let c=s.ptIdx,u=s.cellIdx;n[0]=(.5*r[0]+.5)*t.lastSize[0],n[1]=(.5*r[1]+.5)*t.lastSize[1],n[2]=r[2],n[0]+=i[0],n[1]+=i[1];const d=[],p="vertical"===a?[1,0]:[0,1];"vertical"===a?(d[0]=l.width,d[1]=-l.height,"middle"===o[0]?n[1]-=l.width/2:"right"===o[0]&&(n[1]-=l.width),"middle"===o[1]?n[0]+=l.height/2:"top"===o[1]&&(n[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===o[0]?n[0]-=l.width/2:"right"===o[0]&&(n[0]-=l.width),"middle"===o[1]?n[1]-=l.height/2:"top"===o[1]&&(n[1]-=l.height)),s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[0],s.tcoords[2*c+1]=l.tcoords[1],c++,n[p[0]]+=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[2],s.tcoords[2*c+1]=l.tcoords[3],c++,n[p[1]]+=d[1],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[4],s.tcoords[2*c+1]=l.tcoords[5],c++,n[p[0]]-=d[0],s.points[3*c]=n[0],s.points[3*c+1]=n[1],s.points[3*c+2]=n[2],s.tcoords[2*c]=l.tcoords[6],s.tcoords[2*c+1]=l.tcoords[7],c++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-3,s.polys[4*u+3]=c-2,u++,s.polys[4*u]=3,s.polys[4*u+1]=c-4,s.polys[4*u+2]=c-2,s.polys[4*u+3]=c-1,s.ptIdx+=4,s.cellIdx+=2};const r=new Float64Array(3);e.updatePolyDataForLabels=()=>{const n=e.getTickStrings().length+t.barSegments.length,o=4*n,a=2*n,i=new Float64Array(3*o),s=new Uint16Array(4*a),l=new Float32Array(2*o),c={ptIdx:0,cellIdx:0,polys:s,points:i,tcoords:l},u=t.vertical?0:1,d=t.vertical?1:0;r[2]=-.99;const p=t.vertical?["right","middle"]:["middle","bottom"];let f=[0,1];const g=[0,0];t.vertical?(g[0]=-t.tickLabelPixelOffset,t.topTitle?(r[0]=t.boxPosition[0]+.5*t.boxSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)):(r[0]=t.barPosition[0]+t.barSize[0],r[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],c)),f=[-1,0]):(g[1]=t.tickLabelPixelOffset,r[0]=t.barPosition[0]+.5*t.barSize[0],r[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),r,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],c)),r[u]=t.barPosition[u]+(.5*f[u]+.5)*t.barSize[u],r[d]=t.barPosition[d]+.5*t.barSize[d];let m=null;for(let n=0;n{const e=t.renderable.getScalarsToColors();let n=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(n+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(n+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(n+=1);const o=4*(1+n),a=o;let i=1;e.getVectorMode()===Cp.COMPONENT&&(i=e.getVectorComponent()+1);const s=new Float64Array(3*o),l=new Uint16Array(5*a),c=new Float32Array(o*i);let u=0,d=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},n),jt.obj(e,t),jt.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings"]),jt.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),jt.getArray(e,t,["boxPosition","boxSize"]),jt.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},jt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=oc.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=hu.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=hs.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=hu.newInstance(),t.tmMapper=oc.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=Tu.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=hs.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],Ip(e,t)}),"vtkScalarBarActorHelper");function Op(e,t){t.classHierarchy.push("vtkScalarBarActor"),e.setTickTextStyle=n=>{t.tickTextStyle={...t.tickTextStyle,...n},e.modified()},e.setAxisTextStyle=n=>{t.axisTextStyle={...t.axisTextStyle,...n},e.modified()},e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(Pp(0,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(Ap())}}function Mp(e){return{automated:!0,autoLayout:null,axisLabel:"Scalar Value",barPosition:[0,0],barSize:[0,0],boxPosition:[.88,-.92],boxSize:[.1,1.1],scalarToColors:null,axisTitlePixelOffset:36,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif"},tickLabelPixelOffset:14,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif"},generateTicks:null,drawNanAnnotation:!0,drawBelowRangeSwatch:!0,drawAboveRangeSwatch:!0,...e}}function Rp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mp(n)),t.autoLayout||(t.autoLayout=Pp(0,t)),t.generateTicks||(t.generateTicks=Ap()),hs.extend(e,t,n),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),jt.setGet(e,t,["automated","autoLayout","axisTitlePixelOffset","axisLabel","scalarsToColors","tickLabelPixelOffset","generateTicks","drawNanAnnotation","drawBelowRangeSwatch","drawAboveRangeSwatch"]),jt.get(e,t,["axisTextStyle","tickTextStyle"]),jt.getArray(e,t,["barPosition","barSize","boxPosition","boxSize"]),jt.setArray(e,t,["barPosition","barSize","boxPosition","boxSize"],2),Op(e,t)}var Vp={newInstance:jt.newInstance(Rp,"vtkScalarBarActor"),extend:Rp,newScalarBarActorHelper:wp};function Ep(e,t){t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,n=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t._openGLRenderWindow.getRenderable())}}}const Dp={};const Lp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dp,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Vp.newScalarBarActorHelper(),Ep(e,t)}),"vtkOpenGLScalarBarActor");rn("vtkScalarBarActor",Lp);const{vtkErrorMacro:Bp}=Kt;function Np(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=n=>{if(n){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera())}},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOpaqueActorCount()}},e.opaquePass=(n,r)=>{if(n&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);const n=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",n);const r=t._openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(r),a=new Float64Array(16);if(h(a,o.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",a),"box"===t.lastFormat){const e=r.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){const e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;const n=Es.newInstance({numberOfComponents:3,values:e});n.setName("points");const r=new Uint16Array(8);r[0]=3,r[1]=0,r[2]=1,r[3]=3,r[4]=3,r[5]=0,r[6]=3,r[7]=2;const o=Es.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(o,"polys",rs.SURFACE,{points:n,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = texture2D(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Bp("Error setting vertexMC in shader VAO."));const e=t.renderable.getTextures();e.length||Bp("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}const kp={context:null};const Fp=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kp,n),Zt.extend(e,t,n),t.openGLTexture=Fd.newInstance(),t.tris=xd.newInstance(),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),xt(e,t,["activeTextures"]),Np(e,t)}));rn("vtkSkybox",Fp);const{FieldAssociations:_p}=al;function Gp(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,a)=>{const i=await e.getSourceDataAsync(t,n,r,o,a);return i?i.generateSelection(n,r,o,a):[]}}const Up={fieldAssociation:_p.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function zp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Up,n),jt.obj(e,t),jt.setGet(e,t,["fieldAssociation","captureZValues"]),Gp(e,t)}var Wp={newInstance:jt.newInstance(zp,"vtkHardwareSelector"),extend:zp};function Hp(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):et("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void et("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void et("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void et("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else et("Attaching depth buffer textures to fbo requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else et("Attaching depth buffer textures to framebuffers requires WebGL 2");else et("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void et("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=Fd.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Cd.LINEAR),r.setMagnificationFilter(Cd.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,ys.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}const jp={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Kp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jp,n),yt(e,t),t.colorBuffers&&et("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],At(e,t,["colorBuffers"]),Hp(e,t)}var $p={newInstance:Et(Kp,"vtkFramebuffer"),extend:Kp};function qp(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const Xp={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Yp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xp,n),jt.obj(e,t),t.properties={},jt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),qp(e,t)}var Zp={newInstance:jt.newInstance(Yp,"vtkSelectionNode"),extend:Yp,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Qp}=jl,{SelectionContent:Jp,SelectionField:ef}=Zp,{FieldAssociations:tf}=al,{vtkErrorMacro:nf}=jt;function rf(e){return`${e.propID} ${e.compositeID}`}function of(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function af(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),a=n[o],i=n[o+1];return 256*(256*n[o+2]+i)+a}function sf(e,t){let n=t;return n<<=24,n|=e,n}function lf(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=af(n[0],n[1],e.pixBuffer[Qp.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const a={valid:!0};a.propID=o-1,a.prop=e.props[a.propID];let i=af(n[0],n[1],e.pixBuffer[Qp.COMPOSITE_INDEX_PASS],e.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);a.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,a.displayPosition=t}if(e.pixBuffer[Qp.ID_LOW24]&&0===of(n[0],n[1],e.pixBuffer[Qp.ID_LOW24],e.area))return a;const s=af(n[0],n[1],e.pixBuffer[Qp.ID_LOW24],e.area),l=af(n[0],n[1],e.pixBuffer[Qp.ID_HIGH24],e.area);return a.attributeID=sf(s,l),a}const a=[t[0],t[1]],i=[0,0];let s=lf(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=lf(e,i,0,r),s&&s.valid))return s;if(i[0]=a[0]+t,s=lf(e,i,0,r),s&&s.valid)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=lf(e,i,0,r),s&&s.valid))return s;if(i[1]=a[1]+t,s=lf(e,i,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function cf(e,t,n,r,o){const a=[];let i=0;return t.forEach(((t,s)=>{const l=Zp.newInstance();switch(l.setContentType(Jp.INDICES),e){case tf.FIELD_ASSOCIATION_CELLS:l.setFieldType(ef.CELL);break;case tf.FIELD_ASSOCIATION_POINTS:l.setFieldType(ef.POINT);break;default:nf("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),a[i]=l,i++})),a}function uf(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=lf(e,[n,t],0,u);if(r&&r.valid){const t=rf(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=$p.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===tf.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,a,i)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,a,i);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return nf("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Qp.MIN_KNOWN_PASS;t.currentPass<=Qp.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Qp.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Qp.ID_HIGH24){if(t.fieldAssociation===tf.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===tf.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Qp.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let a=af(o,r,e,t.area);a>0&&(a--,a in t.hitProps||(t.hitProps[a]=!0,t.propPixels[a]=[]),t.propPixels[a].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Qp.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Qp.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>jt.enumToString(Qp,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const a=r<0?0:r;if(0===a){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=af(e[0],e[1],t.pixBuffer[Qp.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const a={valid:!0};a.propID=r-1,a.prop=t.props[a.propID];let i=af(e[0],e[1],t.pixBuffer[Qp.COMPOSITE_INDEX_PASS],t.area);if((i<0||i>16777215)&&(i=0),a.compositeID=i-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);a.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,a.displayPosition=n}if(t.pixBuffer[Qp.ID_LOW24]&&0===of(e[0],e[1],t.pixBuffer[Qp.ID_LOW24],t.area))return a;const s=af(e[0],e[1],t.pixBuffer[Qp.ID_LOW24],t.area),l=af(e[0],e[1],t.pixBuffer[Qp.ID_HIGH24],t.area);return a.attributeID=sf(s,l),a}const i=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(s[1]=n,i[0]>=t&&(s[0]=i[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=i[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(s[0]=n,i[1]>=t&&(s[1]=i[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=i[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,a)=>{const i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=Math.floor(a),u=new Map,d=[0,0];for(let n=s;n<=c;n++)for(let r=i;r<=l;r++){const o=[r,n],a=e.getPixelInformation(o,0,d);if(a&&a.valid){const e=rf(a);if(u.has(e)){const n=u.get(e);n.pixelCount++,t.captureZValues&&a.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const pf={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ff(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pf,n),Wp.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),jt.setGetArray(e,t,["area"],4),jt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),jt.setGetArray(e,t,["propColorValue"],3),jt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),jt.event(e,t,"event"),df(e,t)}var gf={newInstance:jt.newInstance(ff,"vtkOpenGLHardwareSelector"),extend:ff,...jl};const{vtkErrorMacro:mf}=Kt,{Representation:hf}=ds,{ObjectType:vf}=Yu,{PassTypes:yf}=gf,bf={type:"StartEvent"},xf={type:"EndEvent"};function Tf(e,t){t.classHierarchy.push("vtkOpenGLGlyph3DMapper");const n={...e};e.renderPiece=(n,r)=>{if(e.invokeEvent(bf),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(xf),!t.currentInput)return void mf("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context;t._openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);const a=r.getProperty().getBackfaceCulling(),i=r.getProperty().getFrontfaceCulling();a||i?i?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)},e.multiply4x4WithOffset=(e,t,n,r)=>{const o=t[0],a=t[1],i=t[2],s=t[3],l=t[4],c=t[5],u=t[6],d=t[7],p=t[8],f=t[9],g=t[10],m=t[11],h=t[12],v=t[13],y=t[14],b=t[15];let x=n[r],T=n[r+1],C=n[r+2],S=n[r+3];e[0]=x*o+T*l+C*p+S*h,e[1]=x*a+T*c+C*f+S*v,e[2]=x*i+T*u+C*g+S*y,e[3]=x*s+T*d+C*m+S*b,x=n[r+4],T=n[r+5],C=n[r+6],S=n[r+7],e[4]=x*o+T*l+C*p+S*h,e[5]=x*a+T*c+C*f+S*v,e[6]=x*i+T*u+C*g+S*y,e[7]=x*s+T*d+C*m+S*b,x=n[r+8],T=n[r+9],C=n[r+10],S=n[r+11],e[8]=x*o+T*l+C*p+S*h,e[9]=x*a+T*c+C*f+S*v,e[10]=x*i+T*u+C*g+S*y,e[11]=x*s+T*d+C*m+S*b,x=n[r+12],T=n[r+13],C=n[r+14],S=n[r+15],e[12]=x*o+T*l+C*p+S*h,e[13]=x*a+T*c+C*f+S*v,e[14]=x*i+T*u+C*g+S*y,e[15]=x*s+T*d+C*m+S*b},e.replaceShaderNormal=(e,r,o)=>{if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let n=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(n=dd.substitute(n,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,n=dd.substitute(n,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=n}n.replaceShaderNormal(e,r,o)},e.replaceShaderColor=(e,r,o)=>{if(t.hardwareSupport&&t.renderable.getColorArray()){let n=e.Vertex,r=e.Geometry,o=e.Fragment;const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];a&&(i=i.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let s=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];a&&(s=s.concat([" vec3 specularColor;"," float specularPower;"])),s=s.concat([" opacity = opacityUniform;"]),a&&(s=s.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(i=i.concat(["varying vec4 vertexColorVSOutput;"]),n=dd.substitute(n,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,n=dd.substitute(n,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,r=dd.substitute(r,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,r=dd.substitute(r,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,s=s.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),o=dd.substitute(o,"//VTK::Color::Impl",s).result,o=dd.substitute(o,"//VTK::Color::Dec",i).result,e.Vertex=n,e.Geometry=r,e.Fragment=o}n.replaceShaderColor(e,r,o)},e.replaceShaderPositionVC=(e,r,o)=>{if(t.hardwareSupport){let n=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(n=dd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result,n=dd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result):(n=dd.substitute(n,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCPCMatrix;"]).result,n=dd.substitute(n,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCPCMatrix * gVertexMC;"]).result),e.Vertex=n}n.replaceShaderPositionVC(e,r,o)},e.replaceShaderPicking=(e,r,o)=>{if(t.hardwareSupport){let t=e.Fragment,n=e.Vertex;n=dd.substitute(n,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,n=dd.substitute(n,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,e.Vertex=n,t=dd.substitute(t,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,t=dd.substitute(t,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,e.Fragment=t}else n.replaceShaderPicking(e,r,o)},e.updateGlyphShaderParameters=(n,r,o,a,i,s,l,c)=>{const u=o.getProgram();if(n){const e=t.normalMatrix,n=s,r=9*l,o=t.tmpMat3,a=e[0],i=e[1],c=e[2],d=e[3],p=e[4],f=e[5],g=e[6],m=e[7],h=e[8],v=n[r],y=n[r+1],b=n[r+2],x=n[r+3],T=n[r+4],C=n[r+5],S=n[r+6],P=n[r+7],A=n[r+8];o[0]=v*a+y*d+b*g,o[1]=v*i+y*p+b*m,o[2]=v*c+y*f+b*h,o[3]=x*a+T*d+C*g,o[4]=x*i+T*p+C*m,o[5]=x*c+T*f+C*h,o[6]=S*a+P*d+A*g,o[7]=S*i+P*p+A*m,o[8]=S*c+P*f+A*h,u.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcpcMatrix,i,16*l),u.setUniformMatrix("MCPCMatrix",t.tmpMat4),r&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,i,16*l),u.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a){const e=a.getData();t.tmpColor[0]=e[4*l]/255,t.tmpColor[1]=e[4*l+1]/255,t.tmpColor[2]=e[4*l+2]/255,u.setUniform3fArray("ambientColorUniform",t.tmpColor),u.setUniform3fArray("diffuseColorUniform",t.tmpColor)}c&&u.setUniform3fArray("mapperIndex",c.getPropColorValue())},e.renderPieceDraw=(n,r)=>{const o=r.getProperty().getRepresentation(),a=t.context,i=r.getProperty().getEdgeVisibility()&&o===hf.SURFACE,s=t.openGLCamera.getKeyMatrices(n),l=t.openGLActor.getKeyMatrices();ve(t.normalMatrix,s.normalMatrix,l.normalMatrix),b(t.mcpcMatrix,s.wcpc,l.mcwc),b(t.mcvcMatrix,s.wcvc,l.mcwc);const c=t.renderable.getMatrixArray(),u=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),p=c.length/16;let f=!1;t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().getCurrentPass()===yf.COMPOSITE_INDEX_PASS&&(f=!0);for(let s=t.primTypes.Start;s{if(e.getCABO().getElementCount()&&(t.glyphBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime()))return e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||mf("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||mf("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||mf("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||mf("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(e,r,o),void e.getAttributeUpdateTime().modified();n.setMapperShaderParameters(e,r,o)},e.getNeedToRebuildBufferObjects=(e,r)=>(t.renderable.buildArrays(),t.VBOBuildTime.getMTime()!!(n.getNeedToRebuildShaders(e,r,o)||e.getShaderSourceTime().getMTime(){if(t.hardwareSupport){const e=t.renderable.getMatrixArray(),n=t.renderable.getNormalArray(),r=t.renderable.getColorArray();if(t.matrixBuffer||(t.matrixBuffer=Yu.newInstance(),t.matrixBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.normalBuffer=Yu.newInstance(),t.normalBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorBuffer=Yu.newInstance(),t.colorBuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.pickBuffer=Yu.newInstance(),t.pickBuffer.setOpenGLRenderWindow(t._openGLRenderWindow)),t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(e,vf.ARRAY_BUFFER),t.normalBuffer.upload(n,vf.ARRAY_BUFFER),r?t.colorBuffer.upload(r.getData(),vf.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();const o=e.length/16,a=new Uint8Array(4*o);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cf,n),op.extend(e,t,n),t.tmpMat3=pe(new Float64Array(9)),t.normalMatrix=pe(new Float64Array(9)),t.mcpcMatrix=g(new Float64Array(16)),t.mcvcMatrix=g(new Float64Array(16)),t.tmpColor=[],t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),Tf(e,t)}),"vtkOpenGLGlyph3DMapper");rn("vtkGlyph3DMapper",Sf);const{vtkErrorMacro:Pf}=jt;class Af{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const a=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Pf("Invalid or missing input");const r=hu.newInstance();r.shallowCopy(n);const o=new Af,a=n.getLines().getData();let i=0;for(;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wf,n),jt.obj(e,t),jt.algo(e,t,1,1),If(e,t)}var Mf={newInstance:jt.newInstance(Of,"vtkClosedPolyLineToSurfaceFilter"),extend:Of};const{vtkErrorMacro:Rf}=Kt;function Vf(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Rf("Invalid or missing input");if(!t.cutFunction)return void Rf("Missing cut function");const o=hu.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),a=r.getNumberOfPoints(),i=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const a=[];for(let e=0;e0;if(g[r]>0===i)continue;let s=e,l=r,c=g[l]-g[s];c<=0&&(s=r,l=e,c*=-1);let u=0;0!==c&&(u=(t.cutValue-g[s])/c);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const h=[p[0]+u*(f[0]-p[0]),p[1]+u*(f[1]-p[1]),p[2]+u*(f[2]-p[2])];a.push({pointEdge1:d,pointEdge2:m,intersectedPoint:h,newPointID:-1})}for(let e=0;e2&&(l.push(c),a.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(it(r.getDataType(),i),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Ef={cutFunction:null,cutScalars:null,cutValue:0};function Df(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ef,n),yt(e,t),Mt(e,t,1,1),Pt(e,t,["cutFunction","cutValue"]),Vf(e,t)}var Lf={newInstance:Et(Df,"vtkCutter"),extend:Df};const Bf=e=>e,Nf=1e-6;class kf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=g(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?l:Bf}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);An(n,e[0],e[1],e[2]),An(r,t[0],t[1],t[2]),Rn(n,n),Rn(r,r);const a=Vn(n,r);return a>=1||(En(this.tmp,n,r),Sn(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(sa(yo,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wf,n),jt.obj(e,t),jt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),jt.setGetArray(e,t,["center","rotations"],3),jt.setGetArray(e,t,["matrix"],16),t._polys=dc.newInstance({values:Uint16Array.from(Uf)}),t._lineCells=dc.newInstance({values:Uint16Array.from(Gf)}),jt.moveToProtected(e,t,["polys","lineCells"]),jt.algo(e,t,0,1),zf(e,t)}var jf={newInstance:jt.newInstance(Hf,"vtkCubeSource"),extend:Hf};const{vtkErrorMacro:Kf}=jt;function $f(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Kf("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Kf("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qf={};function Xf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qf,n),jt.obj(e,t),jt.algo(e,t,1,1),t._cubeSource=jf.newInstance(),jt.moveToProtected(e,t,["cubeSource","tmpOut"]),$f(e,t)}var Yf={newInstance:jt.newInstance(Xf,"vtkImageDataOutlineFilter"),extend:Xf};let Zf;function Qf(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Dn(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let a=0;a{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?b(n,t.matrix,e):b(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),a=t.preMultiplyFlag?()=>b(o,t.matrix,r):()=>b(o,r,t.matrix);for(let t=0;tZf({matrix:Ga.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const Jf={preMultiplyFlag:!1,matrix:[...yo]};function eg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jf,n),jt.obj(e,t),jt.setGet(e,t,["preMultiplyFlag"]),jt.setGetArray(e,t,["matrix"],16),Qf(e,t)}Zf=jt.newInstance(eg,"vtkTransform");var tg={newInstance:Zf,extend:eg};const ng={NEAREST:0,LINEAR:1};var rg={InterpolationType:ng};const{vtkErrorMacro:og}=Kt;function ag(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ig(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function sg(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):og("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===ng.NEAREST?(t.openGLTexture.setMinificationFilter(Cd.NEAREST),t.openGLTexture.setMagnificationFilter(Cd.NEAREST),t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST),t.pwfTexture.setMinificationFilter(Cd.NEAREST),t.pwfTexture.setMagnificationFilter(Cd.NEAREST)):(t.openGLTexture.setMinificationFilter(Cd.LINEAR),t.openGLTexture.setMagnificationFilter(Cd.LINEAR),t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR),t.pwfTexture.setMinificationFilter(Cd.LINEAR),t.pwfTexture.setMagnificationFilter(Cd.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const a=o.getNumberOfComponents();let i=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===i&&t.openGLTextureString===i)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=Fd.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=i,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),c=l.getIndependentComponents(),u=c?a:1,d=c?2*u:1,p=l.getRGBTransferFunction();i=ag(l,p,u);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===i&&t.colorTextureString===i)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=Fd.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:og("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",rs.SURFACE,r)}t.VBOBuildString=h,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){a.isUniformUsed("texture1")&&a.setUniformi("texture1",t.openGLTexture.getTextureUnit()),a.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||og("Error setting vertexWC in shader VAO.")),a.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||og("Error setting normalWC in shader VAO.")),a.isUniformUsed("slabThickness")&&a.setUniformf("slabThickness",t.renderable.getSlabThickness()),a.isUniformUsed("spacing")&&a.setUniform3fv("spacing",t.currentInput.getSpacing()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabType")&&a.setUniformi("slabType",t.renderable.getSlabType()),a.isUniformUsed("slabTrapezoid")&&a.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(a.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();d(t.tmpMat4,n.getIndexToWorld()),T(t.tmpMat4,t.tmpMat4,r),h(t.tmpMat4,t.tmpMat4),e&&b(t.tmpMat4,t.tmpMat4,e),a.setUniformMatrix("WCTCMatrix",t.tmpMat4)}a.isUniformUsed("vboScaling")&&a.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const a=t._openGLCamera.getKeyMatrices(n),i=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",ig([a.wcpc,i.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(g(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",ig([a.wcvc,i.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.openGLTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let c=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(c=!0),!(!c&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a&&t.lastSlabThickness===i&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,t.lastSlabThickness=i,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=dd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=dd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const a=e.Geometry;let i=e.Fragment;const s=t.renderable.getSlabThickness();o=dd.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=dd.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),c=r.getProperty().getIndependentComponents();let u=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(c){for(let e=1;e0&&(u=u.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),u=u.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),i=dd.substitute(i,"//VTK::TCoord::Dec",u).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),c){const e=["r","g","b","a"];for(let t=0;t{let a=n.Vertex;const i=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let c=["attribute vec4 vertexWC;"];c=c.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(c=c.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),a=dd.substitute(a,"//VTK::PositionVC::Dec",c).result;let u=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(u=u.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),a=dd.substitute(a,"//VTK::PositionVC::Impl",u).result,a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=dd.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=a,n.Geometry=i,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const i=t.renderable.getSlicePolyData(),s=t.renderable.getSlicePlane();if(i)e=e.concat(`PolyData${i.getMTime()}`);else if(s){e=e.concat(`Plane${s.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=ue(n?.getDirection());ge(t,t);const r=[...s.getNormal()];Ln(r,r,t),[o,a]=function(e){Ga.normalize(e);const t=[0,0,0];for(let r=0;r<3;++r){(n=t)[0]=0,n[1]=0,n[2]=0,t[r]=1;const o=Ga.dot(e,t);if(o<-.999||o>.999)return[!0,r]}var n;return[!1,2]}(r)}else{const o=ei.newInstance();o.setNormal(0,0,1);let a=[0,1,0,1,0,1];n&&(a=r),o.setOrigin(a[0],a[2],.5*(a[5]+a[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${s?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(i)t.resliceGeom||(t.resliceGeom=hu.newInstance()),t.resliceGeom.getPoints().setData(i.getPoints().getData(),3),t.resliceGeom.getPolys().setData(i.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(i.getPointData().getNormals());else if(s)if(o){const e=new Float32Array(12),r=n.worldToIndex(s.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),l=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let c=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[c+a]=r[a],e[c+o[0]]=l[2*o[0]+n],e[c+o[1]]=l[2*o[1]+t],c+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const u=new Uint16Array(8);u[0]=3,u[1]=0,u[2]=1,u[3]=3,u[4]=3,u[5]=0,u[6]=3,u[7]=2;const d=s.getNormal();Ga.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=hu.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(u,1);const f=Es.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(s),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=hu.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=s.getNormal(),o=t.resliceGeom.getNumberOfPoints();Ga.normalize(r);const a=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const lg={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const cg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lg,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.tris=xd.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},yt(t.VBOBuildTime),t.tmpMat4=g(new Float64Array(16)),t.outlineFilter=Yf.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=hu.newInstance(),t.cutter=Lf.newInstance(),t.lineToSurfaceFilter=Mf.newInstance(),t.transform=tg.newInstance(),xt(e,t,["openGLTexture"]),sg(e,t)}),"vtkOpenGLImageResliceMapper");rn("vtkImageResliceMapper",cg);var ug={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}};const{vtkErrorMacro:dg}=Kt,{SlicingMode:pg}=ug;function fg(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function gg(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function mg(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,a=dd.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,a=dd.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:i=dd.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=a,n.Fragment=i,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(et("OpenGL has a limit of 6 clipping planes"),e=6),o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=dd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=dd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),a=r.getProperty().getIndependentComponents();let i=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(i=!0),!(!i&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===a||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||dg("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||dg("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const a=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",a);const i=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(et("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const a=n.getProgram(),i=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();b(t.imagemat,i.mcwc,l);const c=t.openGLCamera.getKeyMatrices(r);if(b(t.imagemat,c.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,e)}if(a.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();a.setUniform3i("imageDimensions",o[0],o[1],1),a.setUniformMatrix("vWCtoIDX",n);const i=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,i.wcpc),t.openGLCamera.getKeyMatrices(r),a.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();a.setUniformf("vpWidth",l[0]),a.setUniformf("vpHeight",l[1]);const c=e.getRenderTargetOffset();a.setUniformf("vpOffsetX",c[0]/l[0]),a.setUniformf("vpOffsetY",c[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):dg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;const i=a.getDataType(),s=a.getNumberOfComponents(),l=r.getProperty(),c=l.getInterpolationType(),u=l.getIndependentComponents(),d=u?s:1,p=u?2*d:1,f=l.getRGBTransferFunction(),g=fg(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===g&&t.colorTextureString===g)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=Fd.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),c===ng.NEAREST?(t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST)):(t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[pg.X,pg.Y,pg.Z].includes(t.renderable.getSlicingMode())?x:T,p=o.getSpatialExtent(),f=a.getData();let g=null;if(b===pg.I){g=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=Fd.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const hg={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const vg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hg,n),Zt.extend(e,t,n),Ud(e,t,n),zd(e,t,n),t.tris=xd.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),Pt(e,t,[]),t.VBOBuildTime={},yt(t.VBOBuildTime),mg(e,t)}),"vtkOpenGLImageMapper");rn("vtkAbstractImageMapper",vg);const{vtkErrorMacro:yg}=jt;function bg(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function xg(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===ng.NEAREST?(t.volumeTexture.setMinificationFilter(Cd.NEAREST),t.volumeTexture.setMagnificationFilter(Cd.NEAREST),t.colorTexture.setMinificationFilter(Cd.NEAREST),t.colorTexture.setMagnificationFilter(Cd.NEAREST),t.pwfTexture.setMinificationFilter(Cd.NEAREST),t.pwfTexture.setMagnificationFilter(Cd.NEAREST)):(t.volumeTexture.setMinificationFilter(Cd.LINEAR),t.volumeTexture.setMagnificationFilter(Cd.LINEAR),t.colorTexture.setMinificationFilter(Cd.LINEAR),t.colorTexture.setMagnificationFilter(Cd.LINEAR),t.pwfTexture.setMinificationFilter(Cd.LINEAR),t.pwfTexture.setMagnificationFilter(Cd.LINEAR));const a=r.getMTime();if(t.volumeTextureTime!==a){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=a}const i=r.getPointData()&&r.getPointData().getScalars();if(!i)return;const s=i.getNumberOfComponents(),l=n.getProperty(),c=l.getIndependentComponents(),u=c?s:1,d=c?2*u:1,p=bg(l,l.getRGBTransferFunction,u);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),a=r.getProperty().getIndependentComponents(),i=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==i||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==a)&&(t.lastUseCenterPoint=i,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=a,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let a=n.Vertex,i=n.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,a=dd.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),a=dd.substitute(a,"//VTK::Color::Dec",s).result;const c=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?c.push("centerlineDirVSOutput = centerlineDirection;"):c.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),a=dd.substitute(a,"//VTK::Color::Impl",c).result;const u=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,a=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=dd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=dd.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,a=dd.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,a=dd.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=a},e.getShaderTemplate=(e,t,n)=>{e.Vertex=_d,e.Fragment=Gd,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||yg("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&yg(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const a=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",a),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const i=t.currentImageDataInput,s=i.getWorldToIndex(),l=w(new Float32Array(16),Mn([],i.getDimensions())),c=oe(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",c),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(jt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,a=r?d(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(m(a,a),b(a,a,r),m(a,a)),m(t.imagemat,t.currentImageDataInput.getIndexToWorld()),b(t.imagematinv,a,t.imagemat);const i=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,a=t.openGLCamera.getKeyMatrices(n).wcpc;if(b(t.imagemat,a,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();b(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=r.getProperty(),i=a.getOpacity();o.setUniformf("opacity",i);const s=t.volumeTexture.getComponents(),l=a.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const Tg={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const Cg=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tg,n),Zt.extend(e,t,n),Ud(e,t,n),jt.algo(e,t,2,0),t.tris=xd.newInstance(),t.volumeTexture=Fd.newInstance(),t.colorTexture=Fd.newInstance(),t.pwfTexture=Fd.newInstance(),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),xg(e,t)}),"vtkOpenGLImageCPRMapper");function Sg(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}rn("vtkImageCPRMapper",Cg);const Pg={context:null,keyMatrixTime:null,keyMatrices:null};const Ag=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},Pt(e,t,["context"]),Sg(e,t)}),"vtkOpenGLImageSlice");function Ig(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.MCWCMatrix,t.renderable.getMatrix()),m(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?pe(t.normalMatrix):(se(t.normalMatrix,t.MCWCMatrix),ge(t.normalMatrix,t.normalMatrix),fe(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}rn("vtkImageSlice",Ag);const wg={};const Og=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wg,n),Zt.extend(e,t,n),t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),Pt(e,t,["context"]),Ig(e,t)}),"vtkOpenGLVolume");rn("vtkVolume",Og);const Mg=0,Rg=1,Vg=1,Eg=0,Dg=1,Lg=2,Bg=3,Ng=4,{vtkWarningMacro:kg,vtkErrorMacro:Fg}=Kt;function _g(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Gg(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let a=n.Fragment;o.getProperty().getInterpolationType()===Rg&&(a=dd.substitute(a,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(a=dd.substitute(a,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const i=t.scalarTexture.getComponents();a=dd.substitute(a,"//VTK::NumComponents",`#define vtkNumComponents ${i}`).result;const s=o.getProperty().getIndependentComponents();if(s){a=dd.substitute(a,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(a=dd.substitute(a,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),c=t.currentInput.getSpacing(),u=new Float64Array(3);An(u,(l[1]-l[0])*c[0],(l[3]-l[2])*c[1],(l[5]-l[4])*c[2]);const d=Sn(u)/e.getCurrentSampleDistance(r);a=dd.substitute(a,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,a=dd.substitute(a,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(a=dd.substitute(a,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(a=dd.substitute(a,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(a=dd.substitute(a,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,a=0;n.getLights().forEach((e=>{e.getSwitch()&&(a+=1)})),o=dd.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${a}];`,`uniform vec3 lightDirectionVC[${a}]; // normalized`,`uniform vec3 lightHalfAngleVC[${a}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=dd.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${a}];`,`uniform vec3 lightAttenuation[${a}];`,`uniform float lightConeAngle[${a}];`,`uniform float lightExponent[${a}];`,`uniform int lightPositional[${a}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=dd.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=dd.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=dd.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=dd.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let a=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===Eg&&(a=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===a&&(a=1)),1===a&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(a=2),a<3&&e.getPositional()&&(a=3)})));let i=!1;t.lastLightComplexity!==a&&(t.lastLightComplexity=a,i=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let c=!1;const u=[];if(l){for(let e=0;e0&&(c=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);An(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const g=Sn(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:c,iComps:l,maxSamples:g,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:u};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const a={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(a,r,o);const i=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==n.getProgram()&&(n.setProgram(i),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const a=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(a.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(a,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Fg("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),a.setUniformi("texture1",t.scalarTexture.getTextureUnit()),a.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const i=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],c=[];for(let e=0;e<4;e++)l[e]=s[0]*i.dataComputedScale[e]+i.dataComputedOffset[e],c[e]=s[1]*i.dataComputedScale[e]+i.dataComputedOffset[e],l[e]=(l[e]-i.offset[e])/i.scale[e],c[e]=(c[e]-i.offset[e])/i.scale[e];if(a.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),a.setUniform4f("ipScalarRangeMax",c[0],c[1],c[2],c[3]),null!==t.zBufferTexture){a.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();a.setUniformf("vpZWidth",e[0]),a.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const a=t.openGLCamera.getKeyMatrices(r),i=t.openGLVolume.getKeyMatrices();b(t.modelToView,a.wcvc,i.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),c=l.getClippingRange();s.setUniformf("camThick",c[1]-c[0]),s.setUniformf("camNear",c[0]),s.setUniformf("camFar",c[1]);const u=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let g=1,m=-1,v=1,y=-1;for(let e=0;e<8;++e)An(p,u[e%2],u[2+Math.floor(e/2)%2],u[4+Math.floor(e/4)]),Dn(p,p,t.modelToView),l.getParallelProjection()||(Rn(f,p),On(p,f,-c[0]/p[2])),Dn(p,p,a.vcpc),g=Math.min(p[0],g),m=Math.max(p[0],m),v=Math.min(p[1],v),y=Math.max(p[1],y);s.setUniformf("dcxmin",g),s.setUniformf("dcxmax",m),s.setUniformf("dcymin",v),s.setUniformf("dcymax",y),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),T=t.currentInput.getSpacing(),C=new Float64Array(3);An(C,(x[1]-x[0])*T[0],(x[3]-x[2])*T[1],(x[5]-x[4])*T[2]),s.setUniform3f("vSpacing",T[0],T[1],T[2]),An(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Dn(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();b(t.idxToView,t.modelToView,S),ve(t.idxNormalMatrix,a.normalMatrix,i.normalMatrix),ve(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const P=Sn(C)/e.getCurrentSampleDistance(r);P>t.renderable.getMaximumSamplesPerRay()&&kg(`The number of steps required ${Math.ceil(P)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const A=new Float64Array(3);if(An(A,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(A,A,C),s.setUniform3f("vVCToIJK",A[0],A[1],A[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const I=new Float64Array(3),w=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:An(I,-1,0,0),An(w,x[0],x[2],x[4]);break;case 2:An(I,0,1,0),An(w,x[1],x[3],x[5]);break;case 3:An(I,0,-1,0),An(w,x[0],x[2],x[4]);break;case 4:An(I,0,0,1),An(w,x[1],x[3],x[5]);break;case 5:An(I,0,0,-1),An(w,x[0],x[2],x[4]);break;default:An(I,1,0,0),An(w,x[1],x[3],x[5])}Ln(I,I,t.idxNormalMatrix),Dn(w,w,t.idxToView);const n=-1*Vn(w,I);s.setUniform3f(`vPlaneNormal${e}`,I[0],I[1],I[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[a,i]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const c=t.openGLCamera.getKeyMatrices(r);h(t.projectionToWorld,c.wcpc),o.setClippingRange(a,i),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const u=e.getRenderTargetSize();s.setUniformf("vpWidth",u[0]),s.setUniformf("vpHeight",u[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/u[0]),s.setUniformf("vpOffsetY",d[1]/u[1])}if(h(t.projectionToView,a.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let O=0;const M=[],R=[],V=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();M[0+3*O]=t[0]*n,M[1+3*O]=t[1]*n,M[2+3*O]=t[2]*n;const r=e.getDirection();An(I,r[0],r[1],r[2]),Ln(I,I,a.normalMatrix),Rn(I,I),R[0+3*O]=I[0],R[1+3*O]=I[1],R[2+3*O]=I[2],V[0+3*O]=-.5*I[0],V[1+3*O]=-.5*I[1],V[2+3*O]=-.5*(I[2]-1),O++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",O),s.setUniform3fv("lightColor",M),s.setUniform3fv("lightDirectionVC",R),s.setUniform3fv("lightHalfAngleVC",V),3===t.lastLightComplexity){O=0;const e=[],n=[],o=[],a=[],i=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*O]=s[0],n[1+3*O]=s[1],n[2+3*O]=s[2],a[O]=r.getExponent(),o[O]=r.getConeAngle(),i[O]=r.getPositional();const l=r.getTransformedPosition();Dn(l,l,t.modelToView),e[0+3*O]=l[0],e[1+3*O]=l[1],e[2+3*O]=l[2],O+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",a),s.setUniformiv("lightPositional",i)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const a=t.scalarTexture.getVolumeInfo(),i=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",i.getAmbient()),o.setUniformf("vDiffuse",i.getDiffuse()),o.setUniformf("vSpecular",i.getSpecular()),o.setUniformf("vSpecularPower",i.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],a=[],i=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Mg?(t.scalarTexture.setMinificationFilter(Cd.NEAREST),t.scalarTexture.setMagnificationFilter(Cd.NEAREST)):(t.scalarTexture.setMinificationFilter(Cd.LINEAR),t.scalarTexture.setMagnificationFilter(Cd.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=md.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Fg("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Fg("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():wa(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const a=o.getPointData()&&o.getPointData().getScalars();if(!a)return;t._scalars!==a&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=a);const i=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Cd.LINEAR),t.jitterTexture.setMagnificationFilter(Cd.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,ys.UNSIGNED_CHAR,e)}const s=a.getNumberOfComponents(),l=i.getIndependentComponents()?s:1,c=i.getScalarOpacity(),u=t._openGLRenderWindow.getGraphicsResourceForObject(c);let d=_g(i,c,l);if(u.vtkObj&&u.hash===d&&t.opacityTextureString===d)t.opacityTexture=u.vtkObj,t.opacityTextureString=u.hash;else{const r=1024,o=2*r*l,a=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Es.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Es.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",rs.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,a=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ug,n),Zt.extend(e,t,n),t.VBOBuildTime={},yt(t.VBOBuildTime,{mtime:0}),t.tris=xd.newInstance(),t.scalarTexture=Fd.newInstance(),t.opacityTexture=Fd.newInstance(),t.colorTexture=Fd.newInstance(),t.jitterTexture=Fd.newInstance(),t.jitterTexture.setWrapS(Td.REPEAT),t.jitterTexture.setWrapT(Td.REPEAT),t.labelOutlineThicknessTexture=Fd.newInstance(),t.framebuffer=$p.newInstance(),t.idxToView=g(new Float64Array(16)),t.idxNormalMatrix=pe(new Float64Array(9)),t.modelToView=g(new Float64Array(16)),t.projectionToView=g(new Float64Array(16)),t.projectionToWorld=g(new Float64Array(16)),Pt(e,t,["context"]),Gg(e,t)}),"vtkOpenGLVolumeMapper");rn("vtkVolumeMapper",zg);const{vtkDebugMacro:Wg}=Kt;function Hg(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),a=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,i=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),a=t._openGLRenderWindow.getContext();e.bind();const i=r.getFramebuffer();i?i.saveCurrentBindingsAndBuffers():Wg("No framebuffer to save/restore");const l=a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e.getHandle(),0),a.checkFramebufferStatus(a.FRAMEBUFFER)===a.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),a.viewport(0,0,n,o),a.readPixels(0,0,n,o,a.RGBA,a.UNSIGNED_BYTE,s)),i&&i.restorePreviousBindingsAndBuffers(),a.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const jg={};const Kg=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jg,n),Zt.extend(e,t,n),Hg(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");rn("vtkPixelSpaceCallbackMapper",Kg);var $g="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtktextureObjectVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\nattribute vec2 tcoordDC;\nvarying vec2 tcoordVC;\n\nvoid main()\n{\n tcoordVC = tcoordDC;\n gl_Position = vertexDC;\n}\n";const{Representation:qg}=ds;function Xg(e,t,n,r){let[o,a]=t;const i=e.getContext(),s=Fd.newInstance({autoParameters:!1,wrapS:r,wrapT:r,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:i.FLOAT,baseLevel:0,maxLevel:0});return s.setOpenGLRenderWindow(e),s.setInternalFormat(i.RGBA32F),s.create2DFromRaw(o,a,4,"Float32Array",null),s.activate(),s.sendParameters(),s.deactivate(),s}function Yg(e,t){return Xg(e,t,Fd.Filter.NEAREST,Fd.Wrap.CLAMP_TO_EDGE)}function Zg(e,t){t.classHierarchy.push("vtkLICPingPongBufferManager"),t._openGLRenderWindow?(t.quad=function(e){const t=xd.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Es.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Es.newInstance({numberOfComponents:1,values:o}),s=Es.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",qg.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow),t.context=t._openGLRenderWindow.getContext(),t.licTexture0=Yg(t._openGLRenderWindow,t.size),t.seedTexture0=Yg(t._openGLRenderWindow,t.size),t.licTexture1=Yg(t._openGLRenderWindow,t.size),t.seedTexture1=Yg(t._openGLRenderWindow,t.size),t.eeTexture=t.doEEPass?Xg(t._openGLRenderWindow,t.size,Fd.Filter.NEAREST,Fd.Wrap.CLAMP_TO_EDGE):null,t.imageVectorTexture=t.doVTPass?function(e,t){return Xg(e,t,Fd.Filter.LINEAR,Fd.Wrap.CLAMP_TO_EDGE)}(t._openGLRenderWindow,t.size):null,t.pingTextures[0]=t.licTexture0,t.pingTextures[1]=t.seedTexture0,t.pongTextures[0]=t.licTexture1,t.pongTextures[1]=t.seedTexture1,t.textures[0]=t.pingTextures,t.textures[1]=t.pongTextures,e.swap=()=>{t.readIndex=1-t.readIndex},e.renderQuad=(e,n)=>{const r=t.quad,o=t.context;let a=t.quadVAO;a||(a=md.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.quadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.getLastLICBuffer=()=>0===t.readIndex?t.licTexture0:t.licTexture1,e.getLastSeedBuffer=()=>0===t.readIndex?t.seedTexture0:t.seedTexture1,e.getLICBuffer=()=>1-t.readIndex==0?t.licTexture0:t.licTexture1,e.getSeedBuffer=()=>1-t.readIndex==0?t.seedTexture0:t.seedTexture1,e.getLICTextureUnit=()=>{const e=t.textures[t.readIndex][0];return e.activate(),e.getTextureUnit()},e.getSeedTextureUnit=()=>{const e=t.textures[t.readIndex][1];return e.activate(),e.getTextureUnit()},e.getNoiseTextureUnit=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 0===e?(t.noiseTexture.activate(),t.noiseTexture.getTextureUnit()):(t.eeTexture.activate(),t.eeTexture.getTextureUnit())},e.getVectorTextureUnit=()=>(t.vectorTexture.activate(),t.vectorTexture.getTextureUnit()),e.getImageVectorTextureUnit=()=>t.imageVectorTexture?(t.imageVectorTexture.activate(),t.imageVectorTexture.getTextureUnit()):e.getVectorTextureUnit(),e.getMaskVectorTextureUnit=()=>t.maskVectorTexture?(t.maskVectorTexture.activate(),t.maskVectorTexture.getTextureUnit()):e.getImageVectorTextureUnit(),e.clearBuffers=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),n.setColorBuffer(t.licTexture0,0),n.setColorBuffer(t.seedTexture0,1),n.setColorBuffer(t.licTexture1,2),n.setColorBuffer(t.seedTexture1,3);const o=[r.COLOR_ATTACHMENT0,r.COLOR_ATTACHMENT1,r.COLOR_ATTACHMENT2,r.COLOR_ATTACHMENT3];e&&(n.removeColorBuffer(4),n.setColorBuffer(t.eeTexture,4),o.push(r.COLOR_ATTACHMENT4)),r.drawBuffers(o),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeColorBuffer(3),e&&n.removeColorBuffer(4),r.drawBuffers([r.NONE])},e.clearBuffer=e=>{const n=t.framebuffer,r=t.context;n.removeColorBuffer(0),n.setColorBuffer(e,0),r.drawBuffers([r.COLOR_ATTACHMENT0]),r.clearColor(0,1,0,0),r.disable(r.SCISSOR_TEST),r.disable(r.BLEND),r.clear(r.COLOR_BUFFER_BIT),n.removeColorBuffer(e,0),r.drawBuffers([r.NONE])},e.activateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.activate():t.vectorTexture.activate(),t.maskVectorTexture&&t.maskVectorTexture.activate()},e.deactivateVectorTextures=()=>{t.imageVectorTexture?t.imageVectorTexture.deactivate():t.vectorTexture.deactivate(),t.maskVectorTexture&&t.maskVectorTexture.deactivate()},e.activateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.activate();break;case 1:t.eeTexture.activate();break;default:console.error("Wrong LIC pass number")}},e.deactivateNoiseTexture=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch(e){case 0:t.noiseTexture.deactivate();break;case 1:t.eeTexture.deactivate();break;default:console.error("Wrong LIC pass number")}},e.attachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.textures[1-t.readIndex],r=t.framebuffer,o=t.context;e[0].activate(),e[1].activate(),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(n[0],0),r.setColorBuffer(n[1],1),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1])},e.detachLICBuffers=()=>{const e=t.textures[t.readIndex],n=t.context,r=t.framebuffer;e[0].deactivate(),e[1].deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE])},e.attachImageVectorBuffer=()=>{const e=t.framebuffer,n=t.context;t.vectorTexture.activate(),e.removeColorBuffer(0),e.setColorBuffer(t.imageVectorTexture,0),n.drawBuffers([n.COLOR_ATTACHMENT0])},e.detachImageVectorBuffer=()=>{const e=t.context,n=t.framebuffer;t.vectorTexture.deactivate(),n.removeColorBuffer(0),e.drawBuffers([e.NONE])},e.attachEEBuffer=()=>{t.textures[t.readIndex][0].activate(),t.framebuffer.removeColorBuffer(0),t.framebuffer.setColorBuffer(t.eeTexture,0);const e=t.context;e.drawBuffers([e.COLOR_ATTACHMENT0])},e.detachEEBuffer=()=>{const e=t.context;t.framebuffer.removeColorBuffer(0),e.drawBuffers([e.NONE]),t.textures[t.readIndex][0].deactivate()},e.detachBuffers=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),e.drawBuffers([e.NONE]);const r=t.textures[t.readIndex],o=t.textures[1-t.readIndex];r[0]&&r[0].deactivate(),r[1]&&r[1].deactivate(),o[0]&&o[0].deactivate(),o[1]&&o[1].deactivate(),t.eeTexture&&t.eeTexture.deactivate(),t.noiseTexture&&t.noiseTexture.deactivate()},e.getWriteIndex=()=>1-t.readIndex,e.detachBuffers()):console.error("Pass renderwindow to ping pong manager")}const Qg={vectorTexture:null,maskVectorTexture:null,noiseTexture:null,doEEPass:!1,doVTPass:!1,readIndex:0,quad:null,lastProgramHash:null,framebuffer:null,size:null,pingTextures:[],pongTextures:[],textures:[]};function Jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),jt.obj(e,t),jt.get(e,t,["readIndex"]),jt.setGet(e,t,["doEEPass","doVTPass","_openGLRenderWindow","vectorTexture","maskVectorTexture","noiseTexture","framebuffer","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),Zg(e,t)}var em={newInstance:jt.newInstance(Jg,"vtkLICPingPongBufferManager"),extend:Jg};const tm=0,nm=1,rm=2,om=3,am=1;function im(e,t){function n(e,t){e.setUniformi("texLIC",t.getLICTextureUnit()),e.setUniformi("texSeedPts",t.getSeedTextureUnit())}function r(e,t,n){e.attachLICBuffers(),e.renderQuad(t,n),e.detachLICBuffers(),e.swap()}t.classHierarchy.push("vtkLineIntegralConvolution2D"),e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray($g,e,""),e.dumpTextureValues=function(e,n){let[r,o]=n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4;const l=$p.newInstance(),c=a;let u=null;return l.setOpenGLRenderWindow(i),l.saveCurrentBindingsAndBuffers(),l.create(r,o),l.populateFramebuffer(),l.setColorBuffer(e),u=new Float32Array(r*o*s),c.readPixels(0,0,r,o,4===s?c.RGBA:c.RGB,c.FLOAT,u),l.restorePreviousBindingsAndBuffers(),u},e.getTextureMinMax=function(n,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.context,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t._openGLRenderWindow;const i=e.dumpTextureValues(n,r,o,a,4);let s=Number.MAX_VALUE,l=Number.MIN_VALUE;for(let e=0;el&&(l=t)}return{min:s,max:l}},e.getComponentSelectionProgram=e=>{const t="xyzw";return`.${t[e[0]]}${t[e[1]]}`},e.buildShaders=()=>{t.LIC0ShaderProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LIC0.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n/**\nThis shader initializes the convolution for the LIC computation.\n*/\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texMaskVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\n\nuniform int uStepNo; // in step 0 initialize lic and seeds, else just seeds\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uMaskThreshold; // if |V| < uMaskThreshold render transparent\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the *whole* domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value. this\n// depends on the pass number.\nvec2 getNoiseTC(vec2 vectc)\n{\n // in pass 1 : convert from vector tc to noise tc\n // in pass 2 : use vector tc\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(vectc);\n }\n else\n {\n return vectc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the\n// need to convert to noise texture coordinates.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\nvoid main(void)\n{\n vec2 vectc = tcoordVC.st;\n\n // lic => (convolution, mask, 0, step count)\n if (uStepNo == 0)\n {\n float maskCriteria = length(texture2D(texMaskVectors, vectc).xyz);\n float maskFlag;\n if (maskCriteria <= uMaskThreshold)\n {\n maskFlag = 1.0;\n }\n else\n {\n maskFlag = 0.0;\n }\n float noise = getNoise(vectc);\n LICOutput = vec4(noise, maskFlag, 0.0, 1.0);\n }\n else\n {\n LICOutput = texture2D(texLIC, vectc);\n }\n\n // initial seed\n SeedOutput = vec4(vectc, 0.0, 1.0);\n}\n");const n=dd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_VT.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// move vector field to normalized image space\n// pre-processing for vtkLineIntegralConvolution2D\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Fragment shader used by the gaussian blur filter render pass.\n\nuniform sampler2D texVectors; // input texture\nuniform vec2 uTexSize; // size of texture\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n //VTK::LICComponentSelection::Impl\n V = V/uTexSize;\n gl_FragData[0] = vec4(V, 0.0, 1.0);\n}\n","//VTK::LICComponentSelection::Impl",`vec2 V = texture2D(texVectors, tcoordVC.st)${e.getComponentSelectionProgram(t.componentIds)};`).result;t.VTProgram=e.buildAShader(n);const r=dd.substitute("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs1.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texVectors;\nuniform sampler2D texNoise;\nuniform sampler2D texLIC;\nuniform sampler2D texSeedPts;\n\nuniform int uPassNo; // in pass 1 hpf of pass 0 is convolved.\nuniform float uStepSize; // step size in parametric space\n\nuniform vec2 uNoiseBoundsPt1; // tc of upper right pt of noise texture\n\nin vec2 tcoordVC;\n\n//VTK::LICVectorLookup::Impl\n\n// We need to do this manually since CLAMP_TO_BORDER and and borderColor\n// are very poorly supported in webgl\nvec2 clampToBorder(vec2 uv){\n if(uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)\n {\n return vec2(0.0, 0.0);\n }\n return getVector(uv);\n}\n\n// convert from vector coordinate space to noise coordinate space.\n// the noise texture is tiled across the whole domain\nvec2 VectorTCToNoiseTC(vec2 vectc)\n{\n return vectc/uNoiseBoundsPt1;\n}\n\n// get the texture coordidnate to lookup noise value.\n// in pass 1 repeatedly tile the noise texture across\n// the computational domain.\nvec2 getNoiseTC(vec2 tc)\n{\n if (uPassNo == 0)\n {\n return VectorTCToNoiseTC(tc);\n }\n else\n {\n return tc;\n }\n}\n\n// look up noise value at the given location. The location\n// is supplied in vector texture coordinates, hence the need\n// to convert to either noise or lic texture coordinates in\n// pass 1 and 2 respectively.\nfloat getNoise(vec2 vectc)\n{\n return texture2D(texNoise, getNoiseTC(vectc)).r;\n}\n\n// fourth-order Runge-Kutta streamline integration\n// no bounds checks are made, therefore it's essential\n// to have the entire texture initialized to 0\n// and set clamp to border and have border color 0\n// an integer is set if the step was taken, keeping\n// an accurate step count is necessary to prevent\n// boundary artifacts. Don't count the step if\n// all vector lookups are identically 0. This is\n// a proxy for \"stepped outside valid domain\"\nvec2 rk4(vec2 pt0, float dt, out bool count)\n{\n count=true;\n float dtHalf = dt * 0.5;\n vec2 pt1;\n\n vec2 v0 = clampToBorder(pt0);\n pt1 = pt0 + v0 * dtHalf;\n\n vec2 v1 = clampToBorder(pt1);\n pt1 = pt0 + v1 * dtHalf;\n\n vec2 v2 = clampToBorder(pt1);\n pt1 = pt0 + v2 * dt;\n\n vec2 v3 = clampToBorder(pt1);\n vec2 vSum = v0 + v1 + v1 + v2 + v2 + v3;\n\n if (vSum == vec2(0.0, 0.0))\n {\n count = false;\n }\n\n pt1 = pt0 + (vSum) * (dt * (1.0/6.0));\n\n return pt1;\n}\n\nvoid main(void)\n{\n vec2 lictc = tcoordVC.st;\n vec4 lic = texture2D(texLIC, lictc);\n vec2 pt0 = texture2D(texSeedPts, lictc).st;\n\n bool count;\n vec2 pt1 = rk4(pt0, uStepSize, count);\n\n if (count)\n {\n // accumulate lic step\n // (lic, mask, 0, step count)\n float noise = getNoise(pt1);\n LICOutput = vec4(lic.r + noise, lic.g, 0.0, lic.a + 1.0);\n SeedOutput = vec4(pt1, 0.0, 1.0);\n }\n else\n {\n // keep existing values\n LICOutput = lic;\n SeedOutput = vec4(pt0, 0.0, 1.0);\n }\n}\n","//VTK::LICVectorLookup::Impl",function(){const e="\n vec2 getVector( vec2 vectc )\n\n {\n\n vec2 V = texture2D( texVectors, vectc ).xy;\n\n // normalize if |V| not 0\n\n float lenV = length( V );\n\n if ( lenV > 1.0e-8 )\n\n {\n\n return V/lenV;\n\n }\n\n else\n\n {\n\n return vec2( 0.0, 0.0 );\n\n }\n\n }\n\n ",t="\n vec2 getVector( vec2 vectc )\n\n {\n\n return texture2D( texVectors, vectc ).xy;\n\n }\n\n ";return arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?t:e}(t.normalizeVectors),!0).result;t.LICIShaderProgram=e.buildAShader(r),t.LICNShaderProgram=e.buildAShader(" //VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_LICN.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n/**\nThis shader finalizes the convolution for the LIC computation\napplying the normalization. eg. if box kernel is used the this\nis the number of steps taken.\n*/\n\nuniform sampler2D texLIC;\n\nin vec2 tcoordVC;\n\nvoid main(void)\n{\n vec4 conv = texture2D(texLIC, tcoordVC.st);\n conv.r = conv.r/conv.a;\n // lic => (convolution, mask, 0, 1)\n LICOutput = vec4(conv.rg , 0.0, 1.0);\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.CEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// gray scale contrast enhance stage implemented via histogram stretching\n// if the min and max are tweaked it can generate out-of-range values\n// these will be clamped in 0 to 1\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uMin; // min gray scale color value\nuniform float uMaxMinDiff; // max-min\n\nin vec2 tcoordVC;\n\nvoid main( void )\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g!=0.0)\n {\n LICOutput = lic;\n }\n else\n {\n float CElic = clamp((lic.r - uMin)/uMaxMinDiff, 0.0, 1.0);\n LICOutput = vec4(CElic, lic.gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.EEProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// high-pass filter stage employed by vtkLineIntegralConvolution2D\n// between LIC pass 1 and LIC pass 2. filtered LIC pass 1, becomes\n// noise for pass2.\n\n// the output of this shader\nlayout(location = 0) out vec4 EEOutput;\n\nuniform sampler2D texLIC; // most recent lic pass\nuniform float uDx; // fragment size\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n// kernel for simple laplace edge enhancement.\n// p=Laplace(p)+p\nfloat K[9] = float[9](\n -1.0, -1.0, -1.0,\n -1.0, 9.0, -1.0,\n -1.0, -1.0, -1.0\n );\n\n// determine if the fragment was masked\nbool Masked(float val) { return val != 0.0; }\n\nvoid main(void)\n{\n // tex coord neighbor offsets\n vec2 fragDx[9] = vec2[9](\n vec2(-uDx, uDy), vec2(0.0, uDy), vec2(uDx, uDy),\n vec2(-uDx, 0.0), vec2(0.0, 0.0), vec2(uDx, 0.0),\n vec2(-uDx,-uDy), vec2(0.0,-uDy), vec2(uDx,-uDy)\n );\n\n vec2 lictc = tcoordVC.st;\n\n // compute the convolution but don't use convovled values if\n // any masked fragments on the stencil. Fragments outside\n // the valid domain are masked during initialization, and\n // texture wrap parameters are clamp to border with border\n // color that contains masked flag\n float conv = 0.0;\n bool dontUse = false;\n for (int i=0; i<9; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n vec4 lic = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic.g);\n conv = conv + K[i] * lic.r;\n }\n\n if (dontUse)\n {\n EEOutput = vec4(texture2D(texLIC, lictc).rg, 0.0, 1.0);\n }\n else\n {\n conv = clamp(conv, 0.0, 1.0);\n EEOutput = vec4(conv,texture2D(texLIC, lictc).g, 0.0, 1.0);\n }\n\n}\n"),t.AAHProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAH.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// horizontal pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDx; // fragment size\n\nin vec2 tcoordVC;\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDx[3] = vec2[3](vec2(-uDx,0.0), vec2(0.0,0.0), vec2(uDx,0.0));\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDx[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n"),t.AAVProgram=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkLineIntegralConvolution2D_AAV.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// Anti-alias stage in vtkLineIntegralConvolution2D\n// vertical pass of a Gaussian convolution\n\n// the output of this shader\nlayout(location = 0) out vec4 LICOutput;\nlayout(location = 1) out vec4 SeedOutput;\n\nuniform sampler2D texLIC; // input texture\nuniform float uDy; // fragment size\n\nin vec2 tcoordVC;\n\n\n// factored 3x3 Gaussian kernel\n// K^T*K = G\nfloat K[3] = float[3](0.141421356, 0.707106781, 0.141421356);\n\n// determine if the fragment was masked\nbool Masked(float val){ return val != 0.0; }\n\nvoid main(void)\n{\n// neighbor offsets\nvec2 fragDy[3] = vec2[3](vec2(0.0,-uDy), vec2(0.0,0.0), vec2(0.0,uDy));\n\n\n vec2 lictc = tcoordVC.st;\n vec4 lic[3];\n bool dontUse = false;\n float conv = 0.0;\n for (int i=0; i<3; ++i)\n {\n vec2 tc = lictc + fragDy[i];\n lic[i] = texture2D(texLIC, tc);\n dontUse = dontUse || Masked(lic[i].g);\n conv = conv + K[i] * lic[i].r;\n }\n // output is (conv, mask, skip, 1)\n if (dontUse)\n {\n LICOutput = vec4(lic[1].rg, 1.0, 1.0);\n }\n else\n {\n LICOutput = vec4(conv, lic[1].gb, 1.0);\n }\n SeedOutput = vec4(0.0, 0.0, 0.0, 0.0);\n}\n")},e.executeLIC=(o,a,i,s,l,c)=>{if(t._openGLRenderWindow=l,t.context=l.getContext(),Object.assign(t,c),o[0]<=0||o[1]<=0)return null;const u=[1/o[0],1/o[1]];let d=t.stepSize*Math.sqrt(u[0]*u[0]+u[1]*u[1]);d<=0&&(d=1e-10);const p=t.context;let f=t.framebuffer;f&&o[0]===f.getSize()[0]&&o[1]===f.getSize()[1]||(f=$p.newInstance(),f.setOpenGLRenderWindow(t._openGLRenderWindow),f.saveCurrentBindingsAndBuffers(),f.create(...o),f.populateFramebuffer(),f.restorePreviousBindingsAndBuffers(),t.framebuffer=f),f.saveCurrentBindingsAndBuffers(),f.bind(),p.viewport(0,0,...o),p.scissor(0,0,...o),t.shadersNeedBuild&&(e.buildShaders(),t.shadersNeedBuild=!1),t.bufs?(t.bufs.setVectorTexture(a),t.bufs.setMaskVectorTexture(i),t.bufs.setNoiseTexture(s)):t.bufs=em.newInstance({openGLRenderWindow:l,doEEPass:t.enhancedLIC,doVTPass:t.transformVectors,vectorTexture:a,maskVectorTexture:i,noiseTexture:s,framebuffer:f,size:o});const g=[(s.getWidth()+1)/o[0],(s.getHeight()+1)/o[1]],m=1/o[0],h=1/o[1],v=t._openGLRenderWindow.getShaderCache();if(t.transformVectors){const e=t.VTProgram;v.readyShaderProgram(e),t.bufs.attachImageVectorBuffer(),e.setUniform2f("uTexSize",...o),e.setUniformi("texVectors",t.bufs.getVectorTextureUnit()),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT),t.bufs.renderQuad(o,e),t.bufs.detachImageVectorBuffer()}t.bufs.clearBuffers(t.enhancedLIC),t.bufs.activateVectorTextures(),t.bufs.activateNoiseTexture(0);const{LIC0ShaderProgram:y}=t;v.readyShaderProgram(y),y.setUniformi("uStepNo",0),y.setUniformi("uPassNo",0),y.setUniformf("uMaskThreshold",t.maskThreshold),y.setUniform2f("uNoiseBoundsPt1",...g),y.setUniformi("texMaskVectors",t.bufs.getMaskVectorTextureUnit()),y.setUniformi("texLIC",t.bufs.getLICTextureUnit()),y.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0)),r(t.bufs,o,y);const{LICIShaderProgram:b}=t;v.readyShaderProgram(b),b.setUniformi("uPassNo",0),b.setUniformf("uStepSize",-d),b.setUniform2f("uNoiseBoundsPt1",...g),b.setUniformi("texVectors",t.bufs.getImageVectorTextureUnit()),b.setUniformi("texNoise",t.bufs.getNoiseTextureUnit(0));for(let e=0;e{const a=t._openGLRenderWindow.getShaderCache();let{min:i,max:s}=e.getTextureMinMax(t.bufs.getLastLICBuffer(),o,t.context,t._openGLRenderWindow);(s<=i||s>1||i<0)&&(console.error("Invalid color range: ",i,s),i=0,s=1);let l=s-i;n&&(i+=l*t.lowLICContrastEnhancementFactor,s-=l*t.highLICContrastEnhancementFactor,l=s-i);const{CEProgram:c}=t;a.readyShaderProgram(c),c.setUniformi("texLIC",t.bufs.getLICTextureUnit()),c.setUniformf("uMin",i),c.setUniformf("uMaxMinDiff",l),r(t.bufs,o,c)}}const sm={shadersNeedBuild:!0,stepSize:1,numberOfSteps:10,enhancedLIC:!0,enhanceContrast:!1,lowContrastEnhancementFactor:0,highContrastEnhancementFactor:0,antiAlias:0,componentIds:[0,1],normalizeVectors:!0,maskThreshold:0,transformVectors:!0,bufs:null,isComposite:!0};function lm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sm,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","nuberOfSteps","stepSize","normalizeVectors","maskThreshold","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","componentIds","isComposite"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),im(e,t)}var cm={newInstance:jt.newInstance(lm,"vtkLineIntegralConvolution2D"),extend:lm};function um(e,t){t.classHierarchy.push("vtkSurfaceLICInterface")}const dm={enableLIC:!1,nuberOfSteps:40,stepSize:.25,transformVectors:!0,normalizeVectors:!0,maskOnSurface:!1,maskThreshold:0,maskColor:[0,0,0],maskIntensity:0,enhancedLIC:!0,enhanceContrast:tm,lowLICContrastEnhancementFactor:0,highLICContrastEnhancementFactor:0,lowColorContrastEnhancementFactor:0,highColorContrastEnhancementFactor:0,antiAlias:0,colorMode:0,LICIntensity:1,mapModeBias:0,noiseTextureSize:200,noiseTextureType:am,noiseGrainSize:8,noiseImpulseProbability:.1,noiseImpulseBackgroundValue:0,noiseGeneratorSeed:0,minNoiseValue:0,maxNoiseValue:1,numberOfNoiseLevels:2,shadersNeedBuilding:!0,reallocateTextures:!0,rebuildNoiseTexture:!1,viewPortScale:1};function pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dm,n),jt.obj(e,t),jt.setGet(e,t,["enableLIC","numberOfSteps","stepSize","normalizeVectors","transformVectors","maskOnSurface","maskThreshold","maskColor","maskIntensity","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor","antiAlias","colorMode","LICIntensity","mapModeBias","noiseTextureSize","noiseTextureType","noiseGrainSize","minNoiseValue","maxNoiseValue","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","noiseGeneratorSeed","viewPortScale","rebuildNoiseTexture"]),um(0,t)}var fm={newInstance:jt.newInstance(pm,"vtkSurfaceLICInterface"),extend:pm};const{Representation:gm}=ds;function mm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICInterface"),e.renderQuad=(e,n)=>{const r=t.licQuad,o=t.context;let a=t.licQuadVAO;a||(a=md.newInstance(),a.setOpenGLRenderWindow(t._openGLRenderWindow),t.licQuadVAO=a),t.previousProgramHash!==n.getMd5Hash()&&(a.shaderProgramChanged(),r.getCABO().bind(),a.addAttributeArray(n,r.getCABO(),"vertexDC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE),a.addAttributeArray(n,r.getCABO(),"tcoordDC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,2,t.context.FALSE),t.previousProgramHash=n.getMd5Hash()),o.drawArrays(o.TRIANGLES,0,r.getCABO().getElementCount()),a.release()},e.generateNoiseTexture=e=>{if(!t.noiseTexture||t.licInterface.getRebuildNoiseTexture()){t.licInterface.setRebuildNoiseTexture(!1),t.noiseTexture&&t.noiseTexture.releaseGraphicsResources(),vo()(t.noiseGeneratorSeed,{global:!0});let n=[];const{noiseTextureType:r,noiseGrainSize:o,numberOfNoiseLevels:a,noiseImpulseProbability:i,noiseImpulseBackgroundValue:s,minNoiseValue:l,maxNoiseValue:c}=t.licInterface.get("noiseTextureType","noiseGrainSize","numberOfNoiseLevels","noiseImpulseProbability","noiseImpulseBackgroundValue","minNoiseValue","maxNoiseValue");n=r===am?function(e,t,n,r,o,a){const i=Math.max(0,Math.min(1,n)),s=Float32Array.from({length:e*e},(()=>{let e=0;if(1===i||Math.random()>1-i)for(let t=0;t<2048;++t)e+=Math.random();return e}));let l=0,c=2049;s.forEach((e=>{c=1===i?e0?e:c,l=e>l?e:l}));let u=l-c;0===u&&(c=0,u=0===l?1:l);const d=t-1,p=0!==d?1/d:0,f=a-o;return s.map((e=>{const n=e=c?1===t?a:o+(i>d?d:i)*p*f:r}))}(Math.floor(e/o),a,i,s,l,c):function(e,t,n,r){let[o,a]=e;const i=r-n;return Float32Array.from({length:o*a},(()=>{let e=Math.random();return e=Math.floor(e*t)/t,e=e*i+n,e>1?1:e<0?0:e}))}([Math.ceil(e/o),Math.ceil(e/o)],a,l,c);const u=1/o,d=Float32Array.from({length:e*e*4},((t,r)=>{const a=r/4;if(r%4==0){const t=Math.floor(a%e*u),r=Math.floor(a/e*u);return n[r*(e/o)+t]}return r%4==1||r%4==3?1:0})),p=Fd.newInstance({wrapS:Fd.Wrap.REPEAT,wrapT:Fd.Wrap.REPEAT,minificationFilter:Fd.Filter.NEAREST,magnificationFilter:Fd.Filter.NEAREST,generateMipMap:!1,openGLDataType:t.context.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});p.setOpenGLRenderWindow(t._openGLRenderWindow),p.create2DFromRaw(e,e,4,"Float32Array",d),p.activate(),p.sendParameters(),p.deactivate(),t.noiseTexture=p}},e.buildAShader=e=>t._openGLRenderWindow.getShaderCache().readyShaderProgramArray($g,e,""),e.allocateTextures=()=>{const n=Fd.Filter.NEAREST,r=Fd.Filter.LINEAR,o=t._openGLRenderWindow;t.geometryImage||(t.geometryImage=e.allocateTexture(o,n)),t.vectorImage||(t.vectorImage=e.allocateTexture(o,r)),t.maskVectorImage||(t.maskVectorImage=e.allocateTexture(o,r)),t.LICImage||(t.LICImage=e.allocateTexture(o,n)),t.RGBColorImage||(t.RGBColorImage=e.allocateTexture(o,n)),t.HSLColorImage||(t.HSLColorImage=e.allocateTexture(o,n)),t.depthTexture||(t.depthTexture=e.allocateDepthTexture(o))},e.allocateTexture=(e,n)=>{const r=t.context,o=Fd.newInstance({wrapS:Fd.Wrap.CLAMP_TO_EDGE,wrapT:Fd.Wrap.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:n,generateMipmap:!1,openGLDataType:r.FLOAT,baseLevel:0,maxLevel:0,autoParameters:!1});return o.setOpenGLRenderWindow(e),o.setInternalFormat(r.RGBA32F),o.create2DFromRaw(...t.size,4,"Float32Array",null),o.activate(),o.sendParameters(),o.deactivate(),o},e.allocateDepthTexture=e=>{const n=t.context,r=Fd.newInstance({generateMipmap:!1,openGLDataType:n.FLOAT,autoParameters:!1});return r.setOpenGLRenderWindow(e),r.createDepthFromRaw(...t.size,"Float32Array",null),r.activate(),r.sendParameters(),r.deactivate(),r},e.createFBO=()=>{if(!t.framebuffer){t.licHelper=null;const e=$p.newInstance();e.setOpenGLRenderWindow(t._openGLRenderWindow),e.saveCurrentBindingsAndBuffers(),e.create(...t.size),e.populateFramebuffer(),t.framebuffer=e,e.restorePreviousBindingsAndBuffers()}},e.completedGeometry=()=>{const e=t.context,n=t.framebuffer;n.removeColorBuffer(0),n.removeColorBuffer(1),n.removeColorBuffer(2),n.removeDepthBuffer(),e.drawBuffers([e.NONE]),n.restorePreviousBindingsAndBuffers()},e.buildAllShaders=()=>{t.shadersNeedBuilding&&(t.licColorPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_fs2.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader combines surface geometry, LIC, and scalar colors.\n\n// the output of this shader\nlayout(location = 0) out vec4 RGBOutput;\nlayout(location = 1) out vec4 HSLOutput;\n\nuniform sampler2D texVectors; // vectors, depth\nuniform sampler2D texGeomColors; // scalar colors + lighting\nuniform sampler2D texLIC; // image lic\nuniform int uScalarColorMode; // select between blend, and map shader\nuniform float uLICIntensity; // blend shader: blending factor for lic'd colors\nuniform float uMapBias; // map shader: adjust the brightness of the result\nuniform float uMaskIntensity; // blending factor for mask color\nuniform vec3 uMaskColor; // color for the masked out fragments\n\nin vec2 tcoordVC;\n\n/**\nConvert from RGB color space into HSL colorspace.\n*/\nvec3 RGBToHSL(vec3 RGB)\n{\n vec3 HSL = vec3(0.0, 0.0, 0.0);\n\n float RGBMin = min(min(RGB.r, RGB.g), RGB.b);\n float RGBMax = max(max(RGB.r, RGB.g), RGB.b);\n float RGBMaxMinDiff = RGBMax - RGBMin;\n\n HSL.z = (RGBMax + RGBMin) / 2.0;\n\n if (RGBMaxMinDiff == 0.0)\n {\n // Gray scale\n HSL.x = 0.0;\n HSL.y = 0.0;\n }\n else\n {\n // Color\n if (HSL.z < 0.5)\n HSL.y = RGBMaxMinDiff / (RGBMax + RGBMin);\n else\n HSL.y = RGBMaxMinDiff / (2.0 - RGBMax - RGBMin);\n\n float dR\n = (((RGBMax - RGB.r) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dG\n = (((RGBMax - RGB.g) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n float dB\n = (((RGBMax - RGB.b) / 6.0) + (RGBMaxMinDiff / 2.0)) / RGBMaxMinDiff;\n\n if (RGB.r == RGBMax)\n HSL.x = dB - dG;\n else\n if (RGB.g == RGBMax)\n HSL.x = (1.0 / 3.0) + dR - dB;\n else\n if (RGB.b == RGBMax)\n HSL.x = (2.0 / 3.0) + dG - dR;\n\n if (HSL.x < 0.0)\n HSL.x += 1.0;\n\n if (HSL.x > 1.0)\n HSL.x -= 1.0;\n }\n\n return HSL;\n}\n\n/**\nHelper for HSL to RGB conversion.\n*/\nfloat Util(float v1, float v2, float vH)\n{\n if (vH < 0.0)\n vH += 1.0;\n\n if (vH > 1.0)\n vH -= 1.0;\n\n if ((6.0 * vH) < 1.0)\n return (v1 + (v2 - v1) * 6.0 * vH);\n\n if ((2.0 * vH) < 1.0)\n return (v2);\n\n if ((3.0 * vH) < 2.0)\n return (v1 + (v2 - v1) * ((2.0 / 3.0) - vH) * 6.0);\n\n return v1;\n}\n\n/**\nConvert from HSL space into RGB space.\n*/\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n if (HSL.y == 0.0)\n {\n // Gray\n RGB.r = HSL.z;\n RGB.g = HSL.z;\n RGB.b = HSL.z;\n }\n else\n {\n // Chromatic\n float v2;\n if (HSL.z < 0.5)\n v2 = HSL.z * (1.0 + HSL.y);\n else\n v2 = (HSL.z + HSL.y) - (HSL.y * HSL.z);\n\n float v1 = 2.0 * HSL.z - v2;\n\n RGB.r = Util(v1, v2, HSL.x + (1.0 / 3.0));\n RGB.g = Util(v1, v2, HSL.x);\n RGB.b = Util(v1, v2, HSL.x - (1.0 / 3.0));\n }\n\n return RGB.rgb;\n}\n\nvoid main()\n{\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n\n // depth is used to determine which fragment belong to us\n // and we can change\n float depth = texture2D(texVectors, tcoordVC.st).a;\n\n vec3 fragColorRGB;\n float valid;\n if (depth > 1.0e-3)\n {\n // we own it\n // shade LIC'ed geometry, or apply mask\n if (lic.g!=0.0)\n {\n // it's masked\n // apply fragment mask\n fragColorRGB = uMaskIntensity * uMaskColor + (1.0 - uMaskIntensity) * geomColor.rgb;\n valid = 0.0;\n }\n else\n {\n if (uScalarColorMode==0)\n {\n // blend with scalars\n fragColorRGB = lic.rrr * uLICIntensity + geomColor.rgb * (1.0 - uLICIntensity);\n }\n else\n {\n // multiply with scalars\n fragColorRGB = geomColor.rgb * clamp((uMapBias + lic.r), 0.0, 1.0);\n }\n if (lic.b != 0.0)\n {\n // didn't have the required guard pixels\n // don't consider it in min max estimation\n // for histpgram stretching\n valid = 0.0;\n }\n else\n {\n // ok to use in min/max estimates for histogram\n // stretching\n valid = 1.0;\n }\n }\n }\n else\n {\n // we don't own it\n // pass through scalars\n fragColorRGB = geomColor.rgb;\n valid = 0.0;\n }\n\n // if no further stages this texture is\n // copied to the screen\n RGBOutput = vec4(fragColorRGB, geomColor.a);\n\n // if further stages, move to hsl space for contrast\n // enhancement. encoding validity saves moving a texture to the cpu\n vec3 fragColorHSL = RGBToHSL(fragColorRGB);\n HSLOutput = vec4(fragColorHSL, valid);\n}\n"),t.licCopyPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_DCpy.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// This shader copies fragments and depths to the output buffer\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texDepth; // z values from vertex shader\nuniform sampler2D texRGBColors; // final rgb LIC colors\n\nin vec2 tcoordVC;\n\nvoid main()\n{\n gl_FragDepth = texture2D(texDepth, tcoordVC).x;\n gl_FragData[0] = texture2D(texRGBColors, tcoordVC);\n\n // since we render a screen aligned quad\n // we're going to be writing fragments\n // not touched by the original geometry\n // it's critical not to modify those\n // fragments.\n if (gl_FragDepth == 1.0)\n {\n discard;\n }\n}\n"),t.enhanceContrastPass=e.buildAShader("//VTK::System::Dec\n\n//=========================================================================\n//\n// Program: Visualization Toolkit\n// Module: vtkSurfaceLICMapper_CE.glsl\n//\n// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n// All rights reserved.\n// See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n//\n// This software is distributed WITHOUT ANY WARRANTY; without even\n// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n// PURPOSE. See the above copyright notice for more information.\n//\n//=========================================================================\n\n// color contrast enhance stage implemented via histogram stretching\n// on lightness channel. if the min and max are tweaked it can generate\n// out-of-range values these will be clamped in 0 to 1\n\n// the output of this shader\n//VTK::Output::Dec\n\nuniform sampler2D texGeomColors; // scalars + lighting\nuniform sampler2D texLIC; // image lic, mask\nuniform sampler2D texHSLColors; // hsla colors\n\nuniform float uLMin; // min lightness over all fragments\nuniform float uLMaxMinDiff; // max - min lightness over all fragments\n\nin vec2 tcoordVC;\n\nvec3 HSLToRGB(vec3 HSL)\n{\n vec3 RGB;\n float v;\n float h = HSL.x;\n float sl = HSL.y;\n float l = HSL.z;\n\n v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);\n if (v <= 0.0) {\n RGB = vec3(0.0,0.0,0.0);\n } else {\n float m;\n int sextant;\n float fract, vsf, mid1, mid2;\n\n m = l + l - v;\n h *= 6.0;\n sextant = int(h);\n fract = h - float(sextant);\n\n vsf = (v - m) * fract;\n mid1 = m + vsf;\n mid2 = v - vsf;\n switch (sextant) {\n case 0: RGB.r = v; RGB.g = mid1; RGB.b = m; break;\n case 1: RGB.r = mid2; RGB.g = v; RGB.b = m; break;\n case 2: RGB.r = m; RGB.g = v; RGB.b = mid1; break;\n case 3: RGB.r = m; RGB.g = mid2; RGB.b = v; break;\n case 4: RGB.r = mid1; RGB.g = m; RGB.b = v; break;\n case 5: RGB.r = v; RGB.g = m; RGB.b = mid2; break;\n }\n }\n return RGB;\n}\n\nvoid main()\n{\n // lookup hsl color , mask\n vec4 fragColor = texture2D(texHSLColors, tcoordVC.st);\n\n // don't modify masked fragments (masked => lic.g==1)\n vec4 lic = texture2D(texLIC, tcoordVC.st);\n if (lic.g==0.0)\n {\n // normalize lightness channel\n fragColor.z = clamp((fragColor.z - uLMin)/uLMaxMinDiff, 0.0, 1.0);\n }\n\n // back into rgb space\n fragColor.rgb = HSLToRGB(fragColor.xyz);\n\n // add alpha\n vec4 geomColor = texture2D(texGeomColors, tcoordVC.st);\n fragColor.a = geomColor.a;\n\n gl_FragData[0] = fragColor;\n}\n"),t.shadersNeedBuilding=!1)},e.initializeResources=()=>{e.createFBO(),e.generateNoiseTexture(t.licInterface.getNoiseTextureSize()),e.allocateTextures(),e.buildAllShaders(),t.licQuad||(t.licQuad=function(e){const t=xd.newInstance();t.setOpenGLRenderWindow(e);const n=new Float32Array(12);for(let e=0;e<4;e++)n[3*e]=e%2*2-1,n[3*e+1]=e>1?1:-1,n[3*e+2]=0;const r=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint16Array(8);o[0]=3,o[1]=0,o[2]=1,o[3]=3,o[4]=3,o[5]=0,o[6]=3,o[7]=2;const a=Es.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=Es.newInstance({numberOfComponents:1,values:o}),s=Es.newInstance({numberOfComponents:2,values:r});return t.getCABO().createVBO(i,"polys",gm.SURFACE,{points:a,cellOffset:0,tcoords:s}),t}(t._openGLRenderWindow)),t.licHelper||(t.licHelper=cm.newInstance())},e.prepareForGeometry=()=>{const e=t.framebuffer;e.saveCurrentBindingsAndBuffers(),e.bind(),t.geometryImage.activate(),t.vectorImage.activate(),t.maskVectorImage.activate(),e.removeColorBuffer(0),e.removeColorBuffer(2),e.removeColorBuffer(3),e.setColorBuffer(t.geometryImage,0),e.setColorBuffer(t.vectorImage,2),e.setColorBuffer(t.maskVectorImage,3),e.setDepthBuffer(t.depthTexture);const n=t.context;n.drawBuffers([n.COLOR_ATTACHMENT0,n.NONE,n.COLOR_ATTACHMENT2,n.COLOR_ATTACHMENT3]),n.viewport(0,0,...t.size),n.scissor(0,0,...t.size),n.disable(n.BLEND),n.disable(n.DEPTH_TEST),n.disable(n.SCISSOR_TEST),n.clearColor(0,0,0,0),n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT)},e.copyToScreen=n=>{t.RGBColorImage.activate(),t.depthTexture.activate(),t.licCopyPass||e.initializeResources();const r=t.licCopyPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(r);const o=t.context;o.viewport(0,0,...n),o.scissor(0,0,...n),o.disable(o.BLEND),o.enable(o.DEPTH_TEST),o.disable(o.SCISSOR_TEST),r.setUniformi("texDepth",t.depthTexture.getTextureUnit()),r.setUniformi("texRGBColors",t.RGBColorImage.getTextureUnit()),e.renderQuad(n,r),t.RGBColorImage.deactivate(),t.depthTexture.deactivate()},e.combineColorsAndLIC=()=>{const n=t.context,r=t.framebuffer;r.saveCurrentBindingsAndBuffers(),r.bind(),r.create(...t.size),r.removeColorBuffer(0),r.removeColorBuffer(1),r.setColorBuffer(t.RGBColorImage,0),r.setColorBuffer(t.HSLColorImage,1),n.drawBuffers([n.COLOR_ATTACHMENT0,n.COLOR_ATTACHMENT1]),n.disable(n.DEPTH_TEST),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),t.vectorImage.activate(),t.geometryImage.activate(),t.LICImage.activate(),t.licColorPass||e.initializeResources();const o=t.licColorPass;t._openGLRenderWindow.getShaderCache().readyShaderProgram(o),o.setUniformi("texVectors",t.vectorImage.getTextureUnit()),o.setUniformi("texGeomColors",t.geometryImage.getTextureUnit());const{colorMode:a,LICIntensity:i,mapModeBias:s,maskIntensity:l,maskColor:c,enhanceContrast:u,lowColorContrastEnhancementFactor:d,highColorContrastEnhancementFactor:p}=t.licInterface.get("colorMode","LICIntensity","mapModeBias","maskIntensity","maskColor","enhanceContrast","lowColorContrastEnhancementFactor","highColorContrastEnhancementFactor");if(o.setUniformi("texLIC",t.LICImage.getTextureUnit()),o.setUniformi("uScalarColorMode",a),o.setUniformf("uLICIntensity",i),o.setUniformf("uMapBias",s),o.setUniformf("uMaskIntensity",l),o.setUniform3f("uMaskColor",...c),e.renderQuad(t.size,o),t.vectorImage.deactivate(),t.geometryImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),r.removeColorBuffer(1),n.drawBuffers([n.NONE]),u===rm||u===om){let o=0,a=1,i=a-o;o+=i*d,a-=i*p,i=a-o,r.setColorBuffer(t.RGBColorImage),n.drawBuffers([n.COLOR_ATTACHMENT0]),t.geometryImage.activate(),t.HSLColorImage.activate(),t.LICImage.activate(),t.enhanceContrastPass||e.initializeResources();const{enhanceContrastPass:s}=t;t._openGLRenderWindow.getShaderCache().readyShaderProgram(s),s.setUniformi("texGeomColors",t.geometryImage.getTextureUnit()),s.setUniformi("texHSLColors",t.HSLColorImage.getTextureUnit()),s.setUniformi("texLIC",t.LICImage.getTextureUnit()),s.setUniformf("uLMin",o),s.setUniformf("uLMaxMinDiff",i),e.renderQuad(t.size,s),t.geometryImage.deactivate(),t.HSLColorImage.deactivate(),t.LICImage.deactivate(),r.removeColorBuffer(0),n.drawBuffers([n.NONE])}r.restorePreviousBindingsAndBuffers()},e.applyLIC=()=>{const e=t.licInterface.get("stepSize","numberOfSteps","enhancedLIC","enhanceContrast","lowLICContrastEnhancementFactor","highLICContrastEnhancementFactor","antiAlias","normalizeVectors","maskThreshold","transformVectors"),n=t.licHelper.executeLIC(t.size,t.vectorImage,t.maskVectorImage,t.noiseTexture,t._openGLRenderWindow,e);if(!n)return console.error("Failed to compute image LIC"),void(t.LICImage=null);t.LICImage=n},e.setSize=n=>{Array.isArray(n)&&2===n.length&&(t.size&&t.size[0]===n[0]&&t.size[1]===n[1]||(t.size=n,e.releaseGraphicsResources()))},e.releaseGraphicsResources=()=>{t.geometryImage&&(t.geometryImage.releaseGraphicsResources(),t.geometryImage=null),t.vectorImage&&(t.vectorImage.releaseGraphicsResources(),t.vectorImage=null),t.maskVectorImage&&(t.maskVectorImage.releaseGraphicsResources(),t.maskVectorImage=null),t.LICImage&&(t.LICImage.releaseGraphicsResources(),t.LICImage=null),t.RGBColorImage&&(t.RGBColorImage.releaseGraphicsResources(),t.RGBColorImage=null),t.HSLColorImage&&(t.HSLColorImage.releaseGraphicsResources(),t.HSLColorImage=null),t.depthTexture&&(t.depthTexture.releaseGraphicsResources(),t.depthTexture=null),t.framebuffer&&(t.framebuffer.releaseGraphicsResources(),t.framebuffer=null)}}const hm={context:null,shadersNeedBuilding:!0,reallocateTextures:!0,size:null,licInterface:null};function vm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hm,n),fm.extend(e,t,n),jt.obj(e,t),jt.setGet(e,t,["context","_openGLRenderWindow","reallocateTextures","licInterface","size"]),jt.moveToProtected(e,t,["openGLRenderWindow"]),mm(e,t)}var ym={newInstance:jt.newInstance(vm,"vtkSurfaceLICInterface"),extend:vm};const{vtkErrorMacro:bm}=Kt;function xm(e,t){t.classHierarchy.push("vtkOpenGLSurfaceLICMapper");const n={...e};e.getNeedToRebuildShaders=(e,r,o)=>t.rebuildLICShaders||n.getNeedToRebuildShaders(e,r,o),e.replaceShaderValues=(e,r,o)=>{const a=t.lastBoundBO.getReferenceByName("lastLightComplexity");let i=e.Vertex,s=e.Fragment;const l=t.renderable.getInputArrayToProcess(0);if(l&&t.canDrawLIC){s=dd.substitute(s,"//VTK::Output::Dec",["//VTK::Output::Dec","layout(location = 2) out vec4 vectorTexture;","layout(location = 3) out vec4 maskVectorTexture;"]).result;const n=`${l.getName()}MC`;0===a&&t.lastBoundBO.set({lastLightComplexity:1},!0),i=dd.substitute(i,"//VTK::TCoord::Dec",[`attribute vec3 ${n};`,"out vec3 licOutput;","//VTK::TCoord::Dec"]).result,i=dd.substitute(i,"//VTK::TCoord::Impl",[`licOutput = ${n};`,"//VTK::TCoord::Impl"]).result,s=dd.substitute(s,"//VTK::TCoord::Dec",["uniform int uMaskOnSurface;","uniform mat3 normalMatrix;","in vec3 licOutput;","//VTK::TCoord::Dec"]).result,s=dd.substitute(s,"//VTK::TCoord::Impl",["// projected vectors"," vec3 tcoordLIC = normalMatrix * licOutput;"," vec3 normN = normalize(normalVCVSOutput);"," float k = dot(tcoordLIC, normN);"," vec3 projected = (tcoordLIC - k*normN);"," vectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);","// vectors for fragment masking"," if (uMaskOnSurface == 0)"," {"," maskVectorTexture = vec4(licOutput, 1.0);"," }"," else"," {"," maskVectorTexture = vec4(projected.x, projected.y, 0.0 , 1.0);"," }","//VTK::TCoord::Impl"],!1).result,e.Vertex=i}t.rebuildLICShaders=!1,e.Fragment=s,n.replaceShaderValues(e,r,o),a>0&&t.lastBoundBO.set({lastLightComplexity:a},!0)},e.setMapperShaderParameters=(e,r,o)=>{n.setMapperShaderParameters(e,r,o),t.canDrawLIC&&e.getProgram().setUniformi("uMaskOnSurface",t.maskOnSurface)},e.getNeedToRebuildBufferObjects=(e,r)=>t.rebuildLICBuffers||n.getNeedToRebuildBufferObjects(e,r),e.buildBufferObjects=(e,r)=>{if(t.canDrawLIC){const e=t.renderable.getInputArrayToProcess(0);e&&e.getNumberOfComponents()>1&&t.renderable.setCustomShaderAttributes([e.getName()])}t.rebuildLICBuffers=!1,n.buildBufferObjects(e,r)},e.pushState=e=>{t.stateCache={[e.BLEND]:e.isEnabled(e.BLEND),[e.DEPTH_TEST]:e.isEnabled(e.DEPTH_TEST),[e.SCISSOR_TEST]:e.isEnabled(e.SCISSOR_TEST),[e.CULL_FACE]:e.isEnabled(e.CULL_FACE)}},e.popState=e=>{const n=n=>t.stateCache[n]?e.enable(n):e.disable(n);n(e.BLEND),n(e.DEPTH_TEST),n(e.SCISSOR_TEST),n(e.CULL_FACE)},e.renderPiece=(r,o)=>{let a=!0;t._openGLRenderWindow.getWebgl2()||(bm("SurfaceLICMapper Requires WebGL 2"),a=!1),t.context.getExtension("EXT_color_buffer_float")&&t.context.getExtension("OES_texture_float_linear")||(bm("SurfaceLICMapper requires the EXT_color_buffer_float and OES_texture_float_linear WebGL2 extensions."),a=!1),t.currentInput=t.renderable.getInputData(),t.currentInput||(bm("No input"),a=!1);let i=t.renderable.getLicInterface();i||(i=fm.newInstance(),t.renderable.setLicInterface(i)),t.openGLLicInterface||(t.openGLLicInterface=ym.newInstance()),i!==t.openGLLicInterface.getLicInterface()&&t.openGLLicInterface.setLicInterface(i);const s=t.renderable.getInputArrayToProcess(0);if(i.getEnableLIC()&&(!s||s.getNumberOfComponents()<2)&&(bm("No vector input array"),a=!1),i.getEnableLIC()||(a=!1),t.canDrawLIC!==a&&(t.rebuildLICShaders=!0,t.rebuildLICBuffers=!0),t.canDrawLIC=a,!a||!i.getEnableLIC())return void n.renderPiece(r,o);const l=t.context,c=o.getProperty().getBackfaceCulling(),u=o.getProperty().getFrontfaceCulling();c||u?u?(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.FRONT)):(t._openGLRenderWindow.enableCullFace(),l.cullFace(l.BACK)):t._openGLRenderWindow.disableCullFace();const d=t._openGLRenderWindow.getSize(),p=d.map((e=>Math.round(e*i.getViewPortScale())));t.openGLLicInterface.setSize(p),t.openGLLicInterface.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLLicInterface.setContext(t.context),e.pushState(t.context),t.openGLLicInterface.initializeResources(),t.openGLLicInterface.prepareForGeometry(),e.popState(t.context),n.renderPieceStart(r,o),n.renderPieceDraw(r,o),n.renderPieceFinish(r,o),e.pushState(t.context),t.VBOBuildTime.modified(),t.openGLLicInterface.completedGeometry(),t.context.disable(t.context.CULL_FACE),t.openGLLicInterface.applyLIC(),t.openGLLicInterface.combineColorsAndLIC(),t.openGLLicInterface.copyToScreen(d),e.popState(t.context)}}const Tm={canDrawLIC:!1,rebuildLICShaders:!1,rebuildLICBuffers:!1,openGLLicInterface:null};const Cm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tm,n),op.extend(e,t,n),xm(e,t),Pt(e,t,["openGLLicInterface"])}),"vtkOpenGLSurfaceLICMapper");rn("vtkSurfaceLICMapper",Cm);const{vtkErrorMacro:Sm}=Kt;function Pm(e,t){t.classHierarchy.push("vtkOpenGLSphereMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,i=dd.substitute(i,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=dd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=dd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{if(e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)||Sm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),e.getProgram().isUniformUsed("scaleFactor")){const n=t.currentInput.getPointData();null!=t.renderable.getScaleArray()&&n.hasArray(t.renderable.getScaleArray())?e.getProgram().setUniformf("scaleFactor",t.renderable.getScaleFactor()):e.getProgram().setUniformf("scaleFactor",1)}n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),o.isUniformUsed("MCVCMatrix"))if(r.getIsIdentity())o.setUniformMatrix("MCVCMatrix",i.wcvc);else{const e=t.openGLActor.getKeyMatrices(),n=new Float64Array(16);b(n,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",n)}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(u=i.getArray(t.renderable.getScaleArray()).getData());let d=null,p=0,f=null;o?(p=o.getNumberOfComponents(),a.setColorOffset(0),a.setColorBOStride(4),d=o.getData(),f=new Uint8Array(3*l*4),a.getColorBO()||a.setColorBO(Yu.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow)):a.getColorBO()&&a.setColorBO(null),a.setColorComponents(p);const g=new Float32Array(5*l*3);a.setStride(20);const m=Math.cos(Mo(30));let h=0,v=0,y=0,b=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Am,n),op.extend(e,t,n),Pm(e,t)}),"vtkOpenGLSphereMapper");rn("vtkSphereMapper",Im);const{vtkErrorMacro:wm}=Kt;function Om(e,t){t.classHierarchy.push("vtkOpenGLStickMapper");const n={...e};e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkStickMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Sticks\n\nattribute vec4 vertexMC;\nattribute vec3 orientMC;\nattribute vec4 offsetMC;\nattribute float radiusMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n//VTK::Picking::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying float lengthVCVSOutput;\nvarying vec3 centerVCVSOutput;\nvarying vec3 orientVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Picking::Impl\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = radiusMC;\n lengthVCVSOutput = length(orientMC);\n orientVCVSOutput = normalMatrix * normalize(orientMC);\n\n // make sure it is pointing out of the screen\n if (orientVCVSOutput.z < 0.0)\n {\n orientVCVSOutput = -orientVCVSOutput;\n }\n\n // make the basis\n vec3 xbase;\n vec3 ybase;\n vec3 dir = vec3(0.0,0.0,1.0);\n if (cameraParallel == 0)\n {\n dir = normalize(-vertexVCVSOutput.xyz);\n }\n if (abs(dot(dir,orientVCVSOutput)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),orientVCVSOutput));\n ybase = cross(xbase,orientVCVSOutput);\n }\n else\n {\n xbase = normalize(cross(orientVCVSOutput,dir));\n ybase = cross(orientVCVSOutput,xbase);\n }\n\n vec3 offsets = offsetMC.xyz*2.0-1.0;\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz +\n radiusVCVSOutput*offsets.x*xbase +\n radiusVCVSOutput*offsets.y*ybase +\n 0.5*lengthVCVSOutput*offsets.z*orientVCVSOutput;\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n",e.Fragment=Gd,e.Geometry=""},e.replaceShaderValues=(e,r,o)=>{let a=e.Vertex,i=e.Fragment;a=dd.substitute(a,"//VTK::Camera::Dec",["uniform mat4 VCPCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,i=dd.substitute(i,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,i=dd.substitute(i,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,i=dd.substitute(i,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCPCMatrix;\n"]).result;let s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t._openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),i=dd.substitute(i,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCPCMatrix * vertexVC;\n",s]).result,i=dd.substitute(i,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(i=dd.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i,n.replaceShaderValues(e,r,o)},e.setMapperShaderParameters=(e,r,o)=>{e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)||wm("Error setting 'orientMC' in shader VAO.")),e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)||wm("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isAttributeUsed("radiusMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)||wm("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(e,r,o)},e.setCameraShaderParameters=(e,n,r)=>{const o=e.getProgram(),a=n.getActiveCamera(),i=t.openGLCamera.getKeyMatrices(n);if(o.isUniformUsed("VCPCMatrix")&&o.setUniformMatrix("VCPCMatrix",i.vcpc),r.getIsIdentity())o.isUniformUsed("MCVCMatrix")&&o.setUniformMatrix("MCVCMatrix",i.wcvc),o.isUniformUsed("normalMatrix")&&o.setUniformMatrix3x3("normalMatrix",i.normalMatrix);else{const e=t.openGLActor.getKeyMatrices();if(o.isUniformUsed("MCVCMatrix")){const t=new Float64Array(16);b(t,i.wcvc,e.mcwc),o.setUniformMatrix("MCVCMatrix",t)}if(o.isUniformUsed("normalMatrix")){const t=new Float64Array(9);ve(t,i.normalMatrix,e.normalMatrix),o.setUniformMatrix3x3("normalMatrix",t)}}o.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",a.getParallelProjection())},e.getOpenGLMode=(e,n)=>t.context.TRIANGLES,e.buildBufferObjects=(e,n)=>{const r=t.currentInput;if(null===r)return;t.renderable.mapScalars(r,1);const o=t.renderable.getColorMapColors(),a=t.primitives[t.primTypes.Tris].getCABO(),i=r.getPointData(),s=r.getPoints(),l=s.getNumberOfPoints(),c=s.getData();let u=3;u+=4;let d=null,p=0;a.setColorBOStride(4),a.getColorBO()||a.setColorBO(Yu.newInstance()),a.getColorBO().setOpenGLRenderWindow(t._openGLRenderWindow),o&&(p=o.getNumberOfComponents(),a.setColorOffset(4),d=o.getData(),a.setColorBOStride(8)),a.setColorComponents(p),a.setStride(28);const f=new Float32Array(7*l*12),g=new Uint8Array(12*l*(d?8:4));let m=null,h=null;null!=t.renderable.getScaleArray()&&i.hasArray(t.renderable.getScaleArray())&&(m=i.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&i.hasArray(t.renderable.getOrientationArray())?h=i.getArray(t.renderable.getOrientationArray()).getData():wm(["Error setting orientationArray.\n","You have to specify the stick orientation"]);const v=[0,1,3,0,3,2,2,3,5,2,5,4];let y=0,b=0,x=0,T=0;for(let e=0;e=4?255:0,g[T++]=v[t]>=2?255:0,g[T++]=255,b=e*p,d&&(g[T++]=d[b],g[T++]=d[b+1],g[T++]=d[b+2],g[T++]=d[b+3])}a.setElementCount(x/7),a.upload(f,Hu.ARRAY_BUFFER),a.getColorBO().upload(g,Hu.ARRAY_BUFFER),t.VBOBuildTime.modified()}}const Mm={};const Rm=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mm,n),op.extend(e,t,n),Om(e,t)}),"vtkOpenGLStickMapper");rn("vtkStickMapper",Rm);const Vm=Object.create(null);function Em(e,t){Vm[e]=t}function Dm(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const Lm={};function Bm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lm,n),t.overrides=Vm,tn.extend(e,t,n),Dm(0,t)}var Nm={newInstance:jt.newInstance(Bm,"vtkWebGPUViewNodeFactory"),extend:Bm};function km(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(g(e),t.renderable.getParallelProjection()){const a=t.renderable.getParallelScale(),i=a*n,s=a,l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(c-l),f=1/(d-u);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(c+l)*p,e[13]=(d+u)*f,e[14]=r[1]/(r[1]-r[0])}else{const a=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let i,s;!0===t.renderable.getUseHorizontalViewAngle()?(i=r[0]*a,s=r[0]*a/n):(i=r[0]*a*n,s=r[0]*a);const l=(o[0]-1)*i,c=(o[0]+1)*i,u=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(c-l),e[5]=2*r[0]/(d-u),e[12]=(l+c)/(c-l),e[13]=(u+d)/(d-u),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();d(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();x(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const a=n.getAspectRatio(),i=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,a,i,t.renderable.getWindowCenterByReference()),b(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),h(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Fm={keyMatrixTime:null,keyMatrices:null};const _m=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fm,n),Zt.extend(e,t,n),t.keyMatrixTime={},jt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},jt.setGet(e,t,["keyMatrixTime"]),km(e,t)}));function Gm(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Um,n),jt.obj(e,t),t.bindables=[],t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),jt.setGet(e,t,["label","device","arrayInformation"]),Gm(e,t)}var Wm={newInstance:jt.newInstance(zm),extend:zm};function Hm(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const jm={device:null,handle:null};function Km(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),jt.obj(e,t),jt.get(e,t,["lastCameraMTime"]),jt.setGet(e,t,["device","handle"]),Hm(e,t)}var $m={newInstance:jt.newInstance(Km,"vtkWebGPUShaderModule"),extend:Km};function qm(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xm,n),t._shaderModules=new Map,jt.obj(e,t),jt.setGet(e,t,["device","window"]),qm(e,t)}var Zm={newInstance:jt.newInstance(Ym,"vtkWebGPUShaderCache"),extend:Ym,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let a=!1;-1!==e.search(t)&&(a=!0);let i="";r&&(i="g");const s=new RegExp(t,i),l=e.replace(s,o);return{replace:a,result:l}}};function Qm(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Jm={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function eh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jm,n),yt(e,t),t.layouts=[],t.shaderDescriptions=[],xt(e,t,["handle","pipelineDescription"]),Pt(e,t,["device","renderEncoder","topology","vertexState"]),Qm(e,t)}var th={newInstance:Et(eh,"vtkWebGPUPipeline"),extend:eh};function nh(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Zm.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Zm.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const rh={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function oh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rh,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],jt.obj(e,t),jt.setGet(e,t,["type","hash","code"]),jt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),nh(e,t)}var ah={newInstance:jt.newInstance(oh,"vtkWebGPUShaderDescription"),extend:oh};const ih={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var sh=function(e){return!e||e.length<6?0:e in ih==1?ih[e]:(et(`unknown format ${e}`),null)},lh=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(et(`unknown format ${e}`),0):t*(5-r/2)},ch=function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},uh=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void et(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;et(`unknown format ${e}`)},dh=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void et(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},ph=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},fh=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void et(`unknown format ${e}`)};function gh(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${i}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const hh={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function vh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),yt(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],Pt(e,t,["created","device","handle","indexBuffer"]),mh(e,t)}var yh={newInstance:Et(vh,"vtkWebGPUVertexInput"),extend:vh};const bh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",xh="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function Th(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const a=ah.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),i=ah.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(a),s.push(i);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,c=new RegExp("//VTK::[^:]*::","g"),u=l.match(c).filter(((e,t,n)=>n.indexOf(e)===t)),d=u.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=Zm.substitute(i,"//VTK::Renderer::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");i=s.getCode(),i=Zm.substitute(i,"//VTK::Renderer::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),a=n.getShaderDescription("vertex");let i=a.getCode();i=Zm.substitute(i,"//VTK::Mapper::Dec",[o]).result,a.setCode(i);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),i=s.getCode(),i=Zm.substitute(i,"//VTK::Mapper::Dec",[o]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=th.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const Ch={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Sh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ch,n),Zt.extend(e,t,n),t.textureViews=[],t.vertexInput=yh.newInstance(),t.bindGroup=Wm.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||xh,t.vertexShaderTemplate=t.vertexShaderTemplate||bh,t.shaderReplacements=new Map,jt.get(e,t,["pipeline","vertexInput"]),jt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),Th(e,t)}var Ph={newInstance:jt.newInstance(Sh,"vtkWebGPUSimpleMapper"),extend:Sh};function Ah(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const Ih={};function wh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ih,n),Ph.extend(e,t,n),Ah(e,t)}var Oh={newInstance:jt.newInstance(wh,"vtkWebGPUFullScreenQuad"),extend:wh},Mh={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const Rh=["getMappedRange","mapAsync","unmap"];function Vh(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,a=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=a.getMappedRange(0,o);new Uint8Array(i).set(new Uint8Array(r)),a.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(a,0,t,0,o);const l=s.finish();e.queue.submit([l]),a.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Eh,n),jt.obj(e,t),jt.get(e,t,["handle","sizeInBytes","usage"]),jt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),Vh(e,t)}var Lh={newInstance:jt.newInstance(Dh),extend:Dh,...Mh};const{Representation:Bh}=ds,{PrimitiveTypes:Nh}=Mh;class kh{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let a=0;a2){for(let a=0;a{const n=e.cells,r=e.primitiveType,o=e.representation,a=e.cellOffset,i=n.getData(),s=i.length,l=function(e){switch(e){case Nh.Points:return"points";case Nh.Lines:return"lines";case Nh.Triangles:case Nh.TriangleEdges:return"polys";case Nh.TriangleStripEdges:case Nh.TriangleStrips:return"strips";default:return""}}(r),c=e.numberOfPoints,u={provokedPointIds:new Uint8Array(c),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new kh};let d=null;d=o===Bh.POINTS||r===Nh.Points?jh.anythingToPoints:o===Bh.WIREFRAME||r===Nh.Lines?jh[`${l}ToWireframe`]:jh[`${l}ToSurface`],Uh=Gh;let p=a||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$h,n),Lh.extend(e,t,n),jt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),Kh(e,t)}var Xh={newInstance:jt.newInstance(qh),extend:qh,...Mh};const{BufferUsage:Yh}=Mh,{vtkErrorMacro:Zh}=Kt,{VtkDataTypes:Qh}=Es;function Jh(e,t,n,r,o){const a={},i=e.getFlatSize();if(!i)return a;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const c=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let u,d=0;const p=at(r,i*(n+(c?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?u=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||c?3===n&&c?u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):u=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case Qh.UNSIGNED_CHAR:t="uint8";break;case Qh.FLOAT:t="float32";break;case Qh.UNSIGNED_INT:t="uint32";break;case Qh.INT:t="sint32";break;case Qh.DOUBLE:t="float32";break;case Qh.UNSIGNED_SHORT:t="uint16";break;case Qh.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Zh(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Yh.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=Lh.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const nv={device:null,fullScreenQuadBuffer:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),yt(e,t),Pt(e,t,["device"]),tv(e,t)}var ov={newInstance:Et(rv),extend:rv,...Mh};const{BufferUsage:av}=ov,{vtkErrorMacro:iv}=jt;function sv(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void iv(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=ph(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:fh(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:av.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void iv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType];s[(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const a=t._bufferEntryNames.get(n);if(void 0===a)return void iv(`entry named ${n} not found in UBO`);const i=t.bufferEntries[a];e.createView(i.nativeType);const s=t[i.nativeType],l=(i.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void iv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const lv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function cv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},jt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},jt.get(e,t,["bindGroupTime"]),jt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),sv(e,t)}var uv={newInstance:jt.newInstance(cv,"vtkWebGPUStorageBuffer"),extend:cv};const{BufferUsage:dv}=ov,{vtkErrorMacro:pv}=jt;function fv(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?pv(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:ph(n),offset:-1,nativeType:fh(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:dv.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=jt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void pv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];a.lastValue!==r&&(i[a.offset/i.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),a.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void pv(`entry named ${n} not found in UBO`);const a=t.bufferEntries[o];e.createView(a.nativeType);const i=t[a.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const gv={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function mv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gv,n),jt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},jt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,jt.get(e,t,["binding","bindGroupTime"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),fv(e,t)}var hv={newInstance:jt.newInstance(mv,"vtkWebGPUUniformBuffer"),extend:mv};const{vtkDebugMacro:vv}=Kt,yv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",bv=new Float64Array(16),xv=new Float64Array(16);function Tv(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];On(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),In(r,n,o),kn(o,r,t.stabilizedCenter),Fn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(vv("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(Mo(n[t].getConeAngle())),s[l+2]=Math.cos(Mo(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",i),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var a;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=Oh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(yv);const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=Oh.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(yv);const e=hv.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),m(xv,r.normalMatrix),oe(bv,r.scvc,r.pcsc),oe(bv,xv,bv),t.clearFSQ.getUBO().setArray("FSQMatrix",bv),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],a=t._parent.normalizedDisplayToDisplay(r,o),i=Math.round(a[0]),s=Math.round(a[1]),l=e[2]-n[0],c=e[3]-n[1],u=t._parent.normalizedDisplayToDisplay(l,c);let d=Math.round(u[0])-i,p=Math.round(u[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:i,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const Cv={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const Sv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cv,n),Zt.extend(e,t,n),t.UBO=hv.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=uv.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=Wm.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=g(new Float64Array(16)),t.stabilizedTime={},yt(t.stabilizedTime,{mtime:0}),xt(e,t,["bindGroup","stabilizedTime"]),At(e,t,["stabilizedCenter"]),Pt(e,t,["renderEncoder","selector","suppressClear","UBO"]),Tv(e,t)}),"vtkWebGPURenderer");Em("vtkRenderer",Sv);const{CoordinateSystem:Pv}=Zi;function Av(e,t){t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix();t.bufferShift[0]=n[3],t.bufferShift[1]=n[7],t.bufferShift[2]=n[11];const r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Pv.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Pv.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Iv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const wv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Av(e,t)}));Em("vtkActor",wv);const{CoordinateSystem:Ov}=Zi;function Mv(e,t){t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children[0]&&t.children[0].traverse(n),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;const n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Ov.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),g(t.keyMatrices.bcwc),g(t.keyMatrices.normalMatrix),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Ov.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}const Rv={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Vv=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rv,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],Mv(e,t)}));function Ev(e,t){t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Em("vtkActor2D",Vv);const Dv={};const Lv=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dv,n),Zt.extend(e,t,n),t.CubeAxesActorHelper=Gu.newCubeAxesActorHelper(),Ev(e,t)}),"vtkWebGPUCubeAxesActor");Em("vtkCubeAxesActor",Lv);const{DisplayLocation:Bv}=fp;function Nv(e,t){t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(Bv.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(Bv.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(rs.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(rs.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(rs.POINTS),e.getRepresentationAsString=()=>jt.enumToString(rs,t.representation)}const kv={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:rs.SURFACE,displayLocation:Bv.FOREGROUND};function Fv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),jt.obj(e,t),jt.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation"]),jt.setGetArray(e,t,["color"],3),Nv(e,t)}var _v={newInstance:jt.newInstance(Fv,"vtkProperty2D"),extend:Fv,...fp};const{BufferUsage:Gv,PrimitiveTypes:Uv}=ov,{Representation:zv}=ds,{ScalarMode:Wv}=oc,{CoordinateSystem:Hv}=Zi,{DisplayLocation:jv}=_v,Kv="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",$v='\nstruct PBRData {\n diffuse: vec3,\n specular: vec3,\n}\n\n// Dot product with the max already in it\nfn mdot(a: vec3, b: vec3) -> f32 {\n return max(0.0, dot(a, b));\n}\n// Dot product with a max in it that does not allow for negative values\n// Physically based rendering is accurate as long as normals are accurate,\n// however this is pretty often not the case. In order to prevent negative\n// values from ruining light calculations and creating zones of zero light,\n// this remapping is used, which smoothly clamps the dot product between\n// zero and one while still maintaining a good amount of accuracy.\nfn cdot(a: vec3, b: vec3) -> f32 {\n var d: f32 = max(0.0, dot(a, b));\n d = pow((d + 1) / 2.0, 2.6);\n return d;\n}\n\n// Lambertian diffuse model\nfn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 {\n var pi: f32 = 3.14159265359; \n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5);\n return (base/pi)*NdotL;\n}\n\n// Yasuhiro Fujii improvement on the Oren-Nayar model\n// https://mimosa-pudica.net/improved-oren-nayar.html\n// p is surface color, o is roughness\nfn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 {\n var invpi: f32 = 0.31830988618; // 1/pi\n\n var o2 = o*o;\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better\n\n var NdotV: f32 = mdot(N, V);\n var LdotV: f32 = mdot(L, V);\n\n var s: f32 = LdotV - NdotL*NdotV;\n var t: f32 = mix(1, max(NdotL, NdotV), step(0, s)); // Mix with step is the equivalent of an if statement\n var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13));\n A = invpi*(1 - A);\n var B: f32 = 0.45*(o2 / (o2 + 0.09));\n B = invpi*B;\n\n return p*NdotL*(A + B*(s/t));\n}\n\n// Fresnel portion of BRDF (IOR only, simplified)\nfn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 {\n var NdotV: f32 = mdot(V, N);\n var F0: f32 = (pow((ior - 1.0), 2) + k*k) / (pow((ior + 1.0), 2) + k*k); // This takes into account the roughness, which the other one does not\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Fresnel portion of BRDF (Color ior, better)\nfn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 {\n var NdotV: f32 = mdot(V, N);\n return F0 + (1 - F0) * pow((1-NdotV), 5); \n}\n\n// Normal portion of BRDF\n// https://learnopengl.com/PBR/Theory\n// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2\nfn trGGX(N: vec3, H: vec3, a: f32) -> f32 {\n var pi: f32 = 3.14159265359; \n\n var a2: f32 = a*a;\n var NdotH = mdot(N, H);\n var NdotH2 = NdotH*NdotH;\n \n var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0;\n\n return a2 / max((pi*denom*denom), 0.000001);\n}\n\n// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent\nfn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 {\n var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz;\n\n var ggx1: f32 = trGGX(N + Op*s, H, a);\n var ggx2: f32 = trGGX(N - Op*s, H, a);\n return (0.5 * ggx1 + 0.5 * ggx2);\n}\n\n// Geometry portion of BRDF\nfn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 {\n var NdotX = cdot(N, X);\n return NdotX / max(0.000001, (NdotX*(1-k) + k));\n}\n\nfn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 {\n var ggx1: f32 = min(1, schlickGGX(N, V, k));\n var ggx2: f32 = min(1, schlickGGX(N, L, k));\n return ggx1*ggx2;\n}\n\n// BRDF Combination\nfn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 {\n var num: f32 = D*F*G;\n var denom: f32 = 4*cdot(V, N)*cdot(L, N);\n\n return num / max(denom, 0.000001);\n}\n\n// Different lighting calculations for different light sources\nfn calcDirectionalLight(N: vec3, V: vec3, ior: f32, roughness: f32, metallic: f32, direction: vec3, color: vec3, base: vec3) -> PBRData { \n var L: vec3 = normalize(direction); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); // Fresnel term is replaced with 1 because it is added later\n var incoming: vec3 = color;\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5);\n\n var specular: vec3 = brdf*incoming*angle;\n // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate\n // control property for the diffuse vs specular roughness\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V); \n // Stores the specular and diffuse separately to allow for finer post processing\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// TODO: find some way to reduce the number of arguments going in here\nfn calcPointLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n var incoming: vec3 = color * (1. / (dist*dist));\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights\nfn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, ior: f32, roughness: f32, metallic: f32, position: vec3, direction: vec3, cones: vec2, color: vec3, base: vec3) -> PBRData {\n var L: vec3 = normalize(position - fragPos);\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(position, fragPos);\n\n var alpha = roughness*roughness;\n var k: f32 = alpha*alpha / 2; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1, G, N, V, L); \n \n // Cones.x is the inner phi and cones.y is the outer phi\n var theta: f32 = mdot(normalize(direction), L);\n var epsilon: f32 = cones.x - cones.y;\n var intensity: f32 = (theta - cones.y) / epsilon;\n intensity = clamp(intensity, 0.0, 1.0);\n intensity /= dist*dist;\n\n var incoming: vec3 = color * intensity;\n\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" bewteen light sources\n\n var specular: vec3 = brdf*incoming*angle;\n var diffuse: vec3 = incoming*fujiiOrenNayar(base, roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n \n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// Environment mapping stuff\n// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::TCoord::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n // Temporary ambient, diffuse, and opacity\n var ambientColor: vec4 = mapperUBO.AmbientColor;\n var diffuseColor: vec4 = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n\n // This should be declared somewhere else\n var _diffuseMap: vec4 = vec4(1);\n var _roughnessMap: vec4 = vec4(1);\n var _metallicMap: vec4 = vec4(1);\n var _normalMap: vec4 = vec4(0, 0, 1, 0); // normal map was setting off the normal vector detection in fragment\n var _ambientOcclusionMap: vec4 = vec4(1);\n var _emissionMap: vec4 = vec4(0);\n\n //VTK::Color::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Normal::Impl\n\n var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0);\n\n //VTK::Light::Impl\n\n //VTK::Select::Impl\n\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n\n return output;\n}\n';function qv(e){return e.indexOf("edge")>=0}function Xv(e,t){t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=n=>{n&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==Hv.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.translucentPass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.opaquePass=n=>{n&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.updateUBO=()=>{const n=t.WebGPUActor.getRenderable().getProperty(),r=t.UBO.getSendTime();if(e.getMTime()>r||n.getMTime()>r||t.renderable.getMTime()>r){const e=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",e.bcwc),t.UBO.setArray("BCSCMatrix",e.bcsc),t.UBO.setArray("MCWCNormals",e.normalMatrix),t.is2D){t.UBO.setValue("ZValue",t.WebGPUActor.getRenderable().getProperty().getDisplayLocation()===jv.FOREGROUND?1:0);const e=n.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setValue("SpecularIntensity",0)}else{let e=n.getAmbientColorByReference();t.UBO.setValue("AmbientIntensity",n.getAmbient()),t.UBO.setArray("AmbientColor",[e[0],e[1],e[2],1]),t.UBO.setValue("DiffuseIntensity",n.getDiffuse()),e=n.getDiffuseColorByReference(),t.UBO.setArray("DiffuseColor",[e[0],e[1],e[2],1]),t.UBO.setValue("Roughness",n.getRoughness()),t.UBO.setValue("BaseIOR",n.getBaseIOR()),t.UBO.setValue("Metallic",n.getMetallic()),t.UBO.setValue("NormalStrength",n.getNormalStrength()),t.UBO.setValue("Emission",n.getEmission()),t.UBO.setValue("SpecularIntensity",n.getSpecular()),e=n.getSpecularColorByReference(),t.UBO.setArray("SpecularColor",[e[0],e[1],e[2],1])}const r=n.getEdgeColorByReference?.();r&&t.UBO.setArray("EdgeColor",[r[0],r[1],r[2],1]),t.UBO.setValue("LineWidth",n.getLineWidth()),t.UBO.setValue("Opacity",n.getOpacity()),t.UBO.setValue("PropID",t.WebGPUActor.getPropID());const o=t.WebGPURenderWindow.getDevice();t.UBO.sendIfNeeded(o)}},e.haveWideLines=()=>{const e=t.WebGPUActor.getRenderable(),n=e.getProperty().getRepresentation();return!(e.getProperty().getLineWidth()<=1)&&t.primitiveType!==Uv.Verts&&(t.primitiveType!==Uv.Triangles&&t.primitiveType!==Uv.TriangleStrips||n===zv.WIREFRAME)},e.replaceShaderPosition=(n,r,o)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4","@builtin(position) Position"),a.hasOutput("vertexVC")||a.addOutput("vec4","vertexVC");let i=a.getCode();t.useRendererMatrix?(i=Zm.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(i=Zm.substitute(i,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(i=Zm.substitute(i,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(i=Zm.substitute(i,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(a.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),i=Zm.substitute(i,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),i=Zm.substitute(i,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,a.setCode(i)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,n,r)=>{const o=r.getBuffer("normalMC"),a=t.WebGPUActor.getRenderable();if(o){const e=n.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",o.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",o.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",o.getArrayInformation()[0].interpolation);let t=e.getCode();t=Zm.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);const r=n.getShaderDescription("fragment");t=r.getCode(),t=a.getProperty().getNormalTexture()?Zm.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, mapperUBO.NormalStrength);"," normal = normalize(normal);"]).result:Zm.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,r.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,n,r)=>{if(e.includes("sel"))return;const o=n.getShaderDescription("vertex");o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC");const a=t.WebGPURenderer.getRenderable(),i=n.getShaderDescription("fragment");let s=i.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||qv(e)||t.is2D||e.includes("sel"))s=Zm.substitute(s,"//VTK::Light::Impl",[" var diffuse: vec3 = diffuseColor.rgb;"," var specular: vec3 = mapperUBO.SpecularColor.rgb * mapperUBO.SpecularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, mapperUBO.Opacity);"]).result,i.setCode(s);else{const e=[" var pi: f32 = 3.14159265359;"," var fragPos: vec3 = vec3(input.vertexVC.xyz);"," var V: vec3 = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," var baseColor: vec3 = _diffuseMap.rgb * diffuseColor.rgb;"," var roughness: f32 = max(0.000001, mapperUBO.Roughness * _roughnessMap.r);"," var metallic: f32 = mapperUBO.Metallic * _metallicMap.r;"," var alpha: f32 = roughness*roughness;"," var ior: f32 = mapperUBO.BaseIOR;"," var k: f32 = alpha*alpha / 2;"," var diffuse: vec3 = vec3(0.);"," var specular: vec3 = vec3(0.);"," var emission: vec3 = _emissionMap.rgb * mapperUBO.Emission;"," {"," var i: i32 = 0;"," loop {"," if !(i < rendererUBO.LightCount) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var calculated: PBRData = calcPointLight(normal, V, fragPos, ior, roughness, metallic, pos, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Directional light"," case 1 {"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var calculated: PBRData = calcDirectionalLight(normal, V, ior, roughness, metallic, dir, color, baseColor); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," // Spot Light"," case 2 {"," var color: vec3 = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," var pos: vec3 = (rendererLightSSBO.values[i].LightPos).xyz;"," var dir: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz;"," dir = normalize(dir);"," var cones: vec2 = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," var calculated: PBRData = calcSpotLight(normal, V, fragPos, ior, roughness, metallic, pos, dir, cones, color, baseColor);"," diffuse += max(vec3(0), calculated.diffuse);"," specular += max(vec3(0), calculated.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," var fresnel: f32 = schlickFresnelIOR(V, normal, ior, k); // Fresnel"," fresnel = min(1, fresnel);"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," var fresnelMetallic: vec3 = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," var kS: vec3 = mix(vec3(fresnel), fresnelMetallic, metallic);"," kS = min(vec3(1), kS);"," var kD: vec3 = (1.0 - kS) * (1.0 - metallic);"," var PBR: vec3 = mapperUBO.DiffuseIntensity*kD*diffuse + kS*specular;"," PBR += emission;"," computedColor = vec4(PBR, mapperUBO.Opacity);"];a.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," var diffuseIBLCoords: vec3 = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," var diffuseCoords: vec2 = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," var VreflN: vec3 = normalize(reflect(-V, normal));"," var reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," var specularCoords: vec2 = vecToRectCoord(reflectionIBLCoords);"," var diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," var level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," var specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," var specularIBLContribution: vec3 = specularIBL.rgb*rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution*kS, 0);"," var diffuseIBLContribution: vec3 = diffuseIBL.rgb*rendererUBO.BackgroundDiffuseStrength;"," diffuseIBLContribution *= baseColor * _ambientOcclusionMap.rgb;"," computedColor += vec4(diffuseIBLContribution*kD, 0);"),s=Zm.substitute(s,"//VTK::Light::Impl",e).result,i.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,t,n)=>{if(qv(e)){const e=t.getShaderDescription("fragment");let n=e.getCode();return n=Zm.substitute(n,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,void e.setCode(n)}const r=n.getBuffer("colorVI");if(!r)return;const o=t.getShaderDescription("vertex");o.addOutput("vec4","color",r.getArrayInformation()[0].interpolation);let a=o.getCode();a=Zm.substitute(a,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,o.setCode(a);const i=t.getShaderDescription("fragment");a=i.getCode(),a=Zm.substitute(a,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,i.setCode(a)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,n,r)=>{if(!r.hasAttribute("tcoord"))return;const o=n.getShaderDescription("vertex"),a=r.getBuffer("tcoord"),i=ch(a.getArrayInformation()[0].format);let s=o.getCode();o.addOutput(`vec${i}`,"tcoordVS"),s=Zm.substitute(s,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,o.setCode(s);const l=n.getShaderDescription("fragment");s=l.getCode();const c=t.WebGPUActor.getRenderable(),u=e=>!!e&&e.getDimensionality()===i,d=[];(c.getProperty().getDiffuseTexture?.()?.getImageLoaded()||c.getTextures()[0]||t.colorTexture)&&(u(c.getProperty().getDiffuseTexture?.())||u(c.getTextures()[0])||u(t.colorTexture))&&d.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);"),c.getProperty().getRoughnessTexture?.()?.getImageLoaded()&&u(c.getProperty().getRoughnessTexture())&&d.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS);"),c.getProperty().getMetallicTexture?.()?.getImageLoaded()&&u(c.getProperty().getMetallicTexture())&&d.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS);"),c.getProperty().getNormalTexture?.()?.getImageLoaded()&&u(c.getProperty().getNormalTexture())&&d.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),c.getProperty().getAmbientOcclusionTexture?.()?.getImageLoaded()&&u(c.getProperty().getAmbientOcclusionTexture())&&d.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS);"),c.getProperty().getEmissionTexture?.()?.getImageLoaded()&&u(c.getProperty().getEmissionTexture())&&d.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),s=Zm.substitute(s,"//VTK::TCoord::Impl",d).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("fragment");let n=e.getCode();n=Zm.substitute(n,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"]).result,e.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===zv.POINTS||t===Uv.Points?Gv.Verts:t===Uv.Lines?Gv.Lines:e===zv.WIREFRAME?t===Uv.Triangles?Gv.LinesFromTriangles:Gv.LinesFromStrips:t===Uv.Triangles?Gv.Triangles:t===Uv.TriangleStrips?Gv.Strips:t===Uv.TriangleEdges?Gv.LinesFromTriangles:Gv.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case Gv.Triangles:return"triangle-list";case Gv.Verts:return"point-list";case Gv.Lines:default:return"line-list"}},e.buildVertexInput=()=>{const n=t.currentInput,r=t.cellArray,o=t.primitiveType;let a=t.WebGPUActor.getRenderable().getProperty().getRepresentation();const i=t.WebGPURenderWindow.getDevice();let s=!1;o===Uv.TriangleEdges&&(s=!0,a=zv.WIREFRAME);const l=t.vertexInput,c=n.getPoints();let u;if(r){const e={hash:`R${a}P${o}${r.getMTime()}`,usage:Gv.Index,cells:r,numberOfPoints:c.getNumberOfPoints(),primitiveType:o,representation:a};u=i.getBufferManager().getBuffer(e),l.setIndexBuffer(u)}else l.setIndexBuffer(null);if(c){const e=t.WebGPUActor.getBufferShift(t.WebGPURenderer),n={hash:`${c.getMTime()}I${u.getMTime()}${e.join()}float32x4`,usage:Gv.PointArray,format:"float32x4",dataArray:c,indexBuffer:u,shift:e,packExtra:!0},r=i.getBufferManager().getBuffer(n);l.addBuffer(r,["vertexBC"])}else l.removeBufferIfPresent("vertexBC");const d=e.getUsage(a,o);if(t._usesCellNormals=!1,t.is2D||d!==Gv.Triangles&&d!==Gv.Strips)l.removeBufferIfPresent("normalMC");else{const e=n.getPointData().getNormals(),a={format:"snorm8x4",indexBuffer:u,packExtra:!0,shift:0,scale:127};if(e){a.hash=`${e.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=e,a.usage=Gv.PointArray;const t=i.getBufferManager().getBuffer(a);l.addBuffer(t,["normalMC"])}else if(o===Uv.Triangles){t._usesCellNormals=!0,a.hash=`PFN${c.getMTime()}I${u.getMTime()}snorm8x4`,a.dataArray=c,a.cells=r,a.usage=Gv.NormalsFromPoints;const e=i.getBufferManager().getBuffer(a);l.addBuffer(e,["normalMC"])}else l.removeBufferIfPresent("normalMC")}let p=!1;if(t.renderable.getScalarVisibility()){const e=t.renderable.getColorMapColors();if(e&&!s){const r=t.renderable.getScalarMode();let o=!1;r!==Wv.USE_CELL_DATA&&r!==Wv.USE_CELL_FIELD_DATA&&r!==Wv.USE_FIELD_DATA&&n.getPointData().getScalars()||r===Wv.USE_POINT_FIELD_DATA||!e||(o=!0);const a={usage:Gv.PointArray,format:"unorm8x4",hash:`${o}${e.getMTime()}I${u.getMTime()}unorm8x4`,dataArray:e,indexBuffer:u,cellData:o,cellOffset:0},s=i.getBufferManager().getBuffer(a);l.addBuffer(s,["colorVI"]),p=!0}}p||l.removeBufferIfPresent("colorVI");let f=null;if(f=t.renderable.getInterpolateScalarsBeforeMapping?.()&&t.renderable.getColorCoordinates()?t.renderable.getColorCoordinates():n.getPointData().getTCoords(),f&&!s){const e=i.getBufferManager().getBufferForPointArray(f,l.getIndexBuffer());l.addBuffer(e,["tcoord"])}else l.removeBufferIfPresent("tcoord")},e.updateTextures=()=>{const e=[],n=[],r=t.renderable.getColorTextureMap?.();r&&(t.colorTexture||(t.colorTexture=Tu.newInstance({label:"polyDataColor"})),t.colorTexture.setInputData(r),n.push(["Diffuse",t.colorTexture]));const o=t.WebGPUActor.getRenderable(),a=t.WebGPURenderer.getRenderable(),i=[];if(o.getProperty().getDiffuseTexture?.()){const e=["Diffuse",o.getProperty().getDiffuseTexture()];i.push(e)}if(o.getTextures()[0]){const e=["Diffuse",o.getTextures()[0]];i.push(e)}if(t.colorTexture){const e=["Diffuse",t.colorTexture];i.push(e)}if(o.getProperty().getRoughnessTexture?.()){const e=["Roughness",o.getProperty().getRoughnessTexture()];i.push(e)}if(o.getProperty().getMetallicTexture?.()){const e=["Metallic",o.getProperty().getMetallicTexture()];i.push(e)}if(o.getProperty().getNormalTexture?.()){const e=["Normal",o.getProperty().getNormalTexture()];i.push(e)}if(o.getProperty().getAmbientOcclusionTexture?.()){const e=["AmbientOcclusion",o.getProperty().getAmbientOcclusionTexture()];i.push(e)}if(o.getProperty().getEmissionTexture?.()){const e=["Emission",o.getProperty().getEmissionTexture()];i.push(e)}if(a.getEnvironmentTexture?.()){const e=["Environment",a.getEnvironmentTexture()];i.push(e)}for(let e=0;e=0;n--)e[n]||(t.textures.splice(n,1),t.textureViews.splice(n,1))},e.computePipelineHash=()=>{let n=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.primitiveType===Uv.TriangleEdges||t.primitiveType===Uv.TriangleStripEdges)n+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(n+="n"),t.vertexInput.hasAttribute("colorVI")&&(n+="c"),t.vertexInput.hasAttribute("tcoord")){const e=t.vertexInput.getBuffer("tcoord");n+=`t${ch(e.getArrayInformation()[0].format)}`}t.textures.length&&(n+=`tx${t.textures.length}`)}t._usesCellNormals&&(n+="cn"),t.SSBO&&(n+="ssbo"),n+=e.getHashFromUsage(t.usage),n+=t.renderEncoder.getPipelineHash(),t.pipelineHash=n},e.updateBuffers=()=>{t.primitiveType!==Uv.TriangleEdges&&t.primitiveType!==Uv.TriangleStripEdges&&e.updateTextures();const n=t.WebGPUActor.getRenderable(),r=n.getProperty().getRepresentation();t.usage=e.getUsage(r,t.primitiveType),e.buildVertexInput();const o=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(o.getSizeInBytes()/o.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){const t=n.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}const Yv={is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function Zv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yv,n),Ph.extend(e,t,n),t.fragmentShaderTemplate=$v,t.vertexShaderTemplate=Kv,t._tmpMat3=pe(new Float64Array(9)),t._tmpMat4=g(new Float64Array(16)),t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),Pt(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],Xv(e,t)}var Qv={newInstance:Et(Zv,"vtkWebGPUCellArrayMapper"),extend:Zv};const{PrimitiveTypes:Jv}=ov;function ey(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>Qv.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=Jv.Points;i<=Jv.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility())for(let a=Jv.TriangleEdges;a<=Jv.TriangleStripEdges;a++)if(r[a-2].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const i=t.primitives[a];i.setCellArray(r[a-2]),i.setCurrentInput(n),i.setCellOffset(t.primitives[a-2].getCellOffset()),i.setPrimitiveType(a),i.setRenderable(t.renderable),o.push(i)}else t.primitives[a]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}const ty={primitives:null};function ny(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ty,n),Zt.extend(e,t,n),t.primitives=[],ey(e,t)}const ry=Et(ny,"vtkWebGPUPolyDataMapper");var oy={newInstance:ry,extend:ny};Em("vtkMapper",ry);const{PrimitiveTypes:ay}=ov;function iy(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>Qv.newInstance(),e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();t.renderable.mapScalars(n,1),e.updateCellArrayMappers(n)}},e.updateCellArrayMappers=n=>{const r=[n.getVerts(),n.getLines(),n.getPolys(),n.getStrips()],o=[];let a=0;for(let i=ay.Points;i<=ay.Triangles;i++)if(r[i].getNumberOfValues()>0){t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const s=t.primitives[i];s.setCellArray(r[i]),s.setCurrentInput(n),s.setCellOffset(a),s.setPrimitiveType(i),s.setRenderable(t.renderable),s.setIs2D(!0),a+=r[i].getNumberOfCells(),o.push(s)}else t.primitives[i]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}function sy(e){return{primitives:[],...e}}const ly=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sy(n)),Zt.extend(e,t,n),t.primitives=[],iy(e,t)}),"vtkWebGPUPolyDataMapper2D");function cy(e,t){t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=n=>{n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,n)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,n=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([n.usize,n.vsize],e,t.WebGPURenderWindow.getRenderable())}}}Em("vtkMapper2D",ly);const uy={};const dy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uy,n),Zt.extend(e,t,n),t.scalarBarActorHelper=Vp.newScalarBarActorHelper(),cy(e,t)}),"vtkWebGPUScalarBarActor");function py(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}Em("vtkScalarBarActor",dy);const fy={device:null,handle:null,label:null,options:null};function gy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fy,n),jt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","handle","options"]),jt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),py(e,t)}var my={newInstance:jt.newInstance(gy),extend:gy};function hy(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=sh(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=sh(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=my.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const vy={texture:null,handle:null,sampler:null,label:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),jt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},jt.obj(t.bindGroupTime,{mtime:0}),jt.get(e,t,["bindGroupTime","texture"]),jt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),hy(e,t)}var by={newInstance:jt.newInstance(yy),extend:yy};const{BufferUsage:xy}=ov;function Ty(e,t){t.classHierarchy.push("vtkWebGPUTexture"),e.create=(e,n)=>{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=sh(t.format);let a=t.width*o.stride;const i=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,a=2===o.elementSize&&"float"===o.sampleType;if(a||r%256){const i=e,s=r/i.BYTES_PER_ELEMENT,l=o.elementSize,c=256*Math.floor((s*l+255)/256),u=c/l,d=jt.newTypedArray(a?"Uint16Array":i.constructor.name,u*t*n);for(let e=0;e{const e=sh(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>sh(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=by.newInstance({label:n});return o.create(e,r),o}}const Cy={device:null,handle:null,buffer:null,ready:!1,label:null};function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cy,n),jt.obj(e,t),jt.get(e,t,["handle","ready","width","height","depth","format","usage"]),jt.setGet(e,t,["device","label"]),Ty(e,t)}var Py={newInstance:jt.newInstance(Sy),extend:Sy};function Ay(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DCellArrayMapper");const n={...e};e.setGlyphInstances=e=>{t.glyphInstances=e},e.updateBuffers=()=>{n.updateBuffers(),e.setNumberOfInstances(t.glyphInstances)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),r.addBuiltinOutput("vec4","@builtin(position) Position"),r.hasOutput("vertexVC")||r.addOutput("vec3","vertexVC");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" var vertexSC: vec4 = mapperUBO.BCSCMatrix*glyphSSBO.values[input.instanceIndex].matrix*vertexBC;"," output.vertexVC = (rendererUBO.SCVCMatrix*vertexSC).xyz;"," output.Position = rendererUBO.SCPCMatrix*vertexSC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,t,r)=>{if(r.hasAttribute("normalMC")){const e=t.getShaderDescription("vertex");let n=e.getCode();n=Zm.substitute(n,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals"," * mapperUBO.MCWCNormals"," * glyphSSBO.values[input.instanceIndex].normal*normalMC).xyz);"]).result,e.setCode(n)}n.replaceShaderNormal(e,t,r)},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderColor=(e,r,o)=>{if(!t.renderable.getColorArray())return void n.replaceShaderColor(e,r,o);const a=r.getShaderDescription("vertex");a.addOutput("vec4","color");let i=a.getCode();i=Zm.substitute(i,"//VTK::Color::Impl",[" output.color = glyphSSBO.values[input.instanceIndex].color;"]).result,a.setCode(i);const s=r.getShaderDescription("fragment");i=s.getCode(),i=Zm.substitute(i,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,s.setCode(i)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderSelect=(e,t,n)=>{if(e.includes("sel")){const e=t.getShaderDescription("vertex");e.addOutput("u32","compositeID","flat");let n=e.getCode();n=Zm.substitute(n,"//VTK::Select::Impl",[" output.compositeID = input.instanceIndex;"]).result,e.setCode(n);const r=t.getShaderDescription("fragment");n=r.getCode(),n=Zm.substitute(n,"//VTK::Select::Impl",["var compositeID: u32 = input.compositeID;"]).result,r.setCode(n)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect)}const Iy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,{},n),Qv.extend(e,t,n),Ay(e,t)}),"vtkWebGPUGlyph3DCellArrayMapper");function wy(e,t){t.classHierarchy.push("vtkWebGPUGlyph3DMapper"),e.createCellArrayMapper=()=>{const e=Iy();return e.setSSBO(t.SSBO),e.setRenderable(t.renderable),e},e.buildPass=n=>{if(n){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData(1);t.renderable.mapScalars(n,1),e.updateSSBO(),e.updateCellArrayMappers(n);for(let e=0;e{t.currentInput=t.renderable.getInputData(1),t.renderable.buildArrays();const n=t.renderable.getMatrixArray(),r=t.renderable.getNormalArray();if(t.carray=t.renderable.getColorArray(),t.numInstances=n.length/16,t.renderable.getBuildTime().getMTime()>t.glyphBOBuildTime.getMTime()){t.WebGPURenderWindow=e.getFirstAncestorOfType("vtkWebGPURenderWindow");const o=t.WebGPURenderWindow.getDevice();t.SSBO.clearData(),t.SSBO.setNumberOfInstances(t.numInstances),t.SSBO.addEntry("matrix","mat4x4"),t.SSBO.addEntry("normal","mat4x4"),t.carray&&t.SSBO.addEntry("color","vec4"),t.SSBO.setAllInstancesFromArray("matrix",n),t.SSBO.setAllInstancesFromArray3x3To4x4("normal",r),t.carray&&t.SSBO.setAllInstancesFromArrayColorToFloat("color",t.carray.getData()),t.SSBO.send(o),t.glyphBOBuildTime.modified()}}}const Oy={};const My=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Oy,n),oy.extend(e,t,n),t.glyphBOBuildTime={},yt(t.glyphBOBuildTime,{mtime:0}),t.SSBO=uv.newInstance({label:"glyphSSBO"}),wy(e,t)}),"vtkWebGPUGlyph3DMapper");Em("vtkGlyph3DMapper",My);const{SlicingMode:Ry}=ug,Vy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",Ey=new Float64Array(16),Dy=new Float64Array(16),Ly=new Float64Array(16),By=new Float64Array(4),Ny=new Float64Array(4);function ky(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();g(Ey),x(Ey,Ey,n);const a=r.getMatrix();m(Dy,a),h(Dy,Dy),b(Ey,Dy,Ey);const i=e.getWorldToIndex();b(Ey,i,Ey),h(Ly,Ey),I(Dy,[.5,.5,.5]),b(Ey,Dy,Ey);const s=e.getDimensions();g(Dy),T(Dy,Dy,[1/s[0],1/s[1],1/s[2]]),b(Ey,Dy,Ey),t.UBO.setArray("SCTCMatrix",Ey);const l=t.currentInput.getExtent(),{ijkMode:c}=t.renderable.getClosestIJKAxis();let u=t.renderable.getSlice();c!==t.renderable.getSlicingMode()&&(u=t.renderable.getSliceAtPosition(u));let d=2,p=0,f=1;c===Ry.I?(d=0,p=1,f=2):c===Ry.J&&(d=1,p=2,f=0),By[d]=u,By[p]=l[2*p]-.5,By[f]=l[2*f]-.5,By[3]=1,Gi(By,By,Ly),t.UBO.setArray("Origin",By),Ny[d]=u,Ny[p]=l[2*p+1]+.5,Ny[f]=l[2*f]-.5,Ny[3]=1,Gi(Ny,Ny,Ly),_i(Ny,Ny,By),Ny[3]=1,t.UBO.setArray("Axis1",Ny),Ny[d]=u,Ny[p]=l[2*p]-.5,Ny[f]=l[2*f+1]+.5,Ny[3]=1,Gi(Ny,Ny,Ly),_i(Ny,Ny,By),Ny[3]=1,t.UBO.setArray("Axis2",Ny);const v=[1,1,1,1],y=[0,0,0,0],C=t.textureViews[0],S=C.getTexture().getScale(),P=C.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let a=0;a<1;a++){o=n.getRGBTransferFunction(a);const i=o.getRange();o.getTable(i[0],i[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const a=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===ng.NEAREST?"nearest":"linear";t.clampSampler&&a===t.clampSampler.getOptions().minFilter||(t.clampSampler=my.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:a,magFilter:a}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let a=o.getCode();const i=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?i.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):i.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),i.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),a=Zm.substitute(a,"//VTK::Position::Impl",i).result,o.setCode(a)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();t.dimensions,a=Zm.substitute(a,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,a=Zm.substitute(a,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(a)},r.set("replaceShaderImage",e.replaceShaderImage)}const Fy={rowLength:1024};const _y=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fy,n),Oh.extend(e,t,n),e.setFragmentShaderTemplate(Vy),t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},yt(t.lutBuildTime,{mtime:0}),t.imagemat=g(new Float64Array(16)),t.imagematinv=g(new Float64Array(16)),t.VBOBuildTime={},yt(t.VBOBuildTime),ky(e,t)}),"vtkWebGPUImageMapper");function Gy(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],m(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?g(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Em("vtkImageMapper",_y);const Uy={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const zy=Et((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uy,n),Zt.extend(e,t,n),t.keyMatricesTime={},yt(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},yt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:g(new Float64Array(16))},t.bufferShift=[0,0,0,0],xt(e,t,["propID","keyMatricesTime"]),Gy(e,t)}),"vtkWebGPUImageSlice");function Wy(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const a=t.renderable.getMapper().getInputData();if(!a)return;const i=a.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=i[t];for(let t=2;t<4;t++){n[1]=i[t];for(let t=0;t<2;t++){n[0]=i[t],a.indexToWorld(n,r);let c=o+3*l;e[c++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[c++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[c++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();m(t.keyMatrices.bcwc,n),x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}Em("vtkImageSlice",zy);const Hy={propID:void 0,keyMatricesTime:null};const jy=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hy,n),Zt.extend(e,t,n),t.keyMatricesTime={},jt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},jt.get(e,t,["propID","keyMatricesTime"]),Wy(e,t)}),"vtkWebGPUVolume");function Ky(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),a=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,i=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),a,o,i,null)}}Em("vtkVolume",jy);const $y={};const qy=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$y,n),Zt.extend(e,t,n),Ky(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");Em("vtkPixelSpaceCallbackMapper",qy);const{BufferUsage:Xy}=ov,{vtkErrorMacro:Yy}=Kt,Zy="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3 = normalize(-vertexVC.xyz);\n var base2: vec3 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n var base1: vec3 = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2 = vertexVC.xy + offsetMC;\n vertexVC = vec4(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vec4(vertexVC.xyz, 0.0);\n\n //VTK::Position::Impl\n\n return output;\n}\n";function Qy(e,t){t.classHierarchy.push("vtkWebGPUSphereMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("f32","radiusVC");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=Zm.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n var invertedDepth: f32 = 1.0;\n if (rendererUBO.cameraParallel != 0u) {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0) {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n // find the intersection\n var b: f32 = 2.0*dot(EyePos,EyeDir);\n var c: f32 = dot(EyePos,EyePos) - 1.0;\n var d: f32 = b*b - 4.0*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else {\n var t: f32 = (-b - invertedDepth*sqrt(d))*0.5;\n\n // compute the normal, for unit sphere this is just\n // the intersection point\n normal = invertedDepth*normalize(EyePos + t*EyeDir);\n // compute the intersection point in VC\n vertexVC = vec4(normal * input.radiusVC + input.centerVC, 1.0);\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="spm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=n.getPoints(),o=r.getNumberOfPoints(),a=r.getData();e.setNumberOfInstances(1),e.setNumberOfVertices(3*o);const i=t.vertexInput;let s=`spm${r.getMTime()}float32x3`;if(!t.device.getBufferManager().hasBuffer(s)){const e={hash:s,usage:Xy.RawVertex,format:"float32x3"},n=new Float32Array(3*o*3);let r=0,l=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jy,n),Qv.extend(e,t,n),e.setVertexShaderTemplate(Zy),Qy(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUSphereMapper");Em("vtkSphereMapper",eb);const{BufferUsage:tb}=ov,{vtkErrorMacro:nb}=Kt,rb="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array, 12> = array, 12>(\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, -1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(-1.0, -1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n\n vec3(-1.0, -1.0, 1.0),\n vec3(1.0, 1.0, 1.0),\n vec3(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4 = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3;\n var ybase: vec3;\n var dir: vec3 = vec3(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3 = offsetsArray[vertIdx];\n\n vertexVC = vec4(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n";function ob(e,t){t.classHierarchy.push("vtkWebGPUStickMapper");const n=e.buildPass;e.buildPass=r=>{if(r){t.renderable.getStatic()||t.renderable.update();const n=t.renderable.getInputData();e.setCellArray(n.getVerts()),e.setCurrentInput(n)}n(r)},e.replaceShaderNormal=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.hasOutput("vertexVC")||r.addOutput("vec4","vertexVC"),r.addOutput("vec3","centerVC"),r.addOutput("vec3","orientVC"),r.addOutput("f32","radiusVC"),r.addOutput("f32","lengthVC"),r.addBuiltinInput("u32","@builtin(vertex_index) vertexIndex");const o=t.getShaderDescription("fragment");o.addBuiltinOutput("f32","@builtin(frag_depth) fragDepth");let a=o.getCode();a=Zm.substitute(a,"//VTK::Normal::Impl",["\n // compute the eye position and unit direction\n var vertexVC: vec4;\n var EyePos: vec3;\n var EyeDir: vec3;\n\n if (rendererUBO.cameraParallel != 0u)\n {\n EyePos = vec3(input.vertexVC.x, input.vertexVC.y, input.vertexVC.z + 3.0*input.radiusVC);\n EyeDir = vec3(0.0, 0.0, -1.0);\n }\n else\n {\n EyeDir = input.vertexVC.xyz;\n EyePos = vec3(0.0,0.0,0.0);\n var lengthED: f32 = length(EyeDir);\n EyeDir = normalize(EyeDir);\n // we adjust the EyePos to be closer if it is too far away\n // to prevent floating point precision noise\n if (lengthED > input.radiusVC*3.0)\n {\n EyePos = input.vertexVC.xyz - EyeDir*3.0*input.radiusVC;\n }\n }\n // translate to Sphere center\n EyePos = EyePos - input.centerVC;\n\n // rotate to new basis\n // base1, base2, orientVC\n var base1: vec3;\n if (abs(input.orientVC.z) < 0.99)\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,0.0,1.0)));\n }\n else\n {\n base1 = normalize(cross(input.orientVC,vec3(0.0,1.0,0.0)));\n }\n var base2: vec3 = cross(input.orientVC,base1);\n EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,input.orientVC));\n EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,input.orientVC));\n\n // scale to radius 1.0\n EyePos = EyePos * (1.0 / input.radiusVC);\n\n // find the intersection\n var a: f32 = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n var b: f32 = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n var c: f32 = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n var d: f32 = b*b - 4.0*a*c;\n var normal: vec3 = vec3(0.0,0.0,1.0);\n if (d < 0.0) { discard; }\n else\n {\n var t: f32 = (-b - sqrt(d))*(0.5 / a);\n var tz: f32 = EyePos.z + t*EyeDir.z;\n var iPoint: vec3 = EyePos + t*EyeDir;\n if (abs(iPoint.z)*input.radiusVC > input.lengthVC*0.5)\n {\n // test for end cap\n var t2: f32 = (-b + sqrt(d))*(0.5 / a);\n var tz2: f32 = EyePos.z + t2*EyeDir.z;\n if (tz2*input.radiusVC > input.lengthVC*0.5 || tz*input.radiusVC < -0.5*input.lengthVC) { discard; }\n else\n {\n normal = input.orientVC;\n var t3: f32 = (input.lengthVC*0.5/input.radiusVC - EyePos.z)/EyeDir.z;\n iPoint = EyePos + t3*EyeDir;\n vertexVC = vec4(input.radiusVC*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n else\n {\n // The normal is the iPoint.xy rotated back into VC\n normal = iPoint.x*base1 + iPoint.y*base2;\n // rescale rerotate and translate\n vertexVC = vec4(input.radiusVC*(normal + iPoint.z*input.orientVC) + input.centerVC, 1.0);\n }\n }\n // compute the pixel's depth\n var pos: vec4 = rendererUBO.VCPCMatrix * vertexVC;\n output.fragDepth = pos.z / pos.w;\n "]).result,o.setCode(a)},e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.VCPCMatrix*vertexVC;"]).result,r.setCode(o)},e.computePipelineHash=()=>{t.pipelineHash="stm",t.vertexInput.hasAttribute("colorVI")&&(t.pipelineHash+="c"),t.pipelineHash+=t.renderEncoder.getPipelineHash()},e.updateBuffers=()=>{const n=t.currentInput;t.renderable.mapScalars(n,1);const r=t.device,o=n.getPoints(),a=n.getPointData(),i=o.getNumberOfPoints(),s=o.getData();e.setNumberOfInstances(i),e.setNumberOfVertices(12);const l=t.vertexInput;let c=`stm${o.getMTime()}float32x3`;if(!r.getBufferManager().hasBuffer(c)){const e={hash:c,usage:tb.RawVertex,format:"float32x3"},t=new Float32Array(3*i);let n=0,o=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ab,n),Qv.extend(e,t,n),e.setVertexShaderTemplate(rb),ob(e,t);const r=t.shaderReplacements;r.set("replaceShaderPosition",e.replaceShaderPosition),r.set("replaceShaderNormal",e.replaceShaderNormal)}),"vtkWebGPUStickMapper");function sb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0];const[n,r,o,a]=t,i=e.getContext("2d"),s=i.getImageData(n,r,o||e.width,a||e.height),l=gl.newInstance({type:"vtkImageData"});l.setOrigin(0,0,0),l.setSpacing(1,1,1),l.setExtent(0,(o||e.width)-1,0,(a||e.height)-1,0,0);const c=Es.newInstance({numberOfComponents:4,values:new Uint8Array(s.data.buffer)});return c.setName("scalars"),l.getPointData().setScalars(c),l}Em("vtkStickMapper",ib);var lb={canvasToImageData:sb,imageToImageData:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flipX:!1,flipY:!1,rotate:0};const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d"),{flipX:o,flipY:a,rotate:i}=t;return r.translate(n.width/2,n.height/2),r.scale(o?-1:1,a?-1:1),r.rotate(i*Math.PI/180),r.drawImage(e,-e.width/2,-e.height/2),sb(n)}};const cb={default:{defaultStyle:{fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:"white",edgeThickness:.1,edgeColor:"black",resolution:400},xMinusFaceProperty:{text:"X-",faceColor:"yellow"},xPlusFaceProperty:{text:"X+",faceColor:"yellow"},yMinusFaceProperty:{text:"Y-",faceColor:"red"},yPlusFaceProperty:{text:"Y+",faceColor:"red"},zMinusFaceProperty:{text:"Z-",faceColor:"#008000"},zPlusFaceProperty:{text:"Z+",faceColor:"#008000"}},lps:{xMinusFaceProperty:{text:"R",faceRotation:-90},xPlusFaceProperty:{text:"L",faceRotation:90},yMinusFaceProperty:{text:"A",faceRotation:0},yPlusFaceProperty:{text:"P",faceRotation:180},zMinusFaceProperty:{text:"I",faceRotation:180},zPlusFaceProperty:{text:"S",faceRotation:0}}};function ub(e,t){t.set(e)}var db={applyDefinitions:ub,applyPreset:function(e,t){return ub(cb[e],t)},registerStylePreset:function(e,t){cb[e]=t}};const pb={xPlus:0,xMinus:1,yPlus:2,yMinus:3,zPlus:4,zMinus:5};function fb(e,t){t.classHierarchy.push("vtkAnnotatedCubeActor"),t.xPlusFaceProperty={...t.xPlusFaceProperty},t.xMinusFaceProperty={...t.xMinusFaceProperty},t.yPlusFaceProperty={...t.yPlusFaceProperty},t.yMinusFaceProperty={...t.yMinusFaceProperty},t.zPlusFaceProperty={...t.zPlusFaceProperty},t.zMinusFaceProperty={...t.zMinusFaceProperty};let n=null;const r=document.createElement("canvas"),o=oc.newInstance(),a=Tu.newInstance();function i(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o&&Object.assign(t[`${n}FaceProperty`],o);const i={...t.defaultStyle,...t[`${n}FaceProperty`]};r.width=i.resolution,r.height=i.resolution;const s=r.getContext("2d");s.fillStyle=i.faceColor,s.fillRect(0,0,r.width,r.height),i.edgeThickness>0&&(s.strokeStyle=i.edgeColor,s.lineWidth=i.edgeThickness*r.width,s.strokeRect(0,0,r.width,r.height)),s.save(),s.translate(0,r.height),s.scale(1,-1),s.translate(r.width/2,r.height/2),s.rotate(-Math.PI*(i.faceRotation/180));const l=i.fontSizeScale(i.resolution);s.fillStyle=i.fontColor,s.textAlign="center",s.textBaseline="middle",s.font=`${i.fontStyle} ${l}px "${i.fontFamily}"`,s.fillText(i.text,0,0),s.restore();const c=lb.canvasToImageData(r);a.setInputData(c,pb[n]),e.modified()}function s(){n=jf.newInstance({generate3DTextureCoordinates:!0}),o.setInputConnection(n.getOutputPort()),i("xPlus"),i("xMinus"),i("yPlus"),i("yMinus"),i("zPlus"),i("zMinus")}a.setInterpolate(!0),e.setDefaultStyle=e=>{t.defaultStyle={...t.defaultStyle,...e},s()},e.setXPlusFaceProperty=e=>i("xPlus",e),e.setXMinusFaceProperty=e=>i("xMinus",e),e.setYPlusFaceProperty=e=>i("yPlus",e),e.setYMinusFaceProperty=e=>i("yMinus",e),e.setZPlusFaceProperty=e=>i("zPlus",e),e.setZMinusFaceProperty=e=>i("zMinus",e),s(),o.setInputConnection(n.getOutputPort()),e.setMapper(o),e.addTexture(a)}const gb={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:e=>e/1.8,edgeThickness:.1,edgeColor:"black",resolution:200}};function mb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gb,n),hs.extend(e,t,n),jt.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty"]),fb(e,t)}var hb={newInstance:jt.newInstance(mb,"vtkAnnotatedCubeActor"),extend:mb,Presets:db};const vb={};function yb(e){return!!vb[e]}function bb(e,t){vb[e]=t}var xb=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vb[e](t)};function Tb(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Pb({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Cb={name:"",numberOfComponents:1,size:0,dataType:"string"};function Sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Cb,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),jt.obj(e,t),jt.set(e,t,["name"]),Tb(e,t)}const Pb=jt.newInstance(Sb,"vtkStringArray");var Ab={newInstance:Pb,extend:Sb};function Ib(){const e=new ArrayBuffer(4),t=new Uint8Array(e),n=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===n[0]?"LittleEndian":2712847316===n[0]?"BigEndian":null}var wb=Ib(),Ob=function(e,t){if(t<2)return;const n=new Int8Array(e),r=n.length,o=[];for(let e=0;e(Mb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let Eb=0;function Db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const Lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?Vb():n.ref&&!n.ref.pending?new Promise(((o,a)=>{const i=Db("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);i.onreadystatechange=t=>{1===i.readyState&&(n.ref.pending=!0,1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0)),4===i.readyState&&(n.ref.pending=!1,200===i.status||0===i.status?(n.buffer=i.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(wb!==n.ref.encode&&wb&&(Rb(`Swap bytes of ${n.name}`),Ob(n.buffer,vs[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Mb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:i,e:t}))},i.responseType="string"!==n.dataType?"arraybuffer":"text",i.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Vb():new Promise(((r,o)=>{const a=Db("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Vb():new Promise(((r,o)=>{const a=Db("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++Eb&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--Eb&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?r(a.responseText):o({xhr:a,e:t}))},a.responseType="text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=Db("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};yb("http")||bb("http",(e=>Lb));const Bb=["pointData","cellData","fieldData"],Nb={vtkDataArray:Es,vtkStringArray:Ab},kb={},Fb={vtkPolyData(e){const t=[];return t.push(e.points),["verts","lines","polys","strips"].forEach((n=>{e[n]&&t.push(e[n])})),t},vtkImageData:e=>[],vtkUnstructuredGrid(e){const t=[];return t.push(e.points),t.push(e.cells),t.push(e.cellTypes),t},vtkRectilinearGrid(e){const t=[];return t.push(e.xCoordinates),t.push(e.yCoordinates),t.push(e.zCoordinates),t}};function _b(e,t){function n(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=`${n.ref.id}|${n.vtkClass}`;return kb[o]?Promise.resolve(kb[o]).then((e=>{n!==e&&(Object.assign(n,e),delete n.ref)})):kb[o]=t.dataAccessHelper.fetchArray(e,t.baseURL,n,r).then((e=>(kb[o]=e,e))),Promise.resolve(kb[o])}t.classHierarchy.push("vtkHttpDataSetReader"),t.output[0]=We({vtkClass:"vtkPolyData"}),t.dataAccessHelper||(t.dataAccessHelper=xb("http")),e.updateMetadata=function(){let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"zip"===t.compression?new Promise(((r,o)=>{xb("http").fetchBinary(t.url).then((a=>{t.dataAccessHelper=xb("zip",{zipContent:a,callback:a=>{t.baseURL="",t.dataAccessHelper.fetchJSON(e,"index.json").then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}})}),(e=>{o(e)}))})):new Promise(((r,o)=>{t.dataAccessHelper.fetchJSON(e,t.url).then((t=>{e.parseObject(t,{loadData:n,deepCopy:!1}).then(r,o)}),(e=>{o(e)}))}))},e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf("index.json")||r.fullpath){t.url=n;const e=n.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=n,t.url=`${n}/index.json`;return t.compression=r.compression,e.updateMetadata(!!r.loadData)},e.parseObject=(r,o)=>{let{loadData:a,baseUrl:i,deepCopy:s=!0}=o;i&&(t.baseURL=i);const l=s?structuredClone(r):r;return new Promise(((r,o)=>{!function(e,t,n,r,o,a,i){const s=t.enableArray;t.arrays=[],Bb.forEach((e=>{n[e]&&(n[e].arrays.map((e=>e.data)).forEach((n=>{t.arrays.push({name:n.name,enable:s,location:e,array:n,registration:n.ref.registration||"addArray"})})),n[e].arrays=[])}));const l=[],{progressCallback:c}=t,u=t.fetchGzip?"gz":null;function d(){t.dataset=We(n),i?e.loadData().then((()=>{t.output[0]=t.dataset,o(e,t.output[0])})):(t.output[0]=t.dataset,o(e,t.output[0]))}Fb[n.vtkClass](n).forEach((e=>{l.push(r(e,{compression:u,progressCallback:c}))})),l.length?Promise.all(l).then(d,(e=>{a(e)})):d()}(e,t,l,n,r,o,a)}))},e.loadData=()=>{const r=t.dataset,o=t.arrays.filter((e=>e.enable)).filter((e=>e.array.ref)).map((e=>e.array));return new Promise(((a,i)=>{const s=e=>{i(e)},l=()=>{if(o.length){const{progressCallback:e}=t,r=t.fetchGzip?"gz":null;n(o.pop(),{compression:r,progressCallback:e}).then(l,s)}else r&&(t.arrays.filter((e=>e.registration&&!e.array.ref)).forEach((e=>{const t=Nb[e.array.vtkClass].newInstance(e.array);r[`get${jt.capitalize(e.location)}`]()[e.registration](t),delete e.registration})),r.modified(),a(e,r))};l()}))},e.requestData=(e,t)=>{},e.enableArray=function(e,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.arrays.filter((t=>t.name===n&&t.location===e));1===o.length&&(o[0].enable=r)},e.isBusy=()=>!!t.requestCount}const Gb={enableArray:!0,fetchGzip:!1,arrays:[],url:null,baseURL:null,requestCount:0};function Ub(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gb,n),jt.obj(e,t),jt.get(e,t,["enableArray","fetchGzip","url","baseURL","dataAccessHelper"]),jt.set(e,t,["dataAccessHelper","progressCallback"]),jt.getArray(e,t,["arrays"]),jt.algo(e,t,0,1),jt.event(e,t,"busy"),_b(e,t),void 0===t.progressCallback&&(t.progressCallback=null)}var zb={newInstance:jt.newInstance(Ub,"vtkHttpDataSetReader"),extend:Ub};const{vtkDebugMacro:Wb}=jt;function Hb(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),a=g(new Float64Array(16)),i=g(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),c=new Float64Array(3),u=g(new Float64Array(16)),p=g(new Float64Array(16)),f=new Float64Array(3),v=new Float64Array(3);function y(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Wb("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Wb("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,y()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,a=t.viewUp,i=new Float64Array([a[0],a[1],a[2],0]);g(u);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);C(u,u,Mo(n),s),Gi(i,i,u),t.viewUp[0]=i[0],t.viewUp[1]=i[1],t.viewUp[2]=i[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;g(p),x(p,p,r),C(p,p,Mo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Dn(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.yaw=n=>{const r=t.position;g(p),x(p,p,r),C(p,p,Mo(n),t.viewUp),x(p,p,[-r[0],-r[1],-r[2]]),Dn(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),a=[-o[0],-o[1],-o[2]];g(p),x(p,p,r),C(p,p,Mo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Dn(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),a=[o[0],o[1],o[2]];g(p),x(p,p,r),C(p,p,Mo(n),a),x(p,p,[-r[0],-r[1],-r[2]]),Dn(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const a=[n,r,o];Uo(t.position,a,t.position),Uo(t.focalPoint,a,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],a=[],i=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Gi(o,[...t.position,1],n),Gi(a,[...t.focalPoint,1],n),Gi(i,r,n),i[0]-=o[0],i[1]-=o[1],i[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...a.slice(0,3)),e.setViewUp(...i.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Wb("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Wb("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(d(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{d(a,e.getViewMatrix()),h(a,a),w(i,[t.distance,t.distance,t.distance]),b(a,a,i),g(t.cameraLightTransform),x(t.cameraLightTransform,a,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Hi(e[0],e[1],e[2],e[3]),n=Ui(),r=Hi(0,0,1,0);var o,a;return a=t,(o=n)[0]=-a[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],Wi(r,t,r),Wi(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),h(t,t)},e.getWorldToPhysicalMatrix=e=>{g(e);const n=[3];$o(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],m(e,e),An(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),T(e,e,s),x(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=i=>{h(a,i),Dn(s,n,a),e.computeDistance();const u=t.distance;e.setPosition(s[0],s[1],s[2]),Dn(l,r,a),wn(l,l,s),Rn(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Dn(c,o,a),wn(c,c,s),Rn(c,c),e.setViewUp(c[0],c[1],c[2]),e.setDistance(u)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(a),b(a,t,a),e.computeViewParametersFromViewMatrix(a)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(d(a,t.viewMatrix),e.computeViewParametersFromViewMatrix(a),m(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;q(a,t.position,t.focalPoint,t.viewUp),m(a,a);const e=new Float64Array(16);return d(e,a),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(g(o),t.projectionMatrix){const e=1/t.physicalScale;return An(s,e,e,e),d(o,t.projectionMatrix),T(o,o,s),m(o,o),o}g(a);const i=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*i/2,t.clippingRange[0]+(r+1)*i/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,i=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,c=(t.windowCenter[1]+1)*r;K(a,o,i,s,c,l[0],l[1]),m(a,a)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(Mo(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const i=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,c=(t.windowCenter[1]-1)*o,u=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];a[0]=2*d/(s-i),a[5]=2*d/(u-c),a[2]=(i+s)/(s-i),a[6]=(c+u)/(u-c),a[10]=-(d+p)/(p-d),a[14]=-1,a[11]=-2*d*p/(p-d),a[15]=0}}return d(o,a),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),a=e.getProjectionMatrix(t,n,r);return b(a,o,a),a},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,y()},e.setDeviceAngles=(n,r,o,a)=>{const i=[3];$o(t.physicalViewNorth,t.physicalViewUp,i);const s=g(new Float64Array(16));C(s,s,Mo(n),t.physicalViewUp),C(s,s,Mo(r),i),C(s,s,Mo(o),t.physicalViewNorth),C(s,s,Mo(-a),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),c=new Float64Array(t.physicalViewNorth);Dn(l,l,s),Dn(c,c,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(c[0],c[1],c[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const a=g(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=Mo(t),i=Ui();zi(i,[n,r,o],e),_(a,i)}const i=new Float64Array(3);Dn(i,[0,0,-1],a);const s=new Float64Array(3);Dn(s,[0,1,0],a),e.setDirectionOfProjection(...i),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],a=-n[1],i=-n[2],s=-(o*r[0]+a*r[1]+i*r[2]),l=[o*e[0]+a*e[2]+i*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const c=o*e[r]+a*e[2+n]+i*e[4+t]+s;l[0]=cl[1]?c:l[1]}return l}}const jb={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:c(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jb,n),jt.obj(e,t),jt.get(e,t,["distance"]),jt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),jt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),jt.setGetArray(e,t,["clippingRange","windowCenter"],2),jt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),Hb(e,t)}var $b={newInstance:jt.newInstance(Kb,"vtkCamera"),extend:Kb};function qb(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Dn(n,t.position,t.transformMatrix):An(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Dn(n,t.focalPoint,t.transformMatrix):An(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);kn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=Mo(t),o=Mo(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Xb={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Yb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),jt.obj(e,t),jt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),jt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),qb(e,t)}var Zb={newInstance:jt.newInstance(Yb,"vtkLight"),extend:Yb,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Qb}=jt;function Jb(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Qb("call displayToView on your view instead"),e.viewToDisplay=()=>Qb("callviewtodisplay on your view instead"),e.getSize=()=>Qb("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Qb("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const ex={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function tx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ex,n),jt.obj(e,t),jt.event(e,t,"event"),jt.setGetArray(e,t,["viewport"],4),jt.setGetArray(e,t,["background","background2"],3),Jb(e,t)}var nx={newInstance:jt.newInstance(tx,"vtkViewport"),extend:tx};const{vtkDebugMacro:rx,vtkErrorMacro:ox,vtkWarningMacro:ax}=Kt;function ix(e){return()=>ox(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function sx(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(rx("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(c())):ox("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=ix("allocateTime"),e.updateGeometry=ix("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{rx(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=$b.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Zb.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let a=e.normalizedDisplayToProjection(t,n,r);return a=e.projectionToView(a[0],a[1],a[2],o),e.viewToWorld(a[0],a[1],a[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let a=e.worldToView(t,n,r);return a=e.viewToProjection(a[0],a[1],a[2],o),e.projectionToNormalizedDisplay(a[0],a[1],a[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return ox("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o),m(o,o);const a=new Float64Array([e,n,r]);return Dn(a,a,o),a},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return ox("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);h(a,a),m(a,a);const i=new Float64Array([e,n,r]);return Dn(i,i,a),i},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return ox("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o);const a=new Float64Array([e,n,r]);return Dn(a,a,o),a},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return ox("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const a=t.activeCamera.getProjectionMatrix(o,-1,1);m(a,a);const i=new Float64Array([e,n,r]);return Dn(i,i,a),i},e.computeVisiblePropBounds=()=>{t.allBounds[0]=Fi.INIT_BOUNDS[0],t.allBounds[1]=Fi.INIT_BOUNDS[1],t.allBounds[2]=Fi.INIT_BOUNDS[2],t.allBounds[3]=Fi.INIT_BOUNDS[3],t.allBounds[4]=Fi.INIT_BOUNDS[4],t.allBounds[5]=Fi.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(wa(t.allBounds),rx("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),a=[0,0,0];if(!Oa(r))return rx("Cannot reset camera!"),!1;let i=null;if(!e.getActiveCamera())return ox("Trying to reset non-existent camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),a[0]=(r[0]+r[1])/2,a[1]=(r[2]+r[3])/2,a[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],c=r[5]-r[4];s*=s,l*=l,c*=c;let u=s+l+c;u=0===u?1:u,u=.5*Math.sqrt(u);const d=Mo(t.activeCamera.getViewAngle()),p=u,f=u/Math.sin(.5*d),g=t.activeCamera.getViewUp();return Math.abs(Ko(g,i))>.999&&(ax("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-g[2],g[0],g[1])),t.activeCamera.setFocalPoint(a[0],a[1],a[2]),t.activeCamera.setPosition(a[0]+f*i[0],a[1]+f*i[1],a[2]+f*i[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(u),t.activeCamera.setPhysicalTranslation(-a[0],-a[1],-a[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!Oa(o))return rx("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return ox("Trying to reset clipping range of non-existent camera"),!1;const a=t.activeCamera.computeClippingRange(o);let i=0;if(t.activeCamera.getParallelProjection())i=.2*t.activeCamera.getParallelScale();else{const e=Mo(t.activeCamera.getViewAngle());i=.2*Math.tan(e/2)*a[1]}return a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const lx={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Na(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function cx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,lx,n),nx.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),xt(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),Pt(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),At(e,t,["actors","volumes","lights"]),wt(e,t,["background"],4,1),Ot(0,t,["renderWindow"]),sx(e,t)}var ux={newInstance:Et(cx,"vtkRenderer"),extend:cx};const dx=Object.create(null);function px(e,t){dx[e]=t}function fx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return dx[e]&&dx[e](t)}function gx(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fx(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const mx={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function hx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mx,n),jt.obj(e,t),jt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),jt.get(e,t,["neverRendered"]),jt.getArray(e,t,["renderers"]),jt.moveToProtected(e,t,["views"]),jt.event(e,t,"completion"),gx(e,t)}var vx={newInstance:jt.newInstance(hx,"vtkRenderWindow"),extend:hx,registerViewConstructor:px,listViewAPIs:function(){return Object.keys(dx)},newAPISpecificView:fx};const yx={Unknown:0,LeftController:1,RightController:2},bx={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var xx={Device:yx,Input:bx,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Tx,Input:Cx}=xx,{vtkWarningMacro:Sx,vtkErrorMacro:Px,normalizeWheel:Ax,vtkOnceErrorMacro:Ix}=jt,wx={ctrlKey:!1,altKey:!1,shiftKey:!1},Ox={"xr-standard":[Cx.Trigger,Cx.Grip,Cx.TrackPad,Cx.Thumbstick,Cx.A,Cx.B]},Mx=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Rx(e){e.cancelable&&e.preventDefault()}function Vx(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function Ex(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function a(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Px("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Sx("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||a(0,0),t.currentRenderer);const i=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),i=n.width/o.width,s=n.height/o.height,l={x:i*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&a(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function c(e){return e.pointerType||""}function u(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Rx),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Rx),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:i(t),deviceType:c(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Rx(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Sx("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:i(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Rx(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=i(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Px(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Sx("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Px("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Sx(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const a=null==n.gripSpace?null:r.getPose(n.gripSpace,o),i=n.gamepad,s=n.handedness;if(i){i.index in t.lastGamepadValues||(t.lastGamepadValues[i.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:i(n),deviceType:c(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),u(),n.size>0||Date.now(){Rx(n);const r={...Ax(n),...s(n),position:i(n),deviceType:c(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:i(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Px(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=Vx(r);if(2===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(wx),position:i(n),deviceType:c(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=Vx(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(wx),position:i(n),deviceType:c(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=Vx(r);e.recognizeGesture("TouchEnd",t);const a={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonPressEvent(a)}else{const t=Vx(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(wx),position:o[0].position,deviceType:c(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,a=null,i=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){i=l;break}null===o&&l.getInteractive()&&(o=l),null===a&&t._view.isInViewport(e,n,l)&&(a=l)}return null===i&&(i=o),null===i&&(i=a),null==i&&(i=r[0]),i},e.render=()=>{e.isAnimating()||t.inRender||u()},Mx.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void Ix("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const a=[],i=[];Object.keys(r).forEach((e=>{a[o]=r[e],i[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y)),l=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y));let c=Ro(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),u=Ro(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),d=u-c;u=u+180>=360?u-180:u+180,c=c+180>=360?c-180:c+180,Math.abs(u-c)n&&o>a&&o>i){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(a>n&&a>i){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(i>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Dx={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Lx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dx,n),jt.obj(e,t),t._animationExtendedEnd=0,jt.event(e,t,"RenderEvent"),Mx.forEach((n=>jt.event(e,t,n))),jt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),jt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),jt.moveToProtected(e,t,["view"]),Ex(e,t)}var Bx={newInstance:jt.newInstance(Lx,"vtkRenderWindowInteractor"),extend:Lx,handledEvents:Mx,...xx};const{vtkErrorMacro:Nx,VOID:kx}=jt;function Fx(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Bx.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):kx),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Nx("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const _x={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function Gx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_x,n),jt.obj(e,t),jt.event(e,t,"InteractionEvent"),jt.event(e,t,"StartInteractionEvent"),jt.event(e,t,"EndInteractionEvent"),jt.get(e,t,["_interactor","enabled"]),jt.setGet(e,t,["priority","processEvents"]),jt.moveToProtected(e,t,["interactor"]),Fx(e,t)}var Ux={newInstance:jt.newInstance(Gx,"vtkInteractorObserver"),extend:Gx,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}};const zx={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025};var Wx={States:zx};const{States:Hx}=Wx,jx={Rotate:Hx.IS_ROTATE,Pan:Hx.IS_PAN,Spin:Hx.IS_SPIN,Dolly:Hx.IS_DOLLY,CameraPose:Hx.IS_CAMERA_POSE,WindowLevel:Hx.IS_WINDOW_LEVEL,Slice:Hx.IS_SLICE};function Kx(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(jx).forEach((n=>{jt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===Hx.IS_NONE&&(t.state=jx[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},jt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===jx[n]&&(t.state=Hx.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const $x={state:Hx.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function qx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$x,n),Ux.extend(e,t,n),Kx(e,t)}var Xx={newInstance:jt.newInstance(qx,"vtkInteractorStyle"),extend:qx,...Wx};const{States:Yx}=Wx;function Zx(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case Yx.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Yx.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==yx.RightController||n.input!==bx.Trigger&&n.input!==bx.TrackPad?!n||n.pressed||n.device!==yx.RightController||n.input!==bx.Trigger&&n.input!==bx.TrackPad||t.state!==Yx.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===Yx.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case Yx.IS_DOLLY:e.endDolly();break;case Yx.IS_PAN:e.endPan();break;case Yx.IS_SPIN:e.endSpin();break;case Yx.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const a=o[2],i=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+i[0]-s[0],o[1]+i[1]-s[1],a),c=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],a),u=[];u[0]=c[0]-l[0],u[1]=c[1]-l[1],u[2]=c[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(u[0]+o[0],u[1]+o[1],u[2]+o[2]),r.setPosition(u[0]+d[0],u[1]+d[1],u[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,a=n.y-t.previousPosition.y,i=r.getView().getViewportSize(e);let s=-.1,l=-.1;i[0]&&i[1]&&(s=-20/i[1],l=-20/i[0]);const c=o*l*t.motionFactor,u=a*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(c)||Number.isNaN(u)||(d.azimuth(c),d.elevation(u),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),a=r.getView().getViewportCenter(e),i=Ro(Math.atan2(t.previousPosition.y-a[1],t.previousPosition.x-a[0])),s=Ro(Math.atan2(n.y-a[1],n.x-a[0]))-i;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let a=o.getFocalPoint();a=e.computeWorldToDisplay(n,a[0],a[1],a[2]);const i=a[2],s=e.computeDisplayToWorld(n,r.x,r.y,i),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,i),c=[];c[0]=l[0]-s[0],c[1]=l[1]-s[1],c[2]=l[2]-s[2],a=o.getFocalPoint();const u=o.getPosition();o.setFocalPoint(c[0]+a[0],c[1]+a[1],c[2]+a[2]),o.setPosition(c[0]+u[0],c[1]+u[1],c[2]+u[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,a=t._interactor.getView().getViewportCenter(n),i=t.motionFactor*o/a[1];e.dollyByFactor(n,1.1**i)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const Qx={motionFactor:10,zoomFactor:10};function Jx(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qx,n),Xx.extend(e,t,n),jt.setGet(e,t,["motionFactor","zoomFactor"]),Zx(e,t)}var eT={newInstance:jt.newInstance(Jx,"vtkInteractorStyleTrackballCamera"),extend:Jx};function tT(e){return e}function nT(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>nT(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var rT=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?nT:tT,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n};function oT(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${jt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}const aT={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function iT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,aT,n),jt.obj(e,t),jt.get(e,t,["currentOperation"]),jt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),jt.moveToProtected(e,t,["currentParent"]),oT(e,t)}var sT={newInstance:jt.newInstance(iT,"vtkRenderPass"),extend:iT};const{Representation:lT}=ds,{vtkErrorMacro:cT}=jt;function uT(e){const t=dd.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function dT(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Es.newInstance({numberOfComponents:3,values:e});o.setName("points");const a=Es.newInstance({numberOfComponents:2,values:n});a.setName("tcoords");const i=Es.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(i,"polys",lT.SURFACE,{points:o,tcoords:a,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=$p.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=Fd.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=Fd.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=Fd.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||cT("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||cT("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const a=n.getSize(),i=n.getContext();if(t._supported=!1,r.getSelector()||!i||!n.getWebgl2()||!i.getExtension("EXT_color_buffer_half_float")&&!i.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==a[0]||r[1]!==a[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}i.drawBuffers([i.COLOR_ATTACHMENT0]),i.clearBufferfv(i.COLOR,0,[0,0,0,0]),i.clearBufferfv(i.DEPTH,0,[1]),i.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),i.colorMask(!0,!0,!0,!0),i.drawBuffers([i.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1]),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),i.clearBufferfv(i.COLOR,0,[0,0,0,1]),i.clearBufferfv(i.COLOR,1,[0,0,0,0]),i.enable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFuncSeparate(i.ONE,i.ONE,i.ZERO,i.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),i.drawBuffers([i.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=md.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?uT:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const pT={framebuffer:null,copyShader:null,tris:null};function fT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pT,n),sT.extend(e,t,n),t.VBOBuildTime={},jt.obj(t.VBOBuildTime,{mtime:0}),t.tris=xd.newInstance(),jt.get(e,t,["framebuffer"]),dT(e,t)}var gT={newInstance:jt.newInstance(fT,"vtkOpenGLOrderIndependentTranslucentPass"),extend:fT};function mT(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=$p.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),i.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),i.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),i.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=gT.newInstance()),t.translucentPass.traverse(n,i,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),i.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),i.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const hT={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function vT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hT,n),sT.extend(e,t,n),jt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),mT(e,t)}var yT={newInstance:jt.newInstance(vT,"vtkForwardPass"),extend:vT},bT=n(594),xT=n.n(bT);const TT=["lastShaderProgramBound","context","_openGLRenderWindow"];function CT(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=dd.substitute(o,"VSOut","GSOut").result);const a=t._openGLRenderWindow.getWebgl2();let i="\n",s="#version 100\n";a?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(i="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(i+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=dd.substitute(o,"//VTK::System::Dec",[`${s}\n`,a?"":"#extension GL_OES_standard_derivatives : enable\n",i,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=dd.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(a){l=dd.substitute(l,"varying","out").result,o=dd.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=dd.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=dd.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:dd.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),a=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(a)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,a=xT().hash(o);if(!(a in t.shaderPrograms)){const o=dd.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(a),t.shaderPrograms[a]=o,o}return t.shaderPrograms[a]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const ST={lastShaderProgramBound:null,shaderPrograms:null,context:null};function PT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ST,n),t.shaderPrograms={},jt.obj(e,t),jt.setGet(e,t,TT),jt.moveToProtected(e,t,["openGLRenderWindow"]),CT(e,t)}var AT={newInstance:jt.newInstance(PT,"vtkShaderCache"),extend:PT};const{vtkErrorMacro:IT}=jt;function wT(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OT,n),jt.obj(e,t),t.textureUnits=[],jt.get(e,t,["numberOfTextureUnits"]),jt.setGet(e,t,["context"]),wT(e,t)}var RT={newInstance:jt.newInstance(MT,"vtkOpenGLTextureUnitManager"),extend:MT};function VT(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),a=e.getFramebufferSize();return o[0]*a[0]<=t&&o[2]*a[0]>=t&&o[1]*a[1]<=n&&o[3]*a[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const a=o.worldToView(t,n,r),i=e.getViewportSize(o),s=o.viewToProjection(a[0],a[1],a[2],i[0]/i[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const a=e.displayToNormalizedDisplay(t,n,r),i=o.normalizedDisplayToProjection(a[0],a[1],a[2]),s=e.getViewportSize(o),l=o.projectionToView(i[0],i[1],i[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=e.normalizedDisplayToDisplay(t,n,r);return[i[0]-a[0]-.5,i[1]-a[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return a&&0!==a[0]&&0!==a[1]?[t/(a[0]-1),n/(a[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const a=e.getViewportSize(o);return[t*(a[0]-1),n*(a[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let a=o.getViewportByReference();a=e.normalizedDisplayToDisplay(a[0],a[1],0);const i=t+a[0]+.5,s=n+a[1]+.5;return e.displayToNormalizedDisplay(i,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{jt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{jt.vtkErrorMacro("not implemented")},e.createSelector=()=>{jt.vtkErrorMacro("not implemented")}}const ET={size:void 0,selector:void 0};function DT(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ET,n),t.size||(t.size=[300,300]),jt.getArray(e,t,["size"],2),jt.get(e,t,["selector"]),Zt.extend(e,t,n),VT(e,t)}var LT={newInstance:jt.newInstance(DT,"vtkRenderWindowViewNode"),extend:DT};const{vtkDebugMacro:BT,vtkErrorMacro:NT}=jt,kT={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function FT(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),a===e.FRAMEBUFFER_COMPLETE}let _T=0;const GT=[];function UT(){_T++,GT.forEach((e=>e(_T)))}function zT(){_T--,GT.forEach((e=>e(_T)))}function WT(e){e.preventDefault()}function HT(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(a=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(a,r[0]),t.apply(n,r))}));var a},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const a=n[t];return a?a(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",WT,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=RT.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&NT("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const a=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,a),a},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,BT("using webgl2"))),r||(BT("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=sT.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?NT("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case ys.CHAR:case ys.SIGNED_CHAR:case ys.UNSIGNED_CHAR:return 1;case n:case r:case ys.UNSIGNED_SHORT:case ys.SHORT:case ys.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case ys.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&ys.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&ys.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=kT,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),a=n.getExtension("WEBGL_debug_renderer_info"),i=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&FT(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&FT(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&FT(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&FT(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&FT(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&FT(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&FT(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&FT(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&FT(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&FT(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&FT(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&FT(n,n.RGB,n.FLOAT)?"RGB":"",r&&FT(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&FT(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&FT(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",i?n.getParameter(i.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",a&&n.getParameter(a.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",a&&n.getParameter(a.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],c={};for(;l.length;){const[e,t,n]=l.pop();t&&(c[t]={label:e,value:n})}return t._glInformation=c,c},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const a=t.canvas.getBoundingClientRect(),i=t.renderable;i.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=gf.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=jt.chain((function(){t.canvas.removeEventListener("webglcontextlost",WT),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,zT),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const a=e.setSize;e.setSize=(t,n)=>{const r=a(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const jT={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const KT=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jT,n),LT.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",UT(),t.selector||(t.selector=gf.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=ln.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",KT),t.shaderCache=AT.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=yT.newInstance(),jt.event(e,t,"imageReady"),jt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),jt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),HT(e,t)}),"vtkOpenGLRenderWindow");px("WebGL",KT);const $T=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function qT(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),a=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==a&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${a}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XT,n),yt(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],xt(e,t,["boundPipeline","colorTextureViews"]),Pt(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),qT(e,t)}var ZT={newInstance:Et(YT,"vtkWebGPURenderEncoder"),extend:YT};function QT(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=Py.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=Py.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(a)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=ZT.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const JT={renderEncoder:null,colorTexture:null,depthTexture:null};function eC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JT,n),sT.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),QT(e,t)}var tC={newInstance:jt.newInstance(eC,"vtkWebGPUOpaquePass"),extend:eC};function nC(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=Py.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=Py.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const a=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,a),t.fullScreenQuad=Oh.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=ZT.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=ZT.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const rC={colorTextureView:null,depthTextureView:null};function oC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rC,n),sT.extend(e,t,n),jt.setGet(e,t,["colorTextureView","depthTextureView"]),nC(e,t)}var aC={newInstance:jt.newInstance(oC,"vtkWebGPUOrderIndependentTranslucentPass"),extend:oC};const iC="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",sC=new Float64Array(16),lC=new Float64Array(16);function cC(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Zm.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let a=o.getCode();const i=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));a=Zm.substitute(a,"//VTK::Volume::CompositeCalls",i).result,a=Zm.substitute(a,"//VTK::Volume::TraverseCalls",s).result,a=Zm.substitute(a,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",a),t.SSBO.setAllInstancesFromArray("planeNormals",i),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",c),t.SSBO.setAllInstancesFromArray("ipScalarRange",u),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),f=new Float64Array(t.numRows),v=new Float64Array(t.numRows),y=new Float64Array(t.numRows),C=new Float64Array(t.numRows),S=new Float64Array(t.numRows),P=new Float64Array(t.numRows);let A=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const uC={volumes:null,rowLength:1024,lastVolumeLength:0};function dC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uC,n),Oh.extend(e,t,n),t.fragmentShaderTemplate=iC,t.UBO=hv.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=uv.newInstance({label:"volumeSSBO"}),t.componentSSBO=uv.newInstance({label:"componentSSBO"}),t.lutBuildTime={},jt.obj(t.lutBuildTime,{mtime:0}),cC(e,t)}var pC={newInstance:jt.newInstance(dC,"vtkWebGPUVolumePassFSQ"),extend:dC};const{Representation:fC}=ds,{BufferUsage:gC,PrimitiveTypes:mC}=ov,hC=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],vC="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function yC(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=pC.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=Oh.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=hv.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),a=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>a){const o=n.getRenderable().getActiveCamera().getPosition(),i=[];for(let e=0;ei[t]-i[e]));let l=[],c=s.length%a;for(let o=0;o=c&&(e.rayCastPass(r,n,l),l=[],c=a,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=jt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let a=t._colorTextureView.getTexture().getWidth(),i=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),a=t._smallViewportWidth,i=t._smallViewportHeight}o.getHandle().setViewport(0,0,a,i,0,1),o.getHandle().setScissorRect(0,0,a,i),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,a=o.getPoints(),i=o.getPolys();let s={hash:`vp${i.getMTime()}`,usage:gC.Index,cells:i,numberOfPoints:a.getNumberOfPoints(),primitiveType:mC.Triangles,representation:fC.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:gC.PointArray,format:"float32x4",hash:`vp${a.getMTime()}${i.getMTime()}`,dataArray:a,indexBuffer:l,packExtra:!0};const c=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(c,["vertexBC"]),t._mapper.setNumberOfVertices(c.getSizeInBytes()/c.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=ZT.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=Py.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=Py.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=Py.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=ZT.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=ZT.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=ZT.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bC,n),sT.extend(e,t,n),t._mapper=Ph.newInstance(),t._mapper.setFragmentShaderTemplate(vC),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=hu.newInstance(),t._lastMTimes=[],jt.setGet(e,t,["colorTextureView","depthTextureView"]),yC(e,t)}var TC={newInstance:jt.newInstance(xC,"vtkWebGPUVolumePass"),extend:xC};function CC(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=tC.newInstance());const o=n.getRenderable().getNumberOfLayers(),a=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=aC.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(i,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=TC.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(i,n)),e.finalPass(n,i))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=ZT.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=my.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=Oh.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=by.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const SC={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function PC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,SC,n),sT.extend(e,t,n),jt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),CC(e,t)}var AC={newInstance:jt.newInstance(PC,"vtkForwardPass"),extend:PC};const{VtkDataTypes:IC}=Es;function wC(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case IC.UNSIGNED_CHAR:e.format+="8unorm";break;case IC.FLOAT:case IC.UNSIGNED_INT:case IC.INT:case IC.DOUBLE:case IC.UNSIGNED_SHORT:case IC.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=Py.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const OC={handle:null,device:null};function MC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,OC,n),jt.obj(e,t),jt.setGet(e,t,["device"]),wC(e,t)}var RC={newInstance:jt.newInstance(MC),extend:MC};class VC extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function EC(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DC,n),yt(e,t),Pt(e,t,["handle"]),xt(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new VC,t.shaderCache=Zm.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=ov.newInstance(),t.bufferManager.setDevice(e),t.textureManager=RC.newInstance(),t.textureManager.setDevice(e),t.pipelines={},EC(e,t)}var BC={newInstance:Et(LC,"vtkWebGPUDevice"),extend:LC};function NC(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=Py.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=Py.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const a=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(a)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=ZT.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Zm.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const kC={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function FC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kC,n),sT.extend(e,t,n),jt.get(e,t,["colorTexture","depthTexture"]),NC(e,t)}var _C={newInstance:jt.newInstance(FC,"vtkWebGPUHardwareSelectionPass"),extend:FC};const{SelectionContent:GC,SelectionField:UC}=Zp,{FieldAssociations:zC}=al,{vtkErrorMacro:WC}=jt;function HC(e){return`${e.propID} ${e.compositeID}`}function jC(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function KC(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=jC(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let a=jC(t[0],t[1],e,1);if((a<0||a>16777215)&&(a=0),o.compositeID=a,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const a=[t[0],t[1]],i=[0,0];let s=KC(e,t,0,r);if(s)return s;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(i[1]=n,a[0]>=t&&(i[0]=a[0]-t,s=KC(e,i,0,r),s))return s;if(i[0]=a[0]+t,s=KC(e,i,0,r),s)return s}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(i[0]=n,a[1]>=t&&(i[1]=a[1]-t,s=KC(e,i,0,r),s))return s;if(i[1]=a[1]+t,s=KC(e,i,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function $C(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return WC("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),a=t._selectionPass.getColorTexture(),i=t._selectionPass.getDepthTexture(),s={area:[0,0,a.getWidth()-1,a.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:a.getWidth(),height:a.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=Lh.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const c=t._WebGPURenderWindow.getCommandEncoder();let u;c.copyTextureToBuffer({texture:a.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),u=Lh.newInstance({label:"hardwareSelectDepthBuffer"}),u.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,u.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),c.copyTextureToBuffer({texture:i.getHandle(),aspect:"depth-only"},{buffer:u.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(c);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=u.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(u.getMappedRange().slice()),u.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const a=Math.floor(t),i=Math.floor(n),s=Math.floor(r),l=Math.floor(o),c=new Map,u=[0,0];for(let t=i;t<=l;t++)for(let n=a;n<=s;n++){const r=KC(e,[n,t],0,u);if(r){const t=HC(r);if(c.has(t)){const n=c.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const i=Zp.newInstance();switch(i.setContentType(GC.INDICES),e){case zC.FIELD_ASSOCIATION_CELLS:i.setFieldType(UC.CELL);break;case zC.FIELD_ASSOCIATION_POINTS:i.setFieldType(UC.POINT);break;default:WC("Unknown field association")}i.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);i.getProperties().prop=s.getRenderable(),i.getProperties().compositeID=t.info.compositeID,i.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(i.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],i.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),i.setSelectionList(t.attributeIDs),r[o]=i,o++})),r}(e.fieldAssociation,c,e)}(s,e,t,n,r),s}}const qC={};function XC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qC,n),Wp.extend(e,t,n),t._selectionPass=_C.newInstance(),jt.setGet(e,t,["_WebGPURenderWindow"]),jt.moveToProtected(e,t,["WebGPURenderWindow"]),$C(e,t)}var YC={newInstance:jt.newInstance(XC,"vtkWebGPUHardwareSelector"),extend:XC};const{vtkErrorMacro:ZC}=jt,QC={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function JC(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ZC("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ZC("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=BC.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=sT.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const i=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==a?o||t.size.map((e=>e*a)):null},new Promise(((n,o)=>{const a=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=i,a.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=QC,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const a=await e.getPixelsAsync(),i=new ImageData(a.colorValues,a.width,a.height);o.putImageData(i,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=Lh.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const a=t.device.createCommandEncoder();a.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(a);const i=o.mapAsync(GPUMapMode.READ);await i,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=YC.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=jt.chain(e.delete,e.setViewStream)}const eS={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const tS=jt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eS,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",LT.extend(e,t,n),t.myFactory=Nm.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",tS),t.renderPasses[0]=AC.newInstance(),t.selector||(t.selector=YC.newInstance(),t.selector.setWebGPURenderWindow(e)),jt.event(e,t,"imageReady"),jt.event(e,t,"initialized"),jt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),jt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),jt.setGetArray(e,t,["size"],2),jt.event(e,t,"windowResizeEvent"),JC(e,t)}),"vtkWebGPURenderWindow");px("WebGPU",tS);const nS=rT();function rS(e,t){const n=e.invokeResize;delete e.invokeResize,t.renderWindow=vx.newInstance(),t.renderer=ux.newInstance(),t.renderWindow.addRenderer(t.renderer),t._apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(nS.viewAPI??t.defaultViewAPI),t.renderWindow.addView(t._apiSpecificRenderWindow),t.interactor=Bx.newInstance(),t.interactor.setInteractorStyle(eT.newInstance()),t.interactor.setView(t._apiSpecificRenderWindow),t.interactor.initialize(),e.setBackground=t.renderer.setBackground,e.setBackground(...t.background),e.resize=()=>{if(t.container){const e=t.container.getBoundingClientRect(),r=window.devicePixelRatio||1;t._apiSpecificRenderWindow.setSize(Math.floor(e.width*r),Math.floor(e.height*r)),n(),t.renderWindow.render()}},e.setContainer=e=>{t.container&&t.interactor.unbindEvents(t.container),t.container=e,t._apiSpecificRenderWindow.setContainer(t.container),t.container&&t.interactor.bindEvents(t.container)},e.delete=jt.chain(e.setContainer,t._apiSpecificRenderWindow.delete,e.delete),t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const oS={background:[.32,.34,.43],listenWindowResize:!0,container:null};function aS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oS,n),jt.obj(e,t),jt.get(e,t,["renderWindow","renderer","_apiSpecificRenderWindow","interactor","container"]),jt.moveToProtected(e,t,["_apiSpecificRenderWindow"]),jt.event(e,t,"resize"),rS(e,t)}var iS={newInstance:jt.newInstance(aS),extend:aS};function sS(e,t){t.classHierarchy.push("vtkAbstractImageMapper"),e.getIsOpaque=()=>!0,e.getCurrentImage=()=>null,e.getBoundsForSlice=()=>(jt.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),Na())}const lS={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1]};var cS=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lS,n),Fs(e,t,n),jt.setGet(e,t,["slice","useCustomExtents"]),jt.setGetArray(e,t,["customDisplayExtent"],6),jt.setGetArray(e,t,["backgroundColor"],4),sS(e,t)};function uS(e,t,n){const r=n.getCurrentImage(),o=r.getExtent(),a=[o[0],o[2],o[4]],{ijkMode:i}=n.getClosestIJKAxis();let s=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();i!==n.getSlicingMode()&&(s=n.getSliceAtPosition(s)),a[i]+=s;const l=[0,0,0];r.indexToWorld(a,l),a[i]+=1;const c=[0,0,0];r.indexToWorld(a,c),c[0]-=l[0],c[1]-=l[1],c[2]-=l[2],Rn(c,c);const u=ei.intersectWithLine(e,t,l,c);if(u.intersection){const e=u.x,t=[0,0,0];return r.worldToIndex(e,t),{t:u.t,absoluteIJK:t}}return null}const{staticOffsetAPI:dS,otherStaticMethods:pS}=Wl,{SlicingMode:fS}=ug;function gS(e,t){function n(){let n;switch(t.slicingMode){case fS.X:n=0;break;case fS.Y:n=1;break;case fS.Z:n=2;break;default:return void(t.closestIJKAxis={ijkMode:t.slicingMode,flip:!1})}const r=ka(e.getCurrentImage().getDirection());let o=0;for(;o<3&&0===r[n+3*o];++o);const a=r[n+3*o]<0;t.closestIJKAxis={ijkMode:o,flip:a}}t.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=n=>{const r=e.getCurrentImage();let o;if(3===n.length)o=n;else if(Number.isFinite(n)){const e=r.getBounds();switch(t.slicingMode){case fS.X:o=[n,(e[3]+e[2])/2,(e[5]+e[4])/2];break;case fS.Y:o=[(e[1]+e[0])/2,n,(e[5]+e[4])/2];break;case fS.Z:o=[(e[1]+e[0])/2,(e[3]+e[2])/2,n]}}const a=[0,0,0];r.worldToIndex(o,a);const i=r.getExtent(),{ijkMode:s}=e.getClosestIJKAxis();let l=0;switch(s){case fS.I:l=Ma(a[0],i[0],i[1]);break;case fS.J:l=Ma(a[1],i[2],i[3]);break;case fS.K:l=Ma(a[2],i[4],i[5]);break;default:return 0}return l},e.setSliceFromCamera=n=>{const r=n.getFocalPoint();switch(t.slicingMode){case fS.I:case fS.J:case fS.K:{const t=e.getSliceAtPosition(r);e.setSlice(t)}break;case fS.X:e.setSlice(r[0]);break;case fS.Y:e.setSlice(r[1]);break;case fS.Z:e.setSlice(r[2])}},e.setXSlice=t=>{e.setSlicingMode(fS.X),e.setSlice(t)},e.setYSlice=t=>{e.setSlicingMode(fS.Y),e.setSlice(t)},e.setZSlice=t=>{e.setSlicingMode(fS.Z),e.setSlice(t)},e.setISlice=t=>{e.setSlicingMode(fS.I),e.setSlice(t)},e.setJSlice=t=>{e.setSlicingMode(fS.J),e.setSlice(t)},e.setKSlice=t=>{e.setSlicingMode(fS.K),e.setSlice(t)},e.getSlicingModeNormal=()=>{const n=[0,0,0],r=e.getCurrentImage().getDirection();switch(t.slicingMode){case fS.X:n[0]=1;break;case fS.Y:n[1]=1;break;case fS.Z:n[2]=1;break;case fS.I:na(r,[1,0,0],n);break;case fS.J:na(r,[0,1,0],n);break;case fS.K:na(r,[0,0,1],n)}return n},e.setSlicingMode=r=>{t.slicingMode!==r&&(t.slicingMode=r,e.getCurrentImage()&&n(),e.modified())},e.getClosestIJKAxis=()=>(void 0!==t.closestIJKAxis&&t.closestIJKAxis.ijkMode!==fS.NONE||!e.getCurrentImage()||n(),t.closestIJKAxis),e.getBounds=()=>{const n=e.getCurrentImage();if(!n)return Na();if(!t.useCustomExtents)return n.getBounds();const r=t.customDisplayExtent.slice(),{ijkMode:o}=e.getClosestIJKAxis();let a=t.slice;switch(o!==t.slicingMode&&(a=e.getSliceAtPosition(t.slice)),o){case fS.I:r[0]=a,r[1]=a;break;case fS.J:r[2]=a,r[3]=a;break;case fS.K:r[4]=a,r[5]=a}return n.extentToBounds(r)},e.getBoundsForSlice=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slice,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const o=e.getCurrentImage();if(!o)return Na();const a=o.getSpatialExtent(),{ijkMode:i}=e.getClosestIJKAxis();let s=n;switch(i!==t.slicingMode&&(s=e.getSliceAtPosition(n)),i){case fS.I:a[0]=s-r,a[1]=s+r;break;case fS.J:a[2]=s-r,a[3]=s+r;break;case fS.K:a[4]=s-r,a[5]=s+r}return o.extentToBounds(a)},e.intersectWithLineForPointPicking=(t,n)=>function(e,t,n){const r=uS(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return t[0]e[1]||t[1]e[3]||t[2]e[5]?null:{t:r.t,ijk:t}}return null}(t,n,e),e.intersectWithLineForCellPicking=(t,n)=>function(e,t,n){const r=uS(e,t,n);if(r){const e=n.getCurrentImage().getExtent(),t=r.absoluteIJK,o=[Math.floor(t[0]),Math.floor(t[1]),Math.floor(t[2])];if(o[0]e[1]-1||o[1]e[3]-1||o[2](e[5]?e[5]-1:e[5]))return null;const a=[t[0]-o[0],t[1]-o[1],t[2]-o[2]];return{t:r.t,ijk:o,pCoords:a}}return null}(t,n,e),e.getCurrentImage=()=>e.getInputData()}const mS={slicingMode:fS.NONE,closestIJKAxis:{ijkMode:fS.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function hS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mS,n),cS(e,t,n),jt.get(e,t,["slicingMode"]),jt.setGet(e,t,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),Wl.implementCoincidentTopologyMethods(e,t),gS(e,t)}var vS={newInstance:jt.newInstance(hS,"vtkImageMapper"),extend:hS,...dS,...pS,...ug};const yS={CLAMP:0,REPEAT:1,MIRROR:2},bS={NEAREST:0,LINEAR:1,CUBIC:2};var xS={ImageBorderMode:yS,InterpolationMode:bS};const TS={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:yS.CLAMP,interpolationMode:bS.LINEAR,extraInfo:null},CS={...TS,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function SS(e){const t=Math.floor(e);return{floored:t,error:e-t}}function PS(e){return Math.round(e)}function AS(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function IS(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function wS(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let a=e-t;return a=a>=0?a:-a,a%=o,a=a<=r?a:o-a,a}const{ImageBorderMode:OS}=xS;function MS(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,a=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,a)}const i=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*i,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let c=t.componentOffset;c=c>0?c:0,c=c{},e.interpolateXYZ=(n,r,o,a)=>{let i=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=a>0?a:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,a)=>{}}const RS={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:OS.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...TS},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function VS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,RS,n),jt.obj(e,t),jt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),jt.get(e,t,["origin","spacing"]),MS(e,t)}var ES={newInstance:jt.newInstance(VS,"vtkAbstractImageInterpolator"),extend:VS,...xS};function DS(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===bS.LINEAR?n=2:t.interpolationMode===bS.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,a=e.numberOfComponents;let i=PS(t[0]),s=PS(t[1]),l=PS(t[2]);switch(e.borderMode){case yS.REPEAT:i=IS(i,r[0],r[1]),s=IS(s,r[2],r[3]),l=IS(l,r[4],r[5]);break;case yS.MIRROR:i=wS(i,r[0],r[1]),s=wS(s,r[2],r[3]),l=wS(l,r[4],r[5]);break;default:i=AS(i,r[0],r[1]),s=AS(s,r[2],r[3]),l=AS(l,r[4],r[5])}const c=i*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,a=e.numberOfComponents,i=SS(t[0]),s=SS(t[1]),l=SS(t[2]);let c=i.floored,u=s.floored,d=l.floored;const p=i.error,f=s.error,g=l.error;let m=c+(0!==p),h=u+(0!==f),v=d+(0!==g);switch(e.borderMode){case yS.REPEAT:c=IS(c,r[0],r[1]),u=IS(u,r[2],r[3]),d=IS(d,r[4],r[5]),m=IS(m,r[0],r[1]),h=IS(h,r[2],r[3]),v=IS(v,r[4],r[5]);break;case yS.MIRROR:c=wS(c,r[0],r[1]),u=wS(u,r[2],r[3]),d=wS(d,r[4],r[5]),m=wS(m,r[0],r[1]),h=wS(h,r[2],r[3]),v=wS(v,r[4],r[5]);break;default:c=AS(c,r[0],r[1]),u=AS(u,r[2],r[3]),d=AS(d,r[4],r[5]),m=AS(m,r[0],r[1]),h=AS(h,r[2],r[3]),v=AS(v,r[4],r[5])}const y=c*o[0],b=m*o[0],x=u*o[1],T=h*o[1],C=d*o[2],S=v*o[2],P=x+C,A=x+S,I=T+C,w=T+S,O=1-p,M=1-f,R=1-g,V=M*R,E=f*R,D=M*g,L=f*g,B=e.pointer;for(let e=0;e{switch(t.interpolationMode){case bS.LINEAR:e.interpolateLinear(n,r,o);break;case bS.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,a)=>{const i=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),c=e.pointer.subarray(s[0]+l[0]),u=e.numberOfComponents;for(let e=0;e{const i=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],c=t*i,u=n*s,d=r*l,p=e.weights[0].subarray(c),f=e.weights[1].subarray(u),g=e.weights[2].subarray(d),m=e.positions[0].subarray(c),h=e.positions[1].subarray(u),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=h.subarray(v[0]);let T=x,C=x,S=x,P=1,A=0,I=1,w=0;2===s&&(C=h[1].subarray(v[0]),S=C,P=f[0],A=f[1]),2===l&&(T=h[0].subarray(v[1]),S=T,I=g[0],w=g[1]),s+l===4&&(S=h[1].subarray(v[1]));const O=P*I,M=P*w,R=A*I,V=A*w;if(1===i)if(0===A&&0===w)for(let e=a;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],i=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],a=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case bS.LINEAR:e.interpolateRowLinear(n,r,o,a,i,s);break;case bS.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,a,i,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const a={...CS.newInstance(),...t.interpolationInfo};a.weightType="Float32Array";const i=a.interpolationMode;let s=!0;for(let l=0;l<3;++l){let c;for(c=0;c<3&&0===n[4*l+c];++c);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const u=a.extent[2*c],d=a.extent[2*c+1],p=t.structuredBounds[2*c],f=t.structuredBounds[2*c+1];let g=1;g=i1)if(i===bS.LINEAR)v[g*t+1-y]=T[1]*S,b[g*t-y]=1-h,b[g*t+1-y]=h;else if(i===bS.CUBIC){const n=e.vtkTricubicInterpWeights(h);if(4===g)for(let e=0;e<4;e++)v[g*t+e-y]=T[e]*S,b[g*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[T[t]-u]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const LS={interpolationMode:bS.NEAREST};function BS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,LS,n),ES.extend(e,t,n),jt.setGet(e,t,["interpolationMode"]),DS(e,t)}var NS={newInstance:jt.newInstance(BS,"vtkImageInterpolator"),extend:BS};function kS(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const a=e.getExtent();let i=n;null==i&&(i=a);let s,l,c,u=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(i[e],a[e]),t.extent[e+1]=Math.min(i[e+1],a[e+1]),t.extent[e]>t.extent[e+1]&&(u=!0);if(t.rowIncrement=a[1]-a[0]+1,t.sliceIncrement=t.rowIncrement*(a[3]-a[2]+1),u){s=0,l=0,c=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=a[e],t.extent[e+1]=a[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,c=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-a[0]+(t.extent[2]-a[2])*t.rowIncrement+(t.extent[4]-a[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*c-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const a=t.extent[4]-e[4];a<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=a*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&a>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*c;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let a;for(a=0;ae);++a)n=!n;t.spanIndex=a,t.inStencil=n;let i=t.extent[1]+1;a{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const FS={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function _S(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FS,n),jt.obj(e,t),jt.get(e,t,["id","index"]),kS(e,t)}var GS={newInstance:jt.newInstance(_S,"vtkImagePointDataIterator"),extend:_S};const US={MIN:0,MAX:1,MEAN:2,SUM:3};var zS={SlabMode:US};const{SlabMode:WS}=zS,{vtkErrorMacro:HS}=jt;function jS(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=g(new Float64Array(16));let o=null;function a(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=g(new Float64Array(16))),!ne(t.resliceAxes,n)&&(d(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,a)=>{const i=n[0];if(!i)return void HS("Invalid or missing input");const s=i.getOrigin(),l=i.getSpacing(),c=i.getDimensions(),u=i.getPointData().getScalars(),d=[0,c[0]-1,0,c[1]-1,0,c[2]-1],p=[0,0,0],f=[1,1,1],m=[0,0,0,0,0,0],v=[0,0,0],y=g(new Float64Array(16));t.resliceAxes&&b(y,y,t.resliceAxes);const x=new Float64Array(16);h(x,y);const T=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let C=null;t.autoCropOutput&&(C=e.getAutoCroppedOutputBounds(i));for(let e=0;e<3;e++){let n=0,r=0,o=0,a=0;if(t.transformInputSampling){let t=0;for(let i=0;i<3;i++){a+=x[4*i+e]*(T[i]-y[12+i]);const s=y[4*e+i]*y[4*e+i];n+=s*Math.abs(l[i]),r+=s*(d[2*i+1]-d[2*i])*Math.abs(l[i]),o+=s*d[2*i],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else a=T[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?f[e]=n:f[e]=t.outputSpacing[e],e>=t.outputDimensionality?(m[2*e]=0,m[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=C[2*e+1]-C[2*e]),m[2*e]=Math.round(o),m[2*e+1]=Math.round(m[2*e]+Math.abs(r/f[e]))):(m[2*e]=t.outputExtent[2*e],m[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=C[2*e]-m[2*e]*f[e]:p[e]=a-.5*(m[2*e]+m[2*e+1])*f[e]:p[e]=t.outputOrigin[e],v[e]=m[2*e+1]-m[2*e]+1}let S=u.getDataType();t.outputScalarType&&(S=t.outputScalarType);const P=i.getPointData().getScalars().getNumberOfComponents(),A=jt.newTypedArray(S,v[0]*v[1]*v[2]*P),I=Es.newInstance({name:"Scalars",values:A,numberOfComponents:P}),w=gl.newInstance();w.setDimensions(v),w.setOrigin(p),w.setSpacing(f),t.outputDirection&&w.setDirection(t.outputDirection),w.getPointData().setScalars(I),e.getIndexMatrix(i,w);let O=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,m)&&(O=bS.NEAREST)),t.interpolator.setInterpolationMode(O);let M=yS.CLAMP;M=t.wrap?yS.REPEAT:M,M=t.mirror?yS.MIRROR:M,t.interpolator.setBorderMode(M);const R=762939453125e-17;let V=.5*t.border;V=M===yS.CLAMP?V:4294967294,V=V>R?V:R,t.interpolator.setTolerance(V),t.interpolator.initialize(i),e.vtkImageResliceExecute(i,w),t.interpolator.releaseData(),a[0]=w},e.vtkImageResliceExecute=(n,a)=>{const i=n.getPointData().getScalars(),s=a.getPointData().getScalars();let l=s.getData();const c=a.getExtent(),u=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(u);let g=i.getData();const m=i.getDataType(),h=i.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],T=[0,0,0];T[0]=i.getNumberOfComponents(),T[1]=T[0]*b[0],T[2]=T[1]*b[1];const C=b[0]*b[1]*b[2];v>0&&v+hbS.LINEAR||d>1&&t.slabMode===WS.SUM,B=e.getConversionFunc(m,I,t.scalarShift,t.scalarScale,L),N=e.getSetPixelsFunc(I,1,w,l),k=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let F=c[2]-1,_=c[4]-1;const G=[0,0,0,0],U=[0,0,0,0],z=GS.newInstance();z.initialize(a,c,t.stencil,null);const W=z.getScalars(a,0);let H=0;const j=jt.newTypedArray(I,Fi.getDiagonalLength(c)*w*2),K=new Float64Array(h*d),$=new Float64Array(h);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(H=1*z.getId()*w,z.isInStencil()){const r=z.getIndex();r[2]>_&&(_=r[2],G[0]=V[0]+_*R[0],G[1]=V[1]+_*R[1],G[2]=V[2]+_*R[2],G[3]=V[3]+_*R[3],F=c[2]-1),r[1]>F&&(F=r[1],U[0]=G[0]+F*M[0],U[1]=G[1]+F*M[1],U[2]=G[2]+F*M[2],U[3]=G[3]+F*M[3]);const a=r[0],i=a+n-1;if(A){const e=g,t=l,n=1*T[0],r=1*T[1],o=1*T[2],s=x[1]-x[0]+1,c=x[3]-x[2]+1,u=x[5]-x[4]+1;let d=a,p=a-1,f=!1;const m=1*h;for(let t=a;t<=i;t++){const i=[U[0]+t*O[0],U[1]+t*O[1],U[2]+t*O[2]],l=PS(i[0])-x[0],g=PS(i[1])-x[2],h=PS(i[2])-x[4];if(l>=0&&l=0&&g=0&&h1){let e=n-.5*(d-1);e*=p,s[0]=i[0]+e*R[0],s[1]=i[1]+e*R[1],s[2]=i[2]+e*R[2],s[3]=i[3]+e*R[3],g=s}if(f){const e=1/g[3];g[0]*=e,g[1]*=e,g[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),a=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,g,n,a)}if(t.interpolator.checkBoundsIJK(g)){r=1,t.interpolator.interpolateIJK(g,$);for(let e=0;eh&&k(K,h,m/h);for(let e=0;ea?n:r}const g=l-1-(r!==n)-s+1;let m=0;n?(P&&e.rescaleScalars(E,h,i-a+1,t.scalarShift,t.scalarScale),m=B(j,E.subarray(s*h),w,g)):m=N(j,D,w,g);for(let e=0;e{const a=g(new Float64Array(16));return o=null,t.resliceAxes&&d(a,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?b(a,t.resliceTransform.getMatrix(),a):tt("Non homogeneous transform have not yet been ported")),b(a,a,n.getIndexToWorld()),null==o&&b(a,e.getWorldToIndex(),a),d(r,a),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),a=e.getDimensions(),i=[0,a[0]-1,0,a[1]-1,0,a[2]-1],s=new Float64Array(16);t.resliceAxes?h(s,t.resliceAxes):g(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let c=null;Ga.isIdentity3x3(o)||(c=_f().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const u=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+i[e%2]*r[0],d[1]=n[1]+i[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+i[4+Math.floor(e/4)%2]*r[2],d[3]=1,c&&Gi(d,d,c),t.resliceTransform&&l.transformPoint(d,d),Gi(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>u[2*e+1]&&(u[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,a)=>{const i=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let i=a;if(n!==ys.FLOAT&&n!==ys.DOUBLE&&!a){const a=e.getDataTypeMinMax(t);let s=(a.min+r)*o,l=(a.max+r)*o;const c=e.getDataTypeMinMax(n),u=c.min,d=c.max;if(s>l){const e=l;l=s,s=e}i=sd}if(i&&n!==ys.FLOAT&&n!==ys.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,a)=>e.clamp(n,r,o,a,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case WS.MIN:n=s;break;case WS.MAX:n=l;break;case WS.MEAN:n=t?u:c;break;case WS.SUM:n=t?f:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Gi(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const a=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],a=e[12+n];t[2*r]===t[2*r+1]&&(a+=o*t[2*n],o=0);const i=SS(o).error,s=SS(a).error;if(0!==i||0!==s)return!1}return!0}}const KS={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:bS.NEAREST,slabMode:WS.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:NS.newInstance(),usePermuteExecute:!1};function $S(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,KS,n),jt.obj(e,t),jt.algo(e,t,1,1),jt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),jt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),jt.setGetArray(e,t,["outputExtent"],6),jt.setGetArray(e,t,["outputDirection"],9),jt.setGetArray(e,t,["backgroundColor"],4),jt.get(e,t,["resliceAxes"]),jS(e,t)}var qS={newInstance:jt.newInstance($S,"vtkImageReslice"),extend:$S,...zS};const{InterpolationType:XS}=rg,{vtkErrorMacro:YS}=jt;function ZS(e,t){t.classHierarchy.push("vtkImageProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].piecewiseFunction&&(e=t.componentData[r].piecewiseFunction.getMTime(),n=n>e?n:e);return n},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].rGBTransferFunction!==a&&(t.componentData[o].rGBTransferFunction=a,e.modified(),!0)},e.getRGBTransferFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].rGBTransferFunction},e.setPiecewiseFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=n,a=r;return Number.isInteger(n)||(a=n,o=0),t.componentData[o].piecewiseFunction!==a&&(t.componentData[o].piecewiseFunction=a,e.modified(),!0)},e.getPiecewiseFunction=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.componentData[e].piecewiseFunction},e.setScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=t,o=n;return Number.isInteger(t)||(o=t,r=0),e.setPiecewiseFunction(r,o)},e.getScalarOpacity=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e.getPiecewiseFunction(t)},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return YS("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(YS("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(XS.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(XS.LINEAR),e.getInterpolationTypeAsString=()=>jt.enumToString(XS,t.interpolationType)}const QS={independentComponents:!1,interpolationType:XS.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function JS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,QS,n),jt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;e++)t.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}jt.setGet(e,t,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity"]),jt.setGetArray(e,t,["labelOutlineThickness"]),ZS(e,t)}var eP={newInstance:jt.newInstance(JS,"vtkImageProperty"),extend:JS};const{vtkDebugMacro:tP}=jt;function nP(e,t){t.classHierarchy.push("vtkImageSlice"),e.getActors=()=>e,e.getImages=()=>e,e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>!1,e.makeProperty=eP.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){tP("Recomputing bounds..."),t.mapperBounds=n.map((e=>e)),e.computeMatrix();const r=new Float64Array(16);m(r,t.matrix),Fi.transformBounds(n,r,t.bounds),t.boundsMTime.modified()}var r;return t.bounds},e.getBoundsForSlice=(n,r)=>{const o=t.mapper.getBoundsForSlice(n,r);if(!Fi.isValid(o))return o;e.computeMatrix();const a=new Float64Array(16);return m(a,t.matrix),Fi.transformBounds(o,a)},e.getMinXBound=()=>e.getBounds()[0],e.getMaxXBound=()=>e.getBounds()[1],e.getMinYBound=()=>e.getBounds()[2],e.getMaxYBound=()=>e.getBounds()[3],e.getMinZBound=()=>e.getBounds()[4],e.getMaxZBound=()=>e.getBounds()[5],e.getMTime=()=>{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}if(null!==t.property){let n=t.property.getMTime();e=n>e?n:e,null!==t.property.getRGBTransferFunction()&&(n=t.property.getRGBTransferFunction().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection()}const rP={mapper:null,property:null,bounds:[...Fi.INIT_BOUNDS]};function oP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rP,n),ts.extend(e,t,n),t.boundsMTime={},jt.obj(t.boundsMTime),jt.set(e,t,["property"]),jt.setGet(e,t,["mapper"]),jt.getArray(e,t,["bounds"],6),nP(e,t)}var aP={newInstance:jt.newInstance(oP,"vtkImageSlice"),extend:oP};function iP(e,t){t.classHierarchy.push("vtkInteractorStyleImage"),e.superHandleMouseMove=e.handleMouseMove,e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case zx.IS_WINDOW_LEVEL:e.windowLevel(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case zx.IS_SLICE:e.slice(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}e.superHandleMouseMove(n)},e.superHandleLeftButtonPress=e.handleLeftButtonPress,e.handleLeftButtonPress=n=>{const r=n.position;if(n.shiftKey||n.controlKey)"IMAGE3D"===t.interactionMode&&n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startRotate():"IMAGE_SLICING"===t.interactionMode&&n.controlKey?(t.lastSlicePosition=r.y,e.startSlice()):e.superHandleLeftButtonPress(n);else{t.windowLevelStartPosition[0]=r.x,t.windowLevelStartPosition[1]=r.y,e.setCurrentImageNumber(t.currentImageNumber);const n=t.currentImageProperty;n&&(t.windowLevelInitial[0]=n.getColorWindow(),t.windowLevelInitial[1]=n.getColorLevel()),e.startWindowLevel()}},e.superHandleLeftButtonRelease=e.handleLeftButtonRelease,e.handleLeftButtonRelease=()=>{switch(t.state){case zx.IS_WINDOW_LEVEL:e.endWindowLevel();break;case zx.IS_SLICE:e.endSlice();break;default:e.superHandleLeftButtonRelease()}},e.handleStartMouseWheel=()=>{e.startSlice()},e.handleEndMouseWheel=()=>{e.endSlice()},e.handleMouseWheel=e=>{const t=e.pokedRenderer.getActiveCamera();let n=t.getDistance();n+=e.spinY;const r=t.getClippingRange();nr[1]&&(n=r[1]),t.setDistance(n),e.pokedRenderer.getViewProps().filter((e=>e.isA("vtkImageSlice"))).forEach((t=>{if(t.getMapper().isA("vtkImageResliceMapper")){const n=t.getMapper().getSlicePlane();n&&(n.push(e.spinY),n.modified(),t.getMapper().modified())}}))},e.windowLevel=(e,n)=>{t.windowLevelCurrentPosition[0]=n.x,t.windowLevelCurrentPosition[1]=n.y;const r=t._interactor;if(t.currentImageProperty){const n=r.getView().getViewportSize(e),o=t.windowLevelInitial[0],a=t.windowLevelInitial[1];let i=4*(t.windowLevelCurrentPosition[0]-t.windowLevelStartPosition[0])/n[0],s=4*(t.windowLevelStartPosition[1]-t.windowLevelCurrentPosition[1])/n[1];Math.abs(o)>.01?i*=o:i*=o<0?-.01:.01,Math.abs(a)>.01?s*=a:s*=a<0?-.01:.01,o<0&&(i*=-1),a<0&&(s*=-1);let l=i+o;const c=a-s;l<.01&&(l=.01),t.currentImageProperty.setColorWindow(l),t.currentImageProperty.setColorLevel(c)}},e.slice=(e,n)=>{const r=t._interactor,o=n.y-t.lastSlicePosition,a=e.getActiveCamera(),i=a.getClippingRange();let s=a.getDistance(),l=0;if(a.getParallelProjection())l=2*a.getParallelScale();else{const e=Mo(a.getViewAngle());l=2*s*Math.tan(.5*e)}s+=o*l/r.getView().getViewportSize(e)[1],si[1]&&(s=i[1]-.001*l),a.setDistance(s),t.lastSlicePosition=n.y},e.setCurrentImageNumber=n=>{if(null===n)return;const r=t._interactor.getCurrentRenderer();if(!r)return;t.currentImageNumber=n;const o=r.getViewProps().filter((e=>e.isA("vtkImageSlice")));let a=n;n<0&&(a+=o.length);const i=o.find(((e,t)=>function(e,t,n){return e===n&&t.getNestedPickable()}(t,e,a)));i&&e.setCurrentImageProperty(i.getProperty())},e.setCurrentImageProperty=e=>{t.currentImageProperty=e}}const sP={windowLevelStartPosition:[0,0],windowLevelCurrentPosition:[0,0],lastSlicePosition:0,windowLevelInitial:[1,.5],currentImageNumber:-1,interactionMode:"IMAGE2D",xViewRightVector:[0,1,0],xViewUpVector:[0,0,-1],yViewRightVector:[1,0,0],yViewUpVector:[0,0,-1],zViewRightVector:[1,0,0],zViewUpVector:[0,1,0]};function lP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sP,n),eT.extend(e,t,n),jt.setGet(e,t,["interactionMode"]),jt.get(e,t,["currentImageProperty"]),iP(e,t)}var cP={newInstance:jt.newInstance(lP,"vtkInteractorStyleImage"),extend:lP};const{vtkErrorMacro:uP}=jt,dP=[0,2,4,1,2,4,0,3,4,1,3,4,0,2,5,1,2,5,0,3,5,1,3,5],pP=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7];function fP(e,t){t.classHierarchy.push("vtkOutlineFilter"),e.requestData=(e,t)=>{const n=e[0];if(!n)return void uP("Invalid or missing input");const r=n.getBounds(),o=hu.newInstance();o.getPoints().setData(Float32Array.from(dP.map((e=>r[e]))),3),o.getLines().setData(Uint16Array.from(pP)),t[0]=o}}const gP={};function mP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gP,n),jt.obj(e,t),jt.algo(e,t,1,1),fP(e,t)}var hP={newInstance:jt.newInstance(mP,"vtkOutlineFilter"),extend:mP,BOUNDS_MAP:dP,LINE_ARRAY:pP},vP={Corners:{TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"}};const{vtkErrorMacro:yP}=jt,{Corners:bP}=vP;function xP(e,t){t.classHierarchy.push("vtkOrientationMarkerWidget");const n={...e},r=[],o=ux.newInstance(),a=new ResizeObserver((t=>{e.updateViewport()}));let i=null,s=null,l=null,c=null,u=null;function d(){t._interactor.isAnimating()||e.updateMarkerOrientation()}t._onParentRendererChanged=()=>e.updateViewport(),e.computeViewport=()=>{const e=t.parentRenderer||t._interactor.getCurrentRenderer(),[n,r,o,a]=e.getViewport(),i=t._interactor.getView(),s=i.getSize(),[l,c]=i.getViewportSize(e),u=Math.min(l,c);let d=t.viewportSize*u;d=Math.max(Math.min(t.minPixelSize,u),Math.min(t.maxPixelSize,d));const p=d/s[0],f=d/s[1];switch(t.viewportCorner){case bP.TOP_LEFT:return[n,a-f,n+p,a];case bP.TOP_RIGHT:return[o-p,a-f,o,a];case bP.BOTTOM_LEFT:return[n,r,n+p,r+f];case bP.BOTTOM_RIGHT:return[o-p,r,o,r+f];default:return yP("Invalid widget corner"),null}},e.updateViewport=()=>{t.enabled&&(o.setViewport(...e.computeViewport()),t._interactor.render())},e.updateMarkerOrientation=()=>{const e=(t.parentRenderer||t._interactor.getCurrentRenderer()).getActiveCamera();if(!e)return;const n=e.getReferenceByName("position"),a=e.getReferenceByName("focalPoint"),i=e.getReferenceByName("viewUp");if(r[0]!==n[0]||r[1]!==n[1]||r[2]!==n[2]||r[3]!==a[0]||r[4]!==a[1]||r[5]!==a[2]||r[6]!==i[0]||r[7]!==i[1]||r[8]!==i[2]){r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=a[0],r[4]=a[1],r[5]=a[2],r[6]=i[0],r[7]=i[1],r[8]=i[2];const e=o.getActiveCamera();e.setPosition(n[0],n[1],n[2]),e.setFocalPoint(a[0],a[1],a[2]),e.setViewUp(i[0],i[1],i[2]),o.resetCamera()}},e.setEnabled=n=>{if(n){if(t.enabled)return;if(!t.actor)return void yP("Must set actor before enabling orientation marker.");if(!t._interactor)return void yP("Must set interactor before enabling orientation marker.");const n=t.parentRenderer||t._interactor.getCurrentRenderer(),r=n.getRenderWindow();r.addRenderer(o),r.getNumberOfLayers()<2&&r.setNumberOfLayers(2),o.setLayer(r.getNumberOfLayers()-1),o.setInteractive(!1),o.addViewProp(t.actor),t.actor.setVisibility(!0),i=n.onEvent((e=>{"ActiveCameraEvent"===e.type&&(s&&s.unsubscribe(),s=e.camera.onModified(d))})),s=n.getActiveCamera().onModified(d),l=t._interactor.onAnimation(e.updateMarkerOrientation),c=t._interactor.onEndAnimation(e.updateMarkerOrientation),a.observe(t._interactor.getView().getCanvas()),e.updateViewport(),e.updateMarkerOrientation(),t.enabled=!0}else{if(!t.enabled)return;t.enabled=!1,a.disconnect(),i.unsubscribe(),i=null,s.unsubscribe(),s=null,l.unsubscribe(),l=null,c.unsubscribe(),c=null,t.actor.setVisibility(!1),o.removeViewProp(t.actor);const e=t._interactor?.findPokedRenderer()?.getRenderWindow();e&&e.removeRenderer(o)}e.modified()},e.setViewportCorner=n=>{n!==t.viewportCorner&&(t.viewportCorner=n,e.updateViewport())},e.setViewportSize=n=>{const r=Math.min(1,Math.max(0,n));r!==t.viewportSize&&(t.viewportSize=r,e.updateViewport())},e.setActor=n=>{const r=t.enabled;e.setEnabled(!1),t.actor=n,e.setEnabled(r)},e.getRenderer=()=>o,e.delete=()=>{n.delete(),u&&(u.unsubscribe(),u=null),i&&(i.unsubscribe(),i=null),s&&(s.unsubscribe(),s=null),l&&(l.unsubscribe(),l=null),c&&(c.unsubscribe(),c=null),a.disconnect()},u=e.onModified(e.updateViewport)}const TP={viewportCorner:vP.Corners.BOTTOM_LEFT,viewportSize:.2,minPixelSize:50,maxPixelSize:200,parentRenderer:null};function CP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TP,n),jt.obj(e,t),jt.get(e,t,["enabled","viewportCorner","viewportSize"]),jt.setGet(e,t,["_interactor","minPixelSize","maxPixelSize","parentRenderer"]),jt.get(e,t,["actor"]),jt.moveToProtected(e,t,["interactor"]),xP(e,t)}var SP={newInstance:jt.newInstance(CP,"vtkOrientationMarkerWidget"),extend:CP,...vP};const PP={DEFAULT:0,GEOMETRY:1,SLICE:2,VOLUME:3,YZ_PLANE:4,XZ_PLANE:5,XY_PLANE:6},AP={PICKING_BUFFER:0,FRONT_BUFFER:1},IP={MOUSE_MOVE:0,MOUSE_RELEASE:1};var wP={ViewTypes:PP,RenderingTypes:AP,CaptureOn:IP};function OP(e,t){t.classHierarchy.push("vtkAbstractWidget"),t.actorToRepresentationMap=new WeakMap,e.getBounds=t.widgetState.getBounds,e.getNestedProps=()=>t.representations,e.activateHandle=n=>{let{selectedState:r,representation:o}=n;t.widgetState.activateOnly(r),t.activeState=r,r&&r.updateManipulator&&r.updateManipulator(),e.invokeActivateHandle({selectedState:r,representation:o}),e.updateCursor&&e.updateCursor()},e.deactivateAllHandles=()=>{t.widgetState.deactivate()},e.hasActor=e=>t.actorToRepresentationMap.has(e),e.grabFocus=()=>{t.hasFocus=!0},e.loseFocus=()=>{t.hasFocus=!1},e.hasFocus=()=>t.hasFocus,e.placeWidget=e=>t.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e),e.getRepresentationFromActor=e=>t.actorToRepresentationMap.get(e),e.updateRepresentationForRender=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:AP.FRONT_BUFFER;for(let n=0;nt._factory.getViewWidgets(),e.setPriority(.5)}const MP={contextVisibility:!0,handleVisibility:!0,hasFocus:!1};function RP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,MP,n),Zi.extend(e,t,n),Ux.extend(e,t,n),jt.setGet(e,t,["contextVisibility","handleVisibility","_widgetManager"]),jt.get(e,t,["representations","widgetState","activeState"]),jt.moveToProtected(e,t,["widgetManager"]),jt.event(e,t,"ActivateHandle"),OP(e,t)}var VP={newInstance:jt.newInstance(RP,"vtkAbstractWidget"),extend:RP};const{ViewTypes:EP,RenderingTypes:DP,CaptureOn:LP}=wP,{vtkErrorMacro:BP}=jt;let NP=1;function kP(e){const t=e.getActiveCamera(),n=e.getRenderWindow(),r=n.getInteractor(),o=r.getView();return{renderer:e,renderWindow:n,interactor:r,apiSpecificRenderWindow:o,camera:t}}function FP(e,t){const{dispHeightFactor:n,cameraPosition:r,cameraDir:o,isParallel:a,rendererPixelDims:i}=t;let s=1;if(a)s=n;else{const t=[...e];Ga.subtract(t,r,t),s=Ga.dot(t,o)*n}return s/i[1]}function _P(e,t){t.viewId||(t.viewId="view-"+NP++),t.classHierarchy.push("vtkWidgetManager");const n=new WeakMap,r=[];function o(e){return e&&(e.isA("vtkAbstractWidget")?e:e.getWidgetForView({viewId:t.viewId}))}function a(){const{_apiSpecificRenderWindow:e,_camera:n,_renderer:r}=t;if(r&&e&&n){const[o,a]=e.getSize(),[i,s,l,c]=r.getViewport(),u=e.getComputedDevicePixelRatio(),d=[o*(l-i)/u,a*(c-s)/u],p=n.getPosition(),f=n.getDirectionOfProjection(),g=n.getParallelProjection(),m=g?2*n.getParallelScale():2*Math.tan(Ga.radiansFromDegrees(n.getViewAngle())/2);t.widgets.forEach((e=>{e.getNestedProps().forEach((e=>{e.getScaleInPixels()&&e.setDisplayScaleParams({dispHeightFactor:m,cameraPosition:p,cameraDir:f,isParallel:g,rendererPixelDims:d})}))}))}}async function i(n,r,o){const{position:a}=n,{requestCount:i,selectedState:s,representation:l,widget:c}=await e.getSelectedDataForXY(a.x,a.y);if(i||o!==t._currentUpdateSelectionCallID)return;function u(e){r&&t._interactor.invokeLeftButtonRelease(n),e.activateHandle({selectedState:s,representation:l}),r&&t._interactor.invokeLeftButtonPress(n)}t._apiSpecificRenderWindow.setCursor(c?"pointer":"default"),t.activeWidget=null;let d=!1;if(t.widgetInFocus===c&&c.hasFocus())u(c),t.activeWidget=c,d=!0;else for(let e=0;e1&&void 0!==arguments[1]&&arguments[1];if(!t.isAnimating&&t.pickingEnabled&&e.pokedRenderer===t._renderer){const r=Symbol("UpdateSelection");t._currentUpdateSelectionCallID=r,await i(e,n,r)}};function l(e){e.updateRepresentationForRender(t.renderingType)}function c(){t.renderingType=DP.FRONT_BUFFER,t.widgets.forEach(l)}async function u(e,n,r,o){t._captureInProgress?await t._captureInProgress:(t.renderingType=DP.PICKING_BUFFER,t.widgets.forEach(l),t._capturedBuffers=null,t._captureInProgress=t._selector.getSourceDataAsync(t._renderer,e,n,r,o),t._capturedBuffers=await t._captureInProgress,t._captureInProgress=null,t.previousSelectedData=null,c())}function d(e){t._renderer.removeActor(e),e.delete()}function p(){t._renderer.getRenderWindow().getInteractor().render(),e.renderWidgets()}e.enablePicking=()=>{t.pickingEnabled=!0,e.renderWidgets()},e.renderWidgets=()=>{if(t.pickingEnabled&&t.captureOn===LP.MOUSE_RELEASE){const[e,n]=t._apiSpecificRenderWindow.getSize();u(0,0,e,n)}c(),e.modified()},e.disablePicking=()=>{t.pickingEnabled=!1},e.setRenderer=n=>{const o=kP(n);for(Object.assign(t,o),jt.moveToProtected({},t,Object.keys(o));r.length;)r.pop().unsubscribe();t._selector=t._apiSpecificRenderWindow.createSelector(),t._selector.setFieldAssociation(Js.FIELD_ASSOCIATION_POINTS),r.push(t._apiSpecificRenderWindow.onWindowResizeEvent(a)),r.push(t._camera.onModified(a)),a(),r.push(t._interactor.onStartAnimation((()=>{t.isAnimating=!0}))),r.push(t._interactor.onEndAnimation((()=>{t.isAnimating=!1,e.renderWidgets()}))),r.push(t._interactor.onMouseMove((e=>(s(e),jt.VOID)))),r.push(t._interactor.onLeftButtonPress((e=>{const{deviceType:t}=e,n="touch"===t||"pen"===t;return n&&s(e,n),jt.VOID}),.25)),e.modified(),t.pickingEnabled&&e.enablePicking()},e.addWidget=(r,o,i)=>{if(!t._renderer)return BP("Widget manager MUST BE link to a view before registering widgets"),null;const{viewId:s,_renderer:l}=t,c=r.getWidgetForView({viewId:s,renderer:l,viewType:o||EP.DEFAULT,initialValues:i});return null!=c&&-1===t.widgets.indexOf(c)&&(t.widgets.push(c),(u=c).setWidgetManager(e),function(e){const t=e.getRepresentations();for(let r=0;r{t.widgets.forEach(d),t.widgets=[],t.widgetInFocus=null,p()},e.removeWidget=n=>{const r=o(n),a=t.widgets.indexOf(r);-1!==a&&(t.widgets.splice(a,1),t.widgetInFocus===r&&e.releaseFocus(),d(r),p())},e.getSelectedDataForXY=async(n,r)=>{if(t.selections=null,t.pickingEnabled){if(t._capturedBuffers&&t.captureOn!==LP.MOUSE_MOVE){const e=t._capturedBuffers.area;(ne[2]||re[3])&&await u(n,r,n,r)}else await u(n,r,n,r);t.selections=t._capturedBuffers.generateSelection(n,r,n,r)}return e.getSelectedData()},e.getSelectedData=()=>{if(!t.selections||!t.selections.length)return t.previousSelectedData=null,{};const{propID:e,compositeID:r,prop:o}=t.selections[0].getProperties();let{widget:a,representation:i}=t.selections[0].getProperties();if(t.previousSelectedData&&t.previousSelectedData.prop===o&&t.previousSelectedData.widget===a&&t.previousSelectedData.compositeID===r)return t.previousSelectedData.requestCount++,t.previousSelectedData;if(n.has(o)){const e=n.get(o);a=e.widget,i=e.representation}if(a&&i){const n=i.getSelectedState(o,r);return t.previousSelectedData={requestCount:0,propID:e,compositeID:r,prop:o,widget:a,representation:i,selectedState:n},t.previousSelectedData}return t.previousSelectedData=null,{}},e.grabFocus=e=>{const n=o(e);t.widgetInFocus&&t.widgetInFocus!==n&&t.widgetInFocus.loseFocus(),t.widgetInFocus=n,t.widgetInFocus&&t.widgetInFocus.grabFocus()},e.releaseFocus=()=>e.grabFocus(null);const f=e.delete;e.delete=()=>{for(;r.length;)r.pop().unsubscribe();f()}}const GP={viewId:null,widgets:[],activeWidget:null,renderer:null,viewType:EP.DEFAULT,isAnimating:!1,pickingEnabled:!0,selections:null,previousSelectedData:null,widgetInFocus:null,captureOn:LP.MOUSE_MOVE};function UP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,GP,n),jt.obj(e,t),jt.setGet(e,t,["captureOn",{type:"enum",name:"viewType",enum:EP}]),jt.get(e,t,["selections","widgets","viewId","pickingEnabled","activeWidget"]),_P(e,t)}var zP={newInstance:jt.newInstance(UP,"vtkWidgetManager"),extend:UP,Constants:wP,getPixelWorldHeightAtCoord:FP};function WP(){}function HP(e,t){t.classHierarchy.push("vtkAbstractWidgetFactory");const n={};e.getWidgetForView=r=>{let{viewId:o,renderer:a,viewType:i,initialValues:s}=r;if(!n[o]){if(!a)return null;const{interactor:r,apiSpecificRenderWindow:l,camera:c}=kP(a),u={},d={};jt.obj(d,u),Object.assign(d,{onWidgetChange:e.onWidgetChange}),Object.assign(u,{widgetState:t.widgetState,manipulator:t.manipulator,viewType:i,renderer:a,camera:c,apiSpecificRenderWindow:l,factory:e}),jt.moveToProtected(d,u,["renderer","camera","apiSpecificRenderWindow","factory"]),jt.get(d,u,["viewType"]),jt.safeArrays(u),VP.extend(d,u,s);const p=s;u.representations=e.getRepresentationsForViewType(i).map((e=>{let{builder:t,labels:n,initialValues:r}=e;return t.newInstance({_parentProp:d,labels:n,...r,...p})})),u.representations.forEach((e=>{e.setInputData(u.widgetState),e.getActors().forEach((t=>{u.actorToRepresentationMap.set(t,e)}))})),t.behavior(d,u),["coincidentTopologyParameters",...t.methodsToLink||[]].forEach((e=>{const t=`set${jt.capitalize(e)}`,n=`get${jt.capitalize(e)}`,r={[e]:[],[t]:[],[n]:[]};u.representations.forEach((o=>{o[e]&&r[e].push(o[e]),o[t]&&r[t].push(o[t]),o[n]&&r[n].push(o[n])})),Object.keys(r).forEach((e=>{const t=r[e];1===t.length?d[e]=t[0]:t.length>1&&(d[e]=jt.chain(...t))}))})),d.delete=jt.chain((()=>{delete n[o]}),d.delete),d.setInteractor(r);const f=Object.freeze(d);return n[o]=f,f}return n[o]},e.getViewIds=()=>Object.keys(n),e.getViewWidgets=()=>Object.values(n),e.setVisibility=e=>{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;r{const t=Object.keys(n);for(let r=0;rt.widgetState.placeWidget(e),e.getPlaceFactor=()=>t.widgetState.getPlaceFactor(),e.setPlaceFactor=e=>t.widgetState.setPlaceFactor(e);let r=WP;e.delete=jt.chain(e.delete,(()=>r())),t.widgetState&&(r=t.widgetState.onModified((()=>e.invokeWidgetChange(t.widgetState))).unsubscribe)}function jP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,n),jt.obj(e,t),jt.get(e,t,["widgetState"]),jt.event(e,t,"WidgetChange"),HP(e,t)}var KP={newInstance:jt.newInstance(jP,"vtkAbstractWidget"),extend:jP};const{vtkWarningMacro:$P}=jt;function qP(e,t){t.classHierarchy.push("vtkPlaneSource"),e.requestData=(n,r)=>{if(t.deleted)return;const o=r[0],a=o?o.getPoints().getDataType():t.pointType,i=hu.newInstance(),s=[],l=[];if(zo(t.point1,t.origin,s),zo(t.point2,t.origin,l),!e.updatePlane(s,l))return void $P("Bad plane definition");const c=t.xResolution,u=t.yResolution,d=(c+1)*(u+1),p=c*u,f=jt.newTypedArray(a,3*d);i.getPoints().setData(f,3);const g=new Uint32Array(5*p);i.getPolys().setData(g,1);const m=new Float32Array(3*d),h=Es.newInstance({numberOfComponents:3,values:m,name:"Normals"});i.getPointData().setNormals(h);const v=new Float32Array(2*d),y=Es.newInstance({numberOfComponents:2,values:v,name:"TextureCoordinates"});i.getPointData().setTCoords(y);const b=new Float32Array(2);let x=0;for(let e=0;e{if(Math.abs(n)<1e-6)return;const o=g(new Float64Array(16)),a=[];var i,s;i=a,s=t.center,i[0]=-s[0],i[1]=-s[1],i[2]=-s[2],x(o,o,t.center),C(o,o,n,r),x(o,o,a),Dn(t.origin,t.origin,o),Dn(t.point1,t.point1,o),Dn(t.point2,t.point2,o),_f().rotate(n,r).apply(t.normal),e.modified()},e.setCenter=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.center)){const r=[];zo(t.point1,t.origin,r);const o=[];zo(t.point2,t.origin,o);for(let e=0;e<3;e++)t.center[e]=n[e],t.origin[e]=t.center[e]-.5*(r[e]+o[e]),t.point1[e]=t.origin[e]+r[e],t.point2[e]=t.origin[e]+o[e];e.modified()}},e.setPoint1=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.point1)){const r=[],o=[];t.point1=[...n],zo(t.point1,t.origin,r),zo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.setPoint2=function(){let n=[];if(1===arguments.length||Array.isArray(arguments.length<=0?void 0:arguments[0])?n=[...arguments.length<=0?void 0:arguments[0]]:3===arguments.length&&(n=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]]),!Bn(n,t.point2)){const r=[],o=[];t.point2=[...n],zo(t.point1,t.origin,r),zo(t.point2,t.origin,o),e.updatePlane(r,o),e.modified()}},e.updatePlane=(e,n)=>{for(let r=0;r<3;r++)t.center[r]=t.origin[r]+.5*(e[r]+n[r]);return $o(e,n,t.normal),0!==Xo(t.normal)}}const XP={xResolution:10,yResolution:10,origin:[0,0,0],point1:[1,0,0],point2:[0,1,0],pointType:"Float64Array"};function YP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XP,n),t.normal=[0,0,1],t.center=[0,0,0],jt.obj(e,t),jt.setGet(e,t,["xResolution","yResolution"]),jt.setGetArray(e,t,["origin"],3),jt.getArray(e,t,["point1","point2","normal","center"],3),jt.algo(e,t,0,1),qP(e,t),e.setPoint1(t.point1),e.setPoint2(t.point2)}var ZP={newInstance:jt.newInstance(YP,"vtkPlaneSource"),extend:YP};function QP(e,t){t.classHierarchy.push("vtkAbstractManipulator"),e.getOrigin=e=>t.userOrigin?t.userOrigin:t.useCameraFocalPoint?e.pokedRenderer.getActiveCamera().getFocalPoint():t.handleOrigin?t.handleOrigin:t.widgetOrigin?t.widgetOrigin:[0,0,0],e.getNormal=e=>t.userNormal?t.userNormal:t.useCameraNormal?e.pokedRenderer.getActiveCamera().getDirectionOfProjection():t.handleNormal?t.handleNormal:t.widgetNormal?t.widgetNormal:[0,0,1]}const JP={useCameraFocalPoint:!1,useCameraNormal:!1};function eA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JP,n),jt.obj(e,t),jt.setGet(e,t,["useCameraFocalPoint","useCameraNormal"]),jt.setGetArray(e,t,["userOrigin","handleOrigin","widgetOrigin","userNormal","handleNormal","widgetNormal"],3),QP(e,t)}var tA={extend:eA,newInstance:jt.newInstance(eA,"vtkAbstractManipulator")};function nA(e,t,n,r,o,a){const i=a.displayToWorld(e,t,0,o),s=a.displayToWorld(e,t,1,o);return ei.intersectWithLine(i,s,n,r).x}function rA(e,t){t.classHierarchy.push("vtkPlaneManipulator"),e.handleEvent=(t,n)=>({worldCoords:nA(t.position.x,t.position.y,e.getOrigin(t),e.getNormal(t),t.pokedRenderer,n)})}function oA(e){return{...e}}function aA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};tA.extend(e,t,oA(n)),rA(e,t)}var iA={intersectDisplayWithPlane:nA,extend:aA,newInstance:jt.newInstance(aA,"vtkPlaneManipulator")};const sA={DIRECTION:0,ROTATION:1,MATRIX:2};var lA={OrientationModes:sA,ScaleModes:{SCALE_BY_CONSTANT:0,SCALE_BY_MAGNITUDE:1,SCALE_BY_COMPONENTS:2}};const{OrientationModes:cA,ScaleModes:uA}=lA,{vtkErrorMacro:dA}=jt;function pA(e,t){t.classHierarchy.push("vtkGlyph3DMapper"),e.getOrientationModeAsString=()=>jt.enumToString(cA,t.orientationMode),e.setOrientationModeToDirection=()=>e.setOrientationMode(cA.DIRECTION),e.setOrientationModeToRotation=()=>e.setOrientationMode(cA.ROTATION),e.setOrientationModeToMatrix=()=>e.setOrientationMode(cA.MATRIX),e.getOrientationArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.orientationArray?n.getPointData().getArray(t.orientationArray):n.getPointData().getVectors():null},e.getScaleModeAsString=()=>jt.enumToString(uA,t.scaleMode),e.setScaleModeToScaleByMagnitude=()=>e.setScaleMode(uA.SCALE_BY_MAGNITUDE),e.setScaleModeToScaleByComponents=()=>e.setScaleMode(uA.SCALE_BY_COMPONENTS),e.setScaleModeToScaleByConstant=()=>e.setScaleMode(uA.SCALE_BY_CONSTANT),e.getScaleArrayData=()=>{const n=e.getInputData(0);return n&&n.getPointData()?t.scaleArray?n.getPointData().getArray(t.scaleArray):n.getPointData().getScalars():null},e.getBounds=()=>{const n=e.getInputData(0),r=e.getInputData(1);return n&&r?(e.buildArrays(),t.bounds):Na()},e.buildArrays=()=>{const n=e.getInputData(0),r=e.getInputData(1);if(t.buildTime.getMTime()t.bounds[1]&&(t.bounds[1]=u[0]),u[1]>t.bounds[3]&&(t.bounds[3]=u[1]),u[2]>t.bounds[5]&&(t.bounds[5]=u[2]);const r=new Float32Array(y,36*e,9);se(r,n),ge(r,r),fe(r,r)}const O=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),t.colorArray=null;const M=e.getLookupTable();M&&O&&(M.build(),t.colorArray=M.mapScalars(O,t.colorMode,0)),t.buildTime.modified()}},e.getPrimitiveCount=()=>{const t=e.getInputData(1),n=e.getInputData().getPoints().getNumberOfValues()/3;return{points:n*t.getPoints().getNumberOfValues()/3,verts:n*(t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells()),lines:n*(t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells()),triangles:n*(t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells())}},e.setSourceConnection=t=>e.setInputConnection(t,1)}const fA={orient:!0,orientationMode:cA.DIRECTION,orientationArray:null,scaling:!0,scaleFactor:1,scaleMode:uA.SCALE_BY_MAGNITUDE,scaleArray:null,matrixArray:null,normalArray:null,colorArray:null};function gA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fA,n),oc.extend(e,t,n),jt.algo(e,t,2,0),t.buildTime={},jt.obj(t.buildTime,{mtime:0}),t.boundsTime={},jt.obj(t.boundsTime,{mtime:0}),jt.setGet(e,t,["orient","orientationMode","orientationArray","scaleArray","scaleFactor","scaleMode","scaling"]),jt.get(e,t,["colorArray","matrixArray","normalArray","buildTime"]),pA(e,t)}var mA={newInstance:jt.newInstance(gA,"vtkGlyph3DMapper"),extend:gA,...lA};const hA=0,vA=1,{vtkErrorMacro:yA,vtkWarningMacro:bA}=jt;function xA(e,t){e&&e.setResolveCoincidentTopologyToPolygonOffset&&(e.setResolveCoincidentTopologyToPolygonOffset(),Ul.forEach((n=>{if(t[n]){const r=`setRelativeCoincidentTopology${n}OffsetParameters`;if(e[r]){const{factor:o,offset:a}=t[n];e[r](o,a)}}})))}function TA(e,t,n,r,o){let a=e[`get${jt.capitalize(t)}`]?.()||e.getPointData().getArrayByName(t);if(!a||void 0!==r&&a.getDataType()!==r||void 0!==o&&a.getNumberOfComponents()!==o){let i=Es,s=r,l=o;"points"===t?(i=vc,s=s??"Float32Array",l=o??3):uu.includes(t)?(i=dc,s=s??"Uint16Array",l=o??1):(s=s??"Float32Array",l=o??1),a=i.newInstance({name:t,dataType:s,numberOfComponents:l,size:l*n,empty:0===n}),"points"===t||uu.includes(t)?e[`set${jt.capitalize(t)}`](a):e.getPointData().addArray(a)}else a.getNumberOfTuples()!==n&&a.resize(n);return a}function CA(e,t){t.classHierarchy.push("vtkWidgetRepresentation");const n={mtimes:{},states:[]};t._onCoincidentTopologyParametersChanged=()=>{e.getActors().forEach((e=>{xA(e.getMapper(),t.coincidentTopologyParameters)}))},e.getActors=()=>t.actors,e.getNestedProps=e.getActors,e.setLabels=function(){for(var n=arguments.length,r=new Array(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.mtimes.representation===e.getMTime()&&n.mtimes.input===r.getMTime()||(n.mtimes.representation=e.getMTime(),n.mtimes.input=r.getMTime(),n.states=[],t.labels.forEach((e=>{n.states=n.states.concat(r.getStatesWithLabel(e)||[])}))),n.states},e.getSelectedState=(t,n)=>{const r=e.getRepresentationStates();return n0&&void 0!==arguments[0]?arguments[0]:AP.FRONT_BUFFER,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!0;switch(t.behavior){case hA:o=e===AP.PICKING_BUFFER||r;break;case vA:o=n;break;default:o=!0}const a=o;for(let e=0;ee.addActor(t)))},e.addActor=e=>{xA(e.getMapper(),t.coincidentTopologyParameters),Array.prototype.push.apply(t.actors,[e])},e.setLabels(t.labels)}function SA(e){return{activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,actors:[],labels:[],behavior:vA,coincidentTopologyParameters:{Point:{factor:-1,offset:-1},Line:{factor:-1,offset:-1},Polygon:{factor:-1,offset:-1}},scaleInPixels:!1,displayScaleParams:{dispHeightFactor:1,cameraPosition:[0,0,0],cameraDir:[1,0,0],isParallel:!1,rendererPixelDims:[1,1]},_internalArrays:{},...e}}var PA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Zi.extend(e,t,SA(n)),jt.algo(e,t,1,1),jt.get(e,t,["labels","displayScaleParams","coincidentTopologyParameters"]),jt.set(e,t,[{type:"object",name:"displayScaleParams"},{type:"object",name:"coincidentTopologyParameters"}]),jt.setGet(e,t,["scaleInPixels","activeScaleFactor","activeColor","useActiveColor"]),CA(e,t)},AA=function(e){let t=e.source;e.filter&&(t.isA("vtkDataSet")?e.filter.setInputData(t):e.filter.setInputConnection(t.getOutputPort()),t=e.filter),t&&(t.isA("vtkDataSet")?e.mapper.setInputData(t):e.mapper.setInputConnection(t.getOutputPort())),e.glyph&&e.mapper.setInputConnection(e.glyph.getOutputPort(),1),e.actor.setMapper(e.mapper)};function IA(e,t){t.classHierarchy.push("vtkHandleRepresentation")}const wA={behavior:hA,pickable:!0,dragable:!0,scaleInPixels:!0};var OA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...wA,...n};PA(e,t,r),IA(0,t)};function MA(e,t){t.classHierarchy.push("vtkContextRepresentation")}const RA={behavior:vA,pickable:!1,dragable:!0};var VA=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...RA,...n};PA(e,t,r),MA(0,t)};function EA(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,n)=>{if(t.deleted)return;let r=n[0];const o=r?r.getPoints().getDataType():t.pointType;r=hu.newInstance();let a=0,{thetaResolution:i}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let c=t.startPhit.startPhi?t.endPhi:t.startPhi;u*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++i;const d=(l-s)/t.thetaResolution,p=t.startPhi<=0?1:0,f=t.phiResolution+(t.endPhi>=180?-1:0),g=t.phiResolution*i+2,m=2*t.phiResolution*t.thetaResolution;let h=0,v=jt.newTypedArray(o,3*g),y=new Float32Array(3*g),b=0,x=new Uint32Array(5*m);t.startPhi<=0&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]+t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=1,h++,a++),t.endPhi>=180&&(v[3*h+0]=t.center[0],v[3*h+1]=t.center[1],v[3*h+2]=t.center[2]-t.radius,y[3*h+0]=0,y[3*h+1]=0,y[3*h+2]=-1,h++,a++);const T=t.phiResolution-a,C=(u-c)/(t.phiResolution-1);for(let e=0;e=180){const e=T-1+a;for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DA,n),jt.obj(e,t),jt.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),jt.setGetArray(e,t,["center"],3),jt.algo(e,t,0,1),EA(e,t)}var BA={newInstance:jt.newInstance(LA,"vtkSphereSource"),extend:LA};function NA(e,t){return(e,n)=>{const r=TA(e,"points",n.length).getData();let o=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=TA(e,"color",n.length,"Uint8Array",4),o=r.getData();let a=0;for(let e=0;e{t._pipeline.mapper.setColorByArrayName("color");const r=TA(e,"color",n.length).getData();for(let e=0;e{t._pipeline.mapper.setColorByArrayName(null)}}function GA(e,t){return(n,r)=>{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0),t._pipeline.mapper.setScaleMode(mA.ScaleModes.SCALE_BY_COMPONENTS);const o=TA(n,"scale",r.length,"Float32Array",3).getData();let a=0;for(let n=0;n{t._pipeline.mapper.setScaleArray("scale"),t._pipeline.mapper.setScaleFactor(1),t._pipeline.mapper.setScaling(!0);const o=TA(n,"scale",r.length).getData();for(let n=0;n{t._pipeline.mapper.setScaleArray(null),t._pipeline.mapper.setScaleFactor(t.defaultScale),t._pipeline.mapper.setScaling(1!==t.defaultScale)}}function WA(e,t){return(e,n)=>{t._pipeline.mapper.setOrientationArray("orientation"),t._pipeline.mapper.setOrientationMode(sA.MATRIX);const r=TA(e,"orientation",n.length,"Float32Array",9).getData();for(let e=0;e{t._pipeline.mapper.setOrientationArray(null)}}function jA(e,t){t.classHierarchy.push("vtkGlyphRepresentation");const n={...e},r=hu.newInstance({mtime:0});function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rnull!=e[0]?.[`get${jt.capitalize(t)}`]?.()))}e.getRepresentationStates=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.getRepresentationStates(e).filter((e=>e.getOrigin?.()&&(e.isVisible?.()??!0)))},e.getMixins=e=>{const n={};return o(e,"origin")?n.position=t.applyMixin.origin:n.position=t.applyMixin.noPosition,o(e,"color3")?n.color=t.applyMixin.color3:o(e,"color")?n.color=t.applyMixin.color:n.color=t.applyMixin.noColor,o(e,"scale3")?n.scale=t.applyMixin.scale3:o(e,"scale1")?n.scale=t.applyMixin.scale1:n.scale=t.applyMixin.noScale,o(e,"direction")?n.orientation=t.applyMixin.direction:n.orientation=t.applyMixin.noOrientation,n},e.requestData=(t,n)=>{const o=e.getRepresentationStates(t[0]);n[0]=r;const a=e.getMixins(o);Object.values(a).forEach((e=>e(r,o))),r.getPoints().modified(),r.modified()},AA(t._pipeline),e.addActor(t._pipeline.actor)}function KA(e,t,n){return{defaultScale:1,...n,_pipeline:{source:n._pipeline?.source??e,glyph:n._pipeline?.glyph??BA.newInstance({phiResolution:8,thetaResolution:8}),mapper:n._pipeline?.mapper??mA.newInstance({scalarMode:vl.USE_POINT_FIELD_DATA}),actor:n._pipeline?.actor??hs.newInstance({parentProp:e}),...n._pipeline},applyMixin:{origin:n.applyMixin?.origin??NA(0,t),noPosition:n.applyMixin?.noPosition??((e,t)=>{TA(e,"points",0)}),color3:n.applyMixin?.color3??kA(0,t),color:n.applyMixin?.color??FA(0,t),noColor:n.applyMixin?.noColor??_A(0,t),scale3:n.applyMixin?.scale3??GA(e,t),scale1:n.applyMixin?.scale1??UA(e,t),noScale:n.applyMixin?.noScale??zA(0,t),direction:n.applyMixin?.direction??WA(0,t),noOrientation:n.applyMixin?.noOrientation??HA(0,t),...n.applyMixin}}}function $A(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.behavior===vA?VA(e,t,KA(e,t,n)):OA(e,t,KA(e,t,n)),"lighting"in n&&t._pipeline.actor.getProperty().setLighting(n.lighting),jt.setGet(e,t._pipeline,["defaultScale"]),jt.get(e,t._pipeline,["glyph","mapper","actor"]),jt.setGet(e,t.applyMixin,Object.keys(t.applyMixin)),jA(e,t)}var qA={newInstance:jt.newInstance($A,"vtkGlyphRepresentation"),extend:$A};function XA(e,t){t.classHierarchy.push("vtkPixelSpaceCallbackMapper"),t.callback||(t.callback=()=>{}),e.invokeCallback=(e,n,r,o,a)=>{if(!t.callback)return;const i=n.getCompositeProjectionMatrix(r,-1,1);m(i,i);const s=e.getPoints(),l=new Float64Array(3),c=o.usize,u=o.vsize,d=c/2,p=u/2,f=[];for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,YA,n),oc.extend(e,t,n),jt.setGet(e,t,["callback","useZValues"]),XA(e,t)}var QA={newInstance:jt.newInstance(ZA,"vtkPixelSpaceCallbackMapper"),extend:ZA};function JA(e,t){t.classHierarchy.push("vtkCylinderSource"),e.requestData=function(e,n){if(t.deleted)return;let r=n[0];const o=2*Math.PI/t.resolution;let a=2*t.resolution,i=5*t.resolution;t.capping&&(a=4*t.resolution,i=7*t.resolution+2);const s=jt.newTypedArray(t.pointType,3*a);let l=0;const c=new Uint32Array(i),u=new Float32Array(3*a),d=Es.newInstance({numberOfComponents:3,values:u,name:"Normals"}),p=new Float32Array(2*a),f=Es.newInstance({numberOfComponents:2,values:p,name:"TCoords"}),g=[0,0,0],m=[0,0,0],h=[0,0,0],v=[0,0,0],y=[0,0],b=[0,0],x=null==t.otherRadius?t.radius:t.otherRadius;for(let e=0;e-1*e))).apply(s),r=hu.newInstance(),r.getPoints().setData(s,3),r.getPolys().setData(c,1),r.getPointData().setNormals(d),r.getPointData().setTCoords(f),n[0]=r}}const eI={height:1,initAngle:0,radius:1,resolution:6,center:[0,0,0],direction:[0,1,0],capping:!0,pointType:"Float64Array"};function tI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eI,n),jt.obj(e,t),jt.setGet(e,t,["height","initAngle","otherRadius","radius","resolution","capping"]),jt.setGetArray(e,t,["center","direction"],3),jt.algo(e,t,0,1),JA(e,t)}var nI={newInstance:jt.newInstance(tI,"vtkCylinderSource"),extend:tI};function rI(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;e{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)};const r=e.getScale3();e.setScale3(((e,n)=>{if(r(e,n),t.infiniteLine){const t=TA(e,"scale",n.length,"Float32Array",3).getData();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};qA.extend(e,t,oI(n)),jt.setGet(e,t,["infiniteLine","glyphResolution"]),rI(e,t)}var iI={newInstance:jt.newInstance(aI,"vtkLineHandleRepresentation"),extend:aI};function sI(e,t){function n(n){if(t.displayCallback){const r=[],o=e.getRepresentationStates();for(let e=0;et._pipeline.glyph.getPhiResolution(),e.setGlyphResolution=e=>t._pipeline.glyph.setPhiResolution(e)||t._pipeline.glyph.setThetaResolution(e),e.setDisplayCallback=e=>{t.displayCallback=e,t.displayMapper.setCallback(e?n:null)}}function lI(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};qA.extend(e,t,n),sI(e,t)}var cI={newInstance:jt.newInstance(lI,"vtkSphereHandleRepresentation"),extend:lI};const uI=0,dI=1,pI=2,fI="translateAxis",gI="rotateLine",mI="translateCenter",hI=(PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE,[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE]),vI=(PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE,["X","Y","Z"]),yI={[PP.YZ_PLANE]:"X",[PP.XZ_PLANE]:"Y",[PP.XY_PLANE]:"Z"},bI={X:PP.YZ_PLANE,Y:PP.XZ_PLANE,Z:PP.XY_PLANE};function xI(e,t,n){const r=[...e];return _f().rotate(n,t).apply(r),r}function TI(e){return e[0]}function CI(e){return e[3]}function SI(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vI;const t=[];return e.forEach((n=>{e.forEach((e=>{n!==e&&t.push(`${n}in${e}`)}))})),t}function PI(e,t){const n=TI(t),r=CI(t),o=function(e){return Object.keys(e.getPlanes()).map((e=>yI[e]))}(e).find((e=>e!==n&&e!==r));return`${o}in${r}`}function AI(e,t,n,r){return Wo([...e],t*(r?1:n)/2)}function II(e,t,n){const r=Object.keys(e.getPlanes()).map((e=>yI[e])),o=r.reduce(((t,n)=>(r.filter((e=>n!==e)).forEach((r=>{const o=$o(e.getPlanes()[bI[n]].normal,e.getPlanes()[bI[r]].normal,[]);t[`${n}${r}`]=o,t[`${r}${n}`]=o})),t)),{}),a=e.getImage().getBounds(),i=e.getCenter(),s=Fi.getDiagonalLength(a);e.getCenterHandle().setOrigin(i),SI(r).forEach((r=>{const a=TI(r),l=CI(r),c=o[`${a}${l}`];e[`getRotationHandle${r}0`]().setOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}0`]().getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal),e[`getRotationHandle${r}0`]().setOffset(AI(c,n,s,t)),e[`getRotationHandle${r}1`]().setOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleOrigin(i),e[`getRotationHandle${r}1`]().getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal),e[`getRotationHandle${r}1`]().setOffset(AI(c,-n,s,t));const u=e[`getAxis${r}`]();u.setOrigin(i),u.getManipulator()?.setHandleOrigin(i),u.getManipulator()?.setHandleNormal(e.getPlanes()[bI[a]].normal);const d=Xo(c),p=u.getScale3();p[2]=2*d,u.setScale3(p);const f=e.getPlanes()[bI[l]].normal,g=$o(c,f,[]);u.setRight(f),u.setUp(g),u.setDirection(c)}))}function wI(e,t){t._isDragging=!1;let n,r=!1;jt.setGet(e,t,["keepOrthogonality",{type:"object",name:"cursorStyles"}]),e.setCursorStyles({[mI]:"move",[gI]:"alias",[fI]:"pointer",default:"default"}),e.setEnableTranslation=e=>{t.representations[0].setPickable(e),t.representations[2].setPickable(e)},e.setEnableRotation=e=>{t.representations[1].setPickable(e)},e.getActiveInteraction=()=>t.widgetState.getStatesWithLabel("rotation").includes(t.activeState)?gI:t.widgetState.getStatesWithLabel("line").includes(t.activeState)?fI:t.widgetState.getStatesWithLabel("center").includes(t.activeState)?mI:null,e.getActiveLineName=()=>function(e){return SI(Object.keys(e.getPlanes()).map((e=>yI[e])))}(t.widgetState).find((e=>t.widgetState.getStatesWithLabel(e).includes(t.activeState))),e.getActiveLineHandle=()=>t.widgetState[`getAxis${e.getActiveLineName()}`]?.(),e.getOtherLineHandle=e=>t.widgetState[`getAxis${PI(t.widgetState,e)}`]?.(),e.getActiveRotationPointName=()=>t.widgetState.getStatesWithLabel("point0").includes(t.activeState)?"point0":t.widgetState.getStatesWithLabel("point1").includes(t.activeState)?"point1":null,e.startScrolling=t=>{t&&(n=t),r=!0,e.startInteraction()},e.endScrolling=()=>{r=!1,e.endInteraction()},e.updateCursor=()=>{const n=e.getCursorStyles();if(n)switch(e.getActiveInteraction()){case mI:t._apiSpecificRenderWindow.setCursor(n.translateCenter);break;case gI:t._apiSpecificRenderWindow.setCursor(n.rotateLine);break;case fI:t._apiSpecificRenderWindow.setCursor(n.translateAxis);break;default:t._apiSpecificRenderWindow.setCursor(n.default)}},e.handleLeftButtonPress=r=>{if(t.activeState&&t.activeState.getActive()){t._isDragging=!0;const o=t.viewType,a=t.widgetState.getPlanes()[o].normal,i=t.activeState?.getManipulator?.()??t.manipulator;i.setWidgetOrigin(t.widgetState.getCenter()),i.setWidgetNormal(a);const{worldCoords:s}=i.handleEvent(r,t._apiSpecificRenderWindow);n=s,e.startInteraction()}else{if(t.widgetState.getScrollingMethod()!==dI)return jt.VOID;e.startScrolling(r.position)}return jt.EVENT_ABORT},e.handleMouseMove=o=>{if(t._isDragging)return e.handleEvent(o);if(r&&n.y!==o.position.y){const t=n.y-o.position.y;e.translateCenterOnPlaneDirection(t),n=o.position,e.invokeInternalInteractionEvent()}return jt.VOID},e.handleLeftButtonRelease=()=>{(t._isDragging||r)&&e.endScrolling(),t._isDragging=!1,t.widgetState.deactivate()},e.handleRightButtonPress=n=>{t.widgetState.getScrollingMethod()===pI&&e.startScrolling(n.position)},e.handleRightButtonRelease=()=>{t.widgetState.getScrollingMethod()===pI&&e.endScrolling()},e.handleStartMouseWheel=()=>{e.startInteraction()},e.handleMouseWheel=t=>{const n=t.spinY;return r=!0,e.translateCenterOnPlaneDirection(n),e.invokeInternalInteractionEvent(),r=!1,jt.EVENT_ABORT},e.handleEndMouseWheel=()=>{e.endScrolling()},e.handleMiddleButtonPress=n=>{t.widgetState.getScrollingMethod()===uI&&e.startScrolling(n.position)},e.handleMiddleButtonRelease=()=>{t.widgetState.getScrollingMethod()===uI&&e.endScrolling()},e.handleEvent=n=>t.activeState.getActive()?(e[e.getActiveInteraction()](n),e.invokeInternalInteractionEvent(),jt.EVENT_ABORT):jt.VOID,e.invokeInternalInteractionEvent=()=>{const t=e.getActiveInteraction(),n=t!==gI,r=t===gI;e.invokeInteractionEvent({computeFocalPointOffset:n,canUpdateFocalPoint:r})},e.startInteraction=()=>{e.invokeStartInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().requestAnimation(e)}))},e.endInteraction=()=>{e.invokeEndInteractionEvent(),e.getViewWidgets().forEach((t=>{t.getInteractor().cancelAnimation(e)}))},e.translateCenterOnPlaneDirection=n=>{const r=t.widgetState.getPlanes()[t.viewType].normal,o=t.widgetState.getCenter(),a=t.widgetState.getImage().getSpacing(),i=r.map((e=>Math.abs(e))),s=i.indexOf(Math.max(...i)),l=n*a[s]/Math.abs(r[s]);let c=[o[0]+l*r[0],o[1]+l*r[1],o[2]+l*r[2]];c=e.getBoundedCenter(c),t.widgetState.setCenter(c),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[fI]=r=>{const o=e.getActiveLineHandle(),a=e.getActiveLineName(),i=Uo(o.getOrigin(),o.getDirection(),[]),s=o.getDirection();Xo(s);const l=e.getOtherLineHandle(a),c=t.widgetState.getCenter(),u=t.activeState?.getManipulator?.()??t.manipulator;let d=null,p=[];if(t.activeState?.getManipulator?.())d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Uo(c,zo(d,n,[]),p);else if(l){const e=l.getDirection();Xo(e);const n=e,a=Ko(s,e);1!==a&&-1!==a||$o(s,u.getWidgetNormal(),n);const f=[];d=u.handleEvent(r,t._apiSpecificRenderWindow).worldCoords,Qc.distanceToLine(d,o.getOrigin(),i,f),p=jo(c,n,Ko(zo(d,f,[]),n),p)}p=e.getBoundedCenter(p),t.widgetState.setCenter(p),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition()),n=d},e.getBoundedCenter=e=>{const n=t.widgetState.getCenter(),r=t.widgetState.getImage().getBounds();return Fi.containsPoint(r,...e)?e:function(e,t,n){const r=[0,0,0];zo(t,e,r);const o=[0,0,0];return Fi.intersectBox(n,e,r,o,[0,0,0]),o}(e,n,r)},e[mI]=r=>{const o=t.activeState?.getManipulator?.()??t.manipulator,{worldCoords:a}=o.handleEvent(r,t._apiSpecificRenderWindow),i=zo(a,n,[]);n=a;let s=Uo(t.widgetState.getCenter(),i,[]);s=e.getBoundedCenter(s),t.widgetState.setCenter(s),II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e[gI]=n=>{const r=e.getActiveLineHandle(),o=t.activeState?.getManipulator?.()??t.manipulator,a=o.getWidgetNormal(),{worldCoords:i}=o.handleEvent(n,t._apiSpecificRenderWindow);if(!i||!i.length)return;const s=[0,0,0];zo(i,t.widgetState.getCenter(),s),Xo(s);const l=r.getDirection();Xo(l);const c=e.getActiveRotationPointName();("point1"===c||!c&&Ko(s,l)<0)&&Wo(l,-1);const u=Qo(l,s,a);e.rotateLineInView(e.getActiveLineName(),u)},e.rotateLineInView=(n,r)=>{const o=bI[TI(n)],a=bI[CI(n)],i=t.widgetState.getPlanes()[a].normal;if(e.rotatePlane(o,r,i),e.getKeepOrthogonality()){const o=TI(PI(t.widgetState,n));e.rotatePlane(bI[o],r,i)}II(t.widgetState,t._factory.getScaleInPixels(),t._factory.getRotationHandlePosition())},e.rotatePlane=(e,n,r)=>{const{normal:o,viewUp:a}=t.widgetState.getPlanes()[e],i=xI(o,r,n),s=xI(a,r,n);t.widgetState.getPlanes()[e]={normal:i,viewUp:s}}}const OI="default";function MI(e,t){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}function RI(e,t){t.classHierarchy.push("vtkWidgetState");const n=[];t.labels={},t.nestedStates=[],e.bindState=function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[OI];if(t.nestedStates.push(r),n.push(r.onModified(e.modified)),Array.isArray(o)&&o.length)for(let e=0;e{for(;n.length;)n.pop().unsubscribe();MI(t.nestedStates,r);for(let r=0;r{MI(t.labels[e],r)}))},e.unbindAll=()=>{for(;n.length;)n.pop().unsubscribe();t.nestedStates=[]},e.activate=()=>e.setActive(!0),e.deactivate=n=>{n!==e&&e.setActive(!1);for(let e=0;e{t&&t.setActive(!0),e.deactivate(t)},e.getStatesWithLabel=e=>t.labels[e],e.getAllNestedStates=()=>t.nestedStates,e.delete=jt.chain(e.unbindAll,e.delete)}const VI={active:!1};var EI=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,VI,n),jt.obj(e,t),jt.setGet(e,t,["active"]),RI(e,t)};function DI(e,t){const n=[],r=[...Fi.INIT_BOUNDS];e.containsPoint=(e,t,n)=>Array.isArray(e)?Fi.containsPoint(r,e[0],e[1],e[2]):Fi.containsPoint(r,e,t,n),e.placeWidget=o=>{t.bounds=[];const a=[(o[0]+o[1])/2,(o[2]+o[3])/2,(o[4]+o[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];n[e]=o[e],t.bounds[e]=(o[e]-r)*t.placeFactor+r}Fi.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()},e.setPlaceFactor=o=>{if(t.placeFactor!==o){t.placeFactor=o,t.bounds=[];const a=[(n[0]+n[1])/2,(n[2]+n[3])/2,(n[4]+n[5])/2];for(let e=0;e<6;e++){const r=a[Math.floor(e/2)];t.bounds[e]=(n[e]-r)*t.placeFactor+r}Fi.setBounds(r,t.bounds),e.invokeBoundsChange(t.bounds),e.modified()}}}const LI={bounds:[-1,1,-1,1,-1,1],placeFactor:1};var BI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,LI,n),jt.setGetArray(e,t,["bounds"],6),jt.get(e,t,["placeFactor"]),jt.event(e,t,"BoundsChange"),t.bounds=t.bounds.slice(),DI(e,t)}};const NI={color:.5};var kI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,NI,n),jt.setGet(e,t,["color"])}};const FI={color3:[255,255,255],opacity:255};var _I={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,FI,n),jt.setGetArray(e,t,["color3"],3,255),jt.setGet(e,t,["opacity"])}};function GI(e,t){e.translate=(t,n,r)=>{const[o,a,i]=e.getCornerByReference();e.setCorner(o+t,a+n,i+r)}}const UI={corner:[0,0,0]};var zI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UI,n),jt.setGetArray(e,t,["corner"],3),GI(e)}};function WI(e,t){const n="degree"===t.angleUnit?Ff():_f();e.rotateFromDirections=(r,o)=>{n.identity().rotateFromDirections(r,o).apply(t.direction),e.modified()},e.rotate=(e,r)=>{n.identity().rotate(e,r).apply(t.direction)},e.rotateX=e=>{n.identity().rotateX(e).apply(t.direction)},e.rotateY=e=>{n.identity().rotateY(e).apply(t.direction)},e.rotateZ=e=>{n.identity().rotateZ(e).apply(t.direction)}}const HI={direction:[1,0,0]};var jI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,HI,n),jt.setGetArray(e,t,["direction"],3),WI(e,t)}};function KI(e,t){e.updateManipulator=()=>{if(t.manipulator){const{origin:e,normal:n,direction:r}=t,{setHandleOrigin:o,setHandleCenter:a,setHandleNormal:i,setHandleDirection:s}=t.manipulator;e&&o?o(e):e&&a&&a(e),r&&s?s(r):r&&!n&&i?i(r):n&&s&&s(n)}}}const $I={manipulator:null};var qI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$I,n),jt.setGet(e,t,["manipulator"]),KI(e,t)}};const XI={name:""};var YI={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XI,n),jt.setGet(e,t,["name"])}};function ZI(e,t){return 3===e.length&&3===t.length&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function QI(e,t){const n={o:[],p1:[],p2:[]};e.normalize=()=>{Xo(t.up),Xo(t.right),Xo(t.direction),e.modified()},e.updateFromOriginRightUp=(r,o,a)=>{(function(e,t,n,r){return ZI(e,r.o)&&ZI(t,r.p1)&&ZI(n,r.p2)})(r,o,a,n)||(n.o=r.slice(),n.p1=o.slice(),n.p2=a.slice(),t.up=[a[0]-r[0],a[1]-r[1],a[2]-r[2]],t.right=[o[0]-r[0],o[1]-r[1],o[2]-r[2]],$o(t.up,t.right,t.direction),$o(t.direction,t.up,t.right),e.normalize(),e.modified())}}const JI={up:[0,1,0],right:[1,0,0],direction:[0,0,1]};var ew={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JI,n),jt.setGetArray(e,t,["up","right","direction"],3),QI(e,t)}};function tw(e,t){const n={...e};e.translate=(t,n,r)=>{const[o,a,i]=e.getOriginByReference();e.setOrigin(o+t,a+n,i+r)},e.getOrigin=e=>{const r=n.getOrigin();if(!t.offset)return r;if(!e)return Ga.add(r,t.offset,r);const o=FP(r,e),{rendererPixelDims:a}=e,i=Math.min(a[0],a[1]);return Ga.multiplyAccumulate(r,t.offset,i*o,r)}}const nw={origin:null,offset:null};var rw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nw,n),jt.setGetArray(e,t,["origin","offset"],3),tw(e,t)}};const ow={scale1:.5};var aw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ow,n),jt.setGet(e,t,["scale1"])}};const iw={scale3:[1,1,1]};var sw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iw,n),jt.setGetArray(e,t,["scale3"],3)}};const lw={text:"DefaultText"};var cw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lw,n),jt.setGet(e,t,["text"])}};const uw={visible:!0};var dw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uw,n),jt.setGet(e,t,["visible"]),e.isVisible=e.getVisible}};const pw={shape:""};var fw={extend:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pw,n),jt.setGet(e,t,["shape"])}};const{vtkErrorMacro:gw}=jt,mw={bounds:BI,color:kI,color3:_I,corner:zI,direction:jI,manipulator:qI,name:YI,orientation:ew,origin:rw,scale1:aw,scale3:sw,text:cw,visible:dw,shape:fw};function hw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];o||EI(n,r,t);for(let o=0;o{const r=hw(n,{...o,...e});return this.publicAPI.bindState(r,t),this.model[a].push(r),this.publicAPI.modified(),r},this.publicAPI[`remove${jt.capitalize(r)}`]=e=>{let t=this.model[a].indexOf(e);-1===t&&ethis.model[a].slice(),this.publicAPI[`clear${jt.capitalize(r)}List`]=()=>{for(;this.model[a].length;){const e=this.model[a].pop();e&&this.publicAPI.unbindState(e)}this.publicAPI.modified()},this}addStateFromMixin(e){let{labels:t,mixins:n,name:r,initialValues:o}=e;const a=hw(n,o);return this.model[r]=a,this.publicAPI.bindState(a,t),jt.setGet(this.publicAPI,this.model,[r]),this}addStateFromInstance(e){let{labels:t,name:n,instance:r}=e;return this.model[n]=r,this.publicAPI.bindState(r,t),jt.setGet(this.publicAPI,this.model,[n]),this}addField(e){let{name:t,initialValue:n}=e;return Array.isArray(n)?jt.setGetArray(this.publicAPI,this.model,[t],n.length):jt.setGet(this.publicAPI,this.model,[t]),this.model[t]=n,this}build(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:vI;const t=yw().addField({name:"center",initialValue:[0,0,0]}).addField({name:"image",initialValue:null}).addField({name:"activeViewType",initialValue:null}).addField({name:"planes",initialValue:e.reduce(((e,t)=>({...e,[bI[t]]:{normal:bw[t].normal,viewUp:bw[t].viewUp}})),{})}).addField({name:"scrollingMethod",initialValue:uI}).addField({name:"cameraOffsets",initialValue:{}}).addField({name:"viewUpFromViewType",initialValue:{}}).addStateFromMixin({labels:["handles","sphere","center"],mixins:["origin","color3","scale1","visible","manipulator"],name:"centerHandle",initialValues:{scale1:30,color3:[255,255,255]}});return e.reduce(((t,n)=>e.filter((e=>e!==n)).reduce(((e,t)=>{e.addStateFromMixin({labels:["handles","line",`lineIn${n}`,`${t}in${n}`],mixins:["origin","color3","scale3","orientation","visible","manipulator"],name:`axis${t}in${n}`,initialValues:{scale3:[4,4,4],color3:xw[t]}});for(let r=0;r<2;++r)e.addStateFromMixin({labels:["handles","sphere","rotation",`rotationIn${n}`,`${t}in${n}`,`point${r}`],mixins:["origin","color3","scale1","visible","manipulator"],name:`rotationHandle${t}in${n}${r}`,initialValues:{scale1:30,color3:xw[t]}});return e}),t)),t),t.build()}const{vtkErrorMacro:Cw}=jt;function Sw(e,t){t.classHierarchy.push("vtkResliceCursorWidget"),t.methodsToLink=["scaleInPixels"],e.getRepresentationsForViewType=e=>{switch(e){case PP.XY_PLANE:case PP.XZ_PLANE:case PP.YZ_PLANE:return[{builder:iI,labels:[`lineIn${yI[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels}},{builder:cI,labels:[`rotationIn${yI[e]}`],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}},{builder:cI,labels:["center"],initialValues:{useActiveColor:!1,scaleInPixels:t.scaleInPixels,lighting:!1}}];case PP.DEFAULT:case PP.GEOMETRY:case PP.SLICE:case PP.VOLUME:default:return[]}},e.setImage=e=>{t.widgetState.setImage(e);const n=e.getCenter();t.widgetState.setCenter(n),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)},e.setCenter=n=>{t.widgetState.setCenter(n),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition),e.modified()},e.updateCameraPoints=(n,r,o,a,i)=>{e.resetCamera(n,r,o,a),i&&function(e,n){const r=n.getActiveCamera().getFocalPoint(),o=t.widgetState.getCenter(),a=n.getRenderWindow().getViews()[0].getViewportSize(n),i=a[0]/a[1],s=zo(n.worldToNormalizedDisplay(...r,i),n.worldToNormalizedDisplay(...o,i),[0,0,0]),l=t.widgetState.getCameraOffsets();l[e]=s,t.widgetState.setCameraOffsets(l)}(r,n)},e.resetCamera=(n,r,o,a)=>{const i=t.widgetState.getImage().getCenter(),s=n.getActiveCamera().getFocalPoint(),l=n.getActiveCamera().getPosition(),c=Math.sqrt(Zo(l,s)),u=e.getPlaneNormalFromViewType(r),d=o?i:s,p=jo(d,u,c,[0,0,0]);n.getActiveCamera().setFocalPoint(...d),n.getActiveCamera().setPosition(...p),n.getActiveCamera().setViewUp(t.widgetState.getPlanes()[r].viewUp),function(e,n,r,o,a){const i=e.getActiveCamera().getFocalPoint(),s=e.getActiveCamera().getDistance(),l=jo(i,n,s,[0,0,0]);let c=i;if(o&&(c=ei.intersectWithLine(i,l,t.widgetState.getCenter(),n).x),a){const o=t.widgetState.getCenter(),a=e.getRenderWindow().getViews()[0].getViewportSize(e),i=a[0]/a[1],s=Uo(e.worldToNormalizedDisplay(...o,i),t.widgetState.getCameraOffsets()[r],[0,0,0]),u=e.normalizedDisplayToWorld(...s,i),d=ei.intersectWithLine(u,l,o,n);c[0]=d.x[0],c[1]=d.x[1],c[2]=d.x[2]}e.getActiveCamera().setFocalPoint(c[0],c[1],c[2]);const u=jo(c,n,s,[0,0,0]);e.getActiveCamera().setPosition(u[0],u[1],u[2]);const d=t.widgetState.getImage().getBounds();o&&e.resetCamera(d),e.resetCameraClippingRange(d)}(n,u,r,o,a)},e.getPlaneSource=n=>{const r=function(n){const r=t.widgetState.getImage().getBounds(),o=e.getWidgetState().getCenter(),a=t.widgetState.getImage().getCenter(),i=[];for(let e=0;e<3;e++)i[e]=-Math.abs(o[e]-a[e]),i[e]*=2;const s=ZP.newInstance();return n===PP.XZ_PLANE?(s.setOrigin(r[0]+i[0],o[1],r[4]+i[2]),s.setPoint1(r[1]-i[0],o[1],r[4]+i[2]),s.setPoint2(r[0]+i[0],o[1],r[5]-i[2])):n===PP.XY_PLANE?(s.setOrigin(r[0]+i[0],r[2]+i[1],o[2]),s.setPoint1(r[1]-i[0],r[2]+i[1],o[2]),s.setPoint2(r[0]+i[0],r[3]-i[1],o[2])):n===PP.YZ_PLANE&&(s.setOrigin(o[0],r[2]+i[1],r[4]+i[2]),s.setPoint1(o[0],r[3]-i[1],r[4]+i[2]),s.setPoint2(o[0],r[2]+i[1],r[5]-i[2])),s}(n),{normal:o,viewUp:a}=t.widgetState.getPlanes()[n];!function(e,t,n,r){e.setNormal(n);const o=Qo(zo(e.getPoint2(),e.getOrigin(),[]),r,n);e.rotate(o,n),e.setCenter(t)}(r,t.widgetState.getCenter(),o,a);const i=[...r.getOrigin()],s=[...r.getPoint1()],l=[...r.getPoint2()];return function(e,t,n,r){const o=[];zo(n,t,o),Xo(o);const a=[];zo(r,t,a),Xo(a);const i=[0,0,1];$o(o,a,i),Xo(i);const s=[...e],l=[...i];Wo(l,1e-6),Fi.addBounds(s,e[0]+l[0],e[1]+l[0],e[2]+l[1],e[3]+l[1],e[4]+l[2],e[5]+l[2]),Fi.addBounds(s,e[0]-l[0],e[1]-l[0],e[2]-l[1],e[3]-l[1],e[4]-l[2],e[5]-l[2]);const c=ei.newInstance();c.setOrigin(...t),c.setNormal(...i);const u=jf.newInstance();u.setBounds(s);const d=Lf.newInstance();d.setCutFunction(c),d.setInputConnection(u.getOutputPort());const p=d.getOutputData();if(0===p.getNumberOfPoints())return!1;const f=Ni.computeLocalBounds(p.getPoints(),o,a,i);for(let e=0;e<3;e+=1)t[e]=f[0]*o[e]+f[2]*a[e]+f[4]*i[e],n[e]=f[1]*o[e]+f[2]*a[e]+f[4]*i[e],r[e]=f[0]*o[e]+f[3]*a[e]+f[4]*i[e]}(t.widgetState.getImage().getBounds(),i,s,l),r.setOrigin(...i),r.setPoint1(...s),r.setPoint2(...l),r},e.getResliceAxes=n=>{const r=e.getPlaneSource(n),{normal:o}=t.widgetState.getPlanes()[n],a=r.getOrigin(),i=[];zo(r.getPoint1(),a,i),Xo(i);const s=[];zo(r.getPoint2(),a,s),Xo(s);const l=g(new Float64Array(16));for(let e=0;e<3;e++)l[e]=i[e],l[4+e]=s[e],l[8+e]=o[e],l[12+e]=a[e];return l},e.updateReslicePlane=(n,r)=>{const o=t.widgetState.getImage().getSpacing(),a=e.getPlaneSource(r),i=e.getResliceAxes(r),s=a.getOrigin(),l=zo(a.getPoint1(),s,[]),c=Xo(l),u=zo(a.getPoint2(),s,[]),d=Xo(u),p=Math.abs(l[0]*o[0])+Math.abs(l[1]*o[1])+Math.abs(l[2]*o[2]),f=Math.abs(u[0]*o[0])+Math.abs(u[1]*o[1])+Math.abs(u[2]*o[2]);let g=0,m=0;const h=0===p?Number.MAX_SAFE_INTEGER:c/p,v=1073741823;if(h>v)Cw("Invalid X extent: ",h," on view type : ",r),g=0;else for(g=1;gv)Cw("Invalid Y extent:",y," on view type : ",r),m=0;else for(m=1;m{const n=ZP.newInstance(),r=e.getWidgetState().getCenter(),o=e.getPlaneNormalFromViewType(t);return n.setNormal(o),n.setOrigin(r),n},e.getPlaneNormalFromViewType=t=>e.getWidgetState().getPlanes()[t].normal,e.getOtherPlaneNormals=t=>[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE].filter((e=>e!==t)).map((t=>e.getPlaneNormalFromViewType(t))),e.getResliceMatrix=()=>{const t=g(new Float64Array(16));for(let n=0;n<3;n++)t[4*n+0]=e.getPlaneNormalFromViewType(PP.YZ_PLANE)[n],t[4*n+1]=e.getPlaneNormalFromViewType(PP.XZ_PLANE)[n],t[4*n+2]=e.getPlaneNormalFromViewType(PP.XY_PLANE)[n];const n=e.getWidgetState().getCenter();return _f().translate(...n).multiply(t).translate(...Wo([...n],-1)).getMatrix()},e.getDisplayScaleParams=()=>[PP.YZ_PLANE,PP.XZ_PLANE,PP.XY_PLANE].reduce(((t,n)=>(t[n]=function(t){const n=function(t){return e.getViewIds().map((t=>e.getWidgetForView({viewId:t}))).find((e=>e.getViewType()===t))}(t);return n?n.getRepresentations():[]}(n)[0]?.getDisplayScaleParams?.(),t)),{}),e.setScaleInPixels=jt.chain(e.setScaleInPixels,(n=>{e.getViewWidgets().forEach((e=>e.setScaleInPixels(n))),II(t.widgetState,t.scaleInPixels,t.rotationHandlePosition)}))}const Pw=e=>({behavior:wI,widgetState:Tw(e.planes),rotationHandlePosition:.5,scaleInPixels:!0,manipulator:iA.newInstance(),...e});function Aw(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pw(n)),KP.extend(e,t,n),jt.setGet(e,t,["scaleInPixels","rotationHandlePosition","manipulator"]),Sw(e,t)}var Iw={newInstance:jt.newInstance(Aw,"vtkResliceCursorWidget"),extend:Aw},ww=Uint8Array,Ow=Uint16Array,Mw=Uint32Array,Rw=new ww([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,0,0,0]),Vw=new ww([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,0,0]),Ew=new ww([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dw=function(e,t){for(var n=new Ow(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Gw)<<1;Uw=(61680&(Uw=(52428&Uw)>>>2|(13107&Uw)<<2))>>>4|(3855&Uw)<<4,_w[Gw]=((65280&Uw)>>>8|(255&Uw)<<8)>>>1}var zw=function(e,t,n){for(var r=e.length,o=0,a=new Ow(t);o>>l]=c}else for(i=new Ow(r),o=0;o>>15-e[o]);return i},Ww=new ww(288);for(Gw=0;Gw<144;++Gw)Ww[Gw]=8;for(Gw=144;Gw<256;++Gw)Ww[Gw]=9;for(Gw=256;Gw<280;++Gw)Ww[Gw]=7;for(Gw=280;Gw<288;++Gw)Ww[Gw]=8;var Hw=new ww(32);for(Gw=0;Gw<32;++Gw)Hw[Gw]=5;var jw=zw(Ww,9,1),Kw=zw(Hw,5,1),$w=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},qw=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Xw=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Yw=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Ow:4==e.BYTES_PER_ELEMENT?Mw:ww)(n-t);return r.set(e.subarray(t,n)),r},Zw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qw=function(e,t,n){var r=new Error(t||Zw[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Qw),!n)throw r;return r},Jw=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new ww(0);var o=!t||n,a=!n||n.i;n||(n={}),t||(t=new ww(3*r));var i,s=function(e){var n=t.length;if(e>n){var r=new ww(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,c=n.p||0,u=n.b||0,d=n.l,p=n.d,f=n.m,g=n.n,m=8*r;do{if(!d){l=qw(e,c,1);var h=qw(e,c+1,3);if(c+=3,!h){var v=e[(i=c,(O=4+((i+7)/8|0))-4)]|e[O-3]<<8,y=O+v;if(y>r){a&&Qw(0);break}o&&s(u+v),t.set(e.subarray(O,y),u),n.b=u+=v,n.p=c=8*y,n.f=l;continue}if(1==h)d=jw,p=Kw,f=9,g=5;else if(2==h){var b=qw(e,c,31)+257,x=qw(e,c+10,15)+4,T=b+qw(e,c+5,31)+1;c+=14;for(var C=new ww(T),S=new ww(19),P=0;P>>4)<16)C[P++]=O;else{var R=0,V=0;for(16==O?(V=3+qw(e,c,3),c+=2,R=C[P-1]):17==O?(V=3+qw(e,c,7),c+=3):18==O&&(V=11+qw(e,c,127),c+=7);V--;)C[P++]=R}}var E=C.subarray(0,b),D=C.subarray(b);f=$w(E),g=$w(D),d=zw(E,f,1),p=zw(D,g,1)}else Qw(1);if(c>m){a&&Qw(0);break}}o&&s(u+131072);for(var L=(1<>>4;if((c+=15&R)>m){a&&Qw(0);break}if(R||Qw(2),k<256)t[u++]=k;else{if(256==k){N=c,d=null;break}var F=k-254;if(k>264){var _=Rw[P=k-257];F=qw(e,c,(1<<_)-1)+Bw[P],c+=_}var G=p[Xw(e,c)&B],U=G>>>4;if(G||Qw(3),c+=15&G,D=Fw[U],U>3&&(_=Vw[U],D+=Xw(e,c)&(1<<_)-1,c+=_),c>m){a&&Qw(0);break}o&&s(u+131072);for(var z=u+F;u>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new ww((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function nO(e,t){return Jw(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&Qw(6,"invalid zlib data"),32&n[1]&&Qw(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function rO(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?tO(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return Jw(e,t)}(e,t):nO(e,t)}var oO="undefined"!=typeof TextDecoder&&new TextDecoder;try{oO.decode(eO,{stream:!0})}catch(e){}function aO(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,Yw(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),a=o[0];return o[1].length&&Qw(8),a}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;const{vtkErrorMacro:iO,vtkDebugMacro:sO}=jt;let lO=0;function cO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const uO={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,a)=>{let i=null;i=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=cO("GET",i,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++lO&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=aO(rO(new Uint8Array(n.buffer))):n.buffer=rO(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(wb!==n.ref.encode&&wb&&(sO(`Swap bytes of ${n.name}`),Ob(n.buffer,vs[n.dataType])),n.values=jt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&iO(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):a({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const a=cO("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++lO&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(JSON.parse(aO(rO(new Uint8Array(a.response))))):r(JSON.parse(a.responseText)):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(iO("Supported algorithms are: [gz]"),iO(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const a=cO("GET",t,n);a.onreadystatechange=t=>{1===a.readyState&&1==++lO&&e?.invokeBusy&&e.invokeBusy(!0),4===a.readyState&&(0==--lO&&e?.invokeBusy&&e.invokeBusy(!1),200===a.status||0===a.status?n.compression?r(aO(rO(new Uint8Array(a.response)))):r(a.responseText):o({xhr:a,e:t}))},a.responseType=n.compression?"arraybuffer":"text",a.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(iO("Supported algorithms are: [gz]"),iO(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=cO("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(rO(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};bb("http",(e=>uO));const dO=[[1,0,0],[0,1,0],[0,0,1],[.5,.5,.5]],pO=[],fO=Iw.newInstance(),gO=fO.getWidgetState();gO.getStatesWithLabel("sphere").forEach((e=>e.setScale1(20)));const mO={translateCenter:"move",rotateLine:"alias",translateAxis:"pointer",default:"default"},hO=document.querySelector("body"),vO=document.createElement("div");vO.innerHTML='
    Allow translation:
    Show rotation:
    Allow rotation:
    Keep orthogonality:
    Scale in pixels:
    Opacity : 255
    Slab Mode :
    Slab Number of Slices : 1
    Interpolation mode :
    Window Level:
    ',hO.appendChild(vO);const yO=document.getElementById("checkboxTranslation"),bO=document.getElementById("checkboxShowRotation"),xO=document.getElementById("checkboxRotation"),TO=document.getElementById("checkboxOrthogonality");function CO(e){return 3!==e.length?"rgb(0, 0, 0)":`rgb(${(255*e[0]).toString()}, ${(255*e[1]).toString()}, ${(255*e[2]).toString()})`}const SO={...gO.getPlanes()};let PO=null;for(let e=0;e<4;e++){const t=document.createElement("div");t.setAttribute("class","view"),t.style.width="50%",t.style.height="300px",t.style.display="inline-block",hO.appendChild(t);const n=iS.newInstance();n.setContainer(t),n.resize();const r={renderWindow:n.getRenderWindow(),renderer:n.getRenderer(),GLWindow:n.getApiSpecificRenderWindow(),interactor:n.getInteractor(),widgetManager:zP.newInstance(),orientationWidget:null};r.renderer.getActiveCamera().setParallelProjection(!0),r.renderer.setBackground(...dO[e]),r.renderWindow.addRenderer(r.renderer),r.renderWindow.addView(r.GLWindow),r.renderWindow.setInteractor(r.interactor),r.interactor.setView(r.GLWindow),r.interactor.initialize(),r.interactor.bindEvents(t),r.widgetManager.setRenderer(r.renderer),e<3?(r.interactor.setInteractorStyle(cP.newInstance()),r.widgetInstance=r.widgetManager.addWidget(fO,hI[e]),r.widgetInstance.setScaleInPixels(!0),r.widgetInstance.setKeepOrthogonality(TO.checked),r.widgetInstance.setCursorStyles(mO),r.widgetManager.enablePicking(),r.widgetManager.setCaptureOn(IP.MOUSE_MOVE)):r.interactor.setInteractorStyle(eT.newInstance()),r.reslice=qS.newInstance(),r.reslice.setSlabMode(US.MEAN),r.reslice.setSlabNumberOfSlices(1),r.reslice.setTransformInputSampling(!1),r.reslice.setAutoCropOutput(!0),r.reslice.setOutputDimensionality(2),r.resliceMapper=vS.newInstance(),r.resliceMapper.setInputConnection(r.reslice.getOutputPort()),r.resliceActor=aP.newInstance(),r.resliceActor.setMapper(r.resliceMapper),r.sphereActors=[],r.sphereSources=[];for(let t=0;t<3;t++){const t=BA.newInstance();t.setRadius(10);const n=oc.newInstance();n.setInputConnection(t.getOutputPort());const o=hs.newInstance();o.setMapper(n),o.getProperty().setColor(...dO[e]),o.setVisibility(!0),r.sphereActors.push(o),r.sphereSources.push(t)}e<3?pO.push(r):PO=r;const o=hb.newInstance();o.setDefaultStyle({text:"+X",fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:CO(dO[0]),faceRotation:0,edgeThickness:.1,edgeColor:"black",resolution:400}),o.setXMinusFaceProperty({text:"-X",faceColor:CO(dO[0]),faceRotation:90,fontStyle:"italic"}),o.setYPlusFaceProperty({text:"+Y",faceColor:CO(dO[1]),fontSizeScale:e=>e/4}),o.setYMinusFaceProperty({text:"-Y",faceColor:CO(dO[1]),fontColor:"white"}),o.setZPlusFaceProperty({text:"+Z",faceColor:CO(dO[2])}),o.setZMinusFaceProperty({text:"-Z",faceColor:CO(dO[2]),faceRotation:45}),r.orientationWidget=SP.newInstance({actor:o,interactor:r.renderWindow.getInteractor()}),r.orientationWidget.setEnabled(!0),r.orientationWidget.setViewportCorner(SP.Corners.BOTTOM_RIGHT),r.orientationWidget.setViewportSize(.15),r.orientationWidget.setMinPixelSize(100),r.orientationWidget.setMaxPixelSize(300)}function AO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{viewType:"",reslice:null,actor:null,renderer:null,resetFocalPoint:!1,keepFocalPointPosition:!1,computeFocalPointOffset:!1,spheres:null};const t=fO.updateReslicePlane(e.reslice,e.viewType);if(t){const t=e.reslice.getResliceAxes();e.actor.setUserMatrix(t);const n=fO.getPlaneSource(e.viewType);e.sphereSources[0].setCenter(n.getOrigin()),e.sphereSources[1].setCenter(n.getPoint1()),e.sphereSources[2].setCenter(n.getPoint2())}return fO.updateCameraPoints(e.renderer,e.viewType,e.resetFocalPoint,e.keepFocalPointPosition,e.computeFocalPointOffset),PO.renderWindow.render(),t}const IO=zb.newInstance({fetchGzip:!0});function wO(){pO.forEach(((e,t)=>{AO({viewType:hI[t],reslice:e.reslice,actor:e.resliceActor,renderer:e.renderer,resetFocalPoint:!0,keepFocalPointPosition:!1,computeFocalPointOffset:!0,sphereSources:e.sphereSources,resetViewUp:!0}),e.renderWindow.render()})),PO.renderer.resetCamera(),PO.renderer.resetCameraClippingRange()}IO.setUrl("/vtk-js/data/volume/LIDC2.vti").then((()=>{IO.loadData().then((()=>{const e=IO.getOutputData();fO.setImage(e);const t=hP.newInstance();t.setInputData(e);const n=oc.newInstance();n.setInputData(t.getOutputData());const r=hs.newInstance();r.setMapper(n),PO.renderer.addActor(r),pO.forEach(((t,n)=>{t.reslice.setInputData(e),t.renderer.addActor(t.resliceActor),PO.renderer.addActor(t.resliceActor),t.sphereActors.forEach((e=>{t.renderer.addActor(e),PO.renderer.addActor(e)}));const r=t.reslice,o=hI[n];pO.forEach((e=>{e.widgetInstance.onInteractionEvent((e=>{let{computeFocalPointOffset:n,canUpdateFocalPoint:a}=e;const i=fO.getWidgetState().getActiveViewType()!==o&&a;AO({viewType:o,reslice:r,actor:t.resliceActor,renderer:t.renderer,resetFocalPoint:!1,keepFocalPointPosition:i,computeFocalPointOffset:n,sphereSources:t.sphereSources})}))})),AO({viewType:o,reslice:r,actor:t.resliceActor,renderer:t.renderer,resetFocalPoint:!0,keepFocalPointPosition:!1,computeFocalPointOffset:!0,sphereSources:t.sphereSources}),t.interactor.render()})),PO.renderer.resetCamera(),PO.renderer.resetCameraClippingRange();const o=Sn(e.getDimensions());document.getElementById("slabNumber").max=o}))})),yO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setEnableTranslation(yO.checked)))})),bO.addEventListener("change",(e=>{gO.getStatesWithLabel("rotation").forEach((e=>e.setVisible(bO.checked))),pO.forEach((e=>{e.interactor.render()})),xO.checked=bO.checked,xO.disabled=!bO.checked,xO.dispatchEvent(new Event("change"))})),xO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setEnableRotation(xO.checked))),TO.disabled=!xO.checked,TO.dispatchEvent(new Event("change"))})),TO.addEventListener("change",(e=>{pO.forEach((e=>e.widgetInstance.setKeepOrthogonality(TO.checked)))}));const OO=document.getElementById("checkboxScaleInPixels");OO.addEventListener("change",(e=>{fO.setScaleInPixels(OO.checked),pO.forEach((e=>{e.interactor.render()}))})),document.getElementById("opacity").addEventListener("input",(e=>{document.getElementById("opacityValue").innerHTML=e.target.value,fO.getWidgetState().getStatesWithLabel("handles").forEach((t=>t.setOpacity(e.target.value))),pO.forEach((e=>{e.interactor.render()}))})),document.getElementById("slabModeMin").value=US.MIN,document.getElementById("slabModeMax").value=US.MAX,document.getElementById("slabModeMean").value=US.MEAN,document.getElementById("slabModeSum").value=US.SUM,document.getElementById("slabMode").addEventListener("change",(e=>{pO.forEach((t=>{t.reslice.setSlabMode(Number(e.target.value))})),wO()})),document.getElementById("slabNumber").addEventListener("change",(e=>{document.getElementById("slabNumberValue").innerHTML=e.target.value,pO.forEach((t=>{t.reslice.setSlabNumberOfSlices(e.target.value)})),wO()})),document.getElementById("buttonReset").addEventListener("click",(()=>{gO.setPlanes({...SO}),fO.setCenter(fO.getWidgetState().getImage().getCenter()),wO()})),document.getElementById("selectInterpolation").addEventListener("change",(e=>{pO.forEach((t=>{t.reslice.setInterpolationMode(Number(e.target.selectedIndex))})),wO()}));const MO=document.getElementById("checkboxWindowLevel");MO.addEventListener("change",(e=>{pO.forEach(((e,t)=>{t<3&&e.interactor.setInteractorStyle(MO.checked?cP.newInstance():eT.newInstance())}))}))},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),a=Object.prototype.toString,i=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),c=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===a.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},a=r(t);o&&(a=i.call(a,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var h=0;h=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),a=n(965),i=n(332),s=n(65),l=n(182),c=n(293);c.alea=r,c.xor128=o,c.xorwow=a,c.xorshift7=i,c.xor4096=s,c.tychei=l,e.exports=c},64:function(e,t,n){var r;!function(e,o,a){function i(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new i(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,a=t.i;return t.w=r=r+1640531527|0,n=o[a+34&127],e=o[a=a+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[a]=n^e,t.i=a,n+(r^r>>>16)|0},function(e,t){var n,r,o,a,i,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,a=-32;a>>15,r^=r<<4,r^=r>>>13,a>=0&&(i=i+1640531527|0,o=0==(n=s[127&a]^=r+i)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,a=512;a>0;--a)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=i,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,a){function i(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new i(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,a,i){var s,l=256,c=i.pow(l,6),u=i.pow(2,52),d=2*u,p=255;function f(e,t,n){var r=[],p=v(h((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(a)]}}():e,3),r),f=new g(r),b=function(){for(var e=f.g(6),t=c,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),a),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(i.random=e,t):e})(b,p,"global"in t?t.global:this==i,t.state)}function g(e){var t,n=e.length,r=this,o=0,a=r.i=r.j=0,i=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|a>>>20)+n|0)&n|~a&r)+t[2]+606105819|0)<<17|o>>>15)+a|0)&a|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|a>>>20)+n|0)&n|~a&r)+t[6]-1473231341|0)<<17|o>>>15)+a|0)&a|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|a>>>20)+n|0)&n|~a&r)+t[10]-42063|0)<<17|o>>>15)+a|0)&a|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&o|~r&a)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|a>>>20)+n|0)&n|~a&r)+t[14]-1502002290|0)<<17|o>>>15)+a|0)&a|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|a>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+a|0)&n|a&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|a>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+a|0)&n|a&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|a>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+a|0)&n|a&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r&a|o&~a)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|a>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+a|0)&n|a&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|a>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+a|0)^a^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|a>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+a|0)^a^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|a>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+a|0)^a^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((a=((a+=((n=((n+=(r^o^a)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|a>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+a|0)^a^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[14]-1416354905|0)<<15|o>>>17)+a|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[10]-1051523|0)<<15|o>>>17)+a|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[6]-1560198380|0)<<15|o>>>17)+a|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((a=((a+=(r^((n=((n+=(o^(r|~a))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|a>>>22)+n|0)^((o=((o+=(n^(a|~r))+t[2]+718787259|0)<<15|o>>>17)+a|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=a+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function a(e){var t,o,a,i,s,l,c=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(u,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}function i(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tc?new ArrayBuffer(0):(r=c-l,o=new ArrayBuffer(r),a=new Uint8Array(o),i=new Uint8Array(this,l,r),a.set(i),o)}}(),u.prototype.append=function(e){return this.appendBinary(l(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},u.prototype.end=function(e){var t,n,r=this._buff,o=r.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,t){var r,o,a,i=t;if(e[i>>2]|=128<<(i%4<<3),i>55)for(n(this._hash,e),i=0;i<16;i+=1)e[i]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),a=parseInt(r[1],16)||0,e[14]=o,e[15]=a,n(this._hash,e)},u.hash=function(e,t){return u.hashBinary(l(e),t)},u.hashBinary=function(e,t){var n=s(a(e));return t?c(n):n},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var t,r,a,i,s,l=(r=this._buff.buffer,a=e,i=!0,(s=new Uint8Array(r.byteLength+a.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(a),r.byteLength),i?s:s.buffer),c=l.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(a,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),a=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(n(u,a),t=0;t<16;t+=1)a[t]=0;return i=(i=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),l=parseInt(i[1],16)||0,a[14]=s,a[15]=l,n(u,a),u}(new Uint8Array(e)));return t?c(r):r},u}()},782:function(e,t,n){var r=n(860),o=n(903);void 0===o.ResliceCursorWidget&&(o.ResliceCursorWidget=r),e.exports=r},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n(782)}(); \ No newline at end of file diff --git a/examples/ResliceRepresentationProxy.html b/examples/ResliceRepresentationProxy.html index d97b7a72250..f2db5a332e9 100644 --- a/examples/ResliceRepresentationProxy.html +++ b/examples/ResliceRepresentationProxy.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SLICSource.html b/examples/SLICSource.html index f05fe00340f..6a5137a2e86 100644 --- a/examples/SLICSource.html +++ b/examples/SLICSource.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/STLReader.html b/examples/STLReader.html index c49cf563163..3f98a5de780 100644 --- a/examples/STLReader.html +++ b/examples/STLReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/STLWriter.html b/examples/STLWriter.html index 4df71611fbe..a5a7045d6ea 100644 --- a/examples/STLWriter.html +++ b/examples/STLWriter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ScalarBarActor.html b/examples/ScalarBarActor.html index f83273ea81a..5c2b39b681d 100644 --- a/examples/ScalarBarActor.html +++ b/examples/ScalarBarActor.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ScalarToRGBA.html b/examples/ScalarToRGBA.html index ae44dc8b55c..15004a41612 100644 --- a/examples/ScalarToRGBA.html +++ b/examples/ScalarToRGBA.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SceneExplorer.html b/examples/SceneExplorer.html index fafe359437f..bea5b92f3a0 100644 --- a/examples/SceneExplorer.html +++ b/examples/SceneExplorer.html @@ -48,8 +48,8 @@ - - + + @@ -142,7 +142,7 @@

    diff --git a/examples/Scrolling2DMixedImages.html b/examples/Scrolling2DMixedImages.html index 66a28bc906b..c0fb99a71ed 100644 --- a/examples/Scrolling2DMixedImages.html +++ b/examples/Scrolling2DMixedImages.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SeedWidget.html b/examples/SeedWidget.html index 9570dd58d6a..c29261f262c 100644 --- a/examples/SeedWidget.html +++ b/examples/SeedWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ShapeWidget.html b/examples/ShapeWidget.html index 5e0bd3a3171..9b3d3083cc6 100644 --- a/examples/ShapeWidget.html +++ b/examples/ShapeWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SimpleCone.html b/examples/SimpleCone.html index cce66a5d2f5..b852227db80 100644 --- a/examples/SimpleCone.html +++ b/examples/SimpleCone.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SkyboxViewer.html b/examples/SkyboxViewer.html index 9cdbcae81bf..d123fbfb145 100644 --- a/examples/SkyboxViewer.html +++ b/examples/SkyboxViewer.html @@ -48,8 +48,8 @@ - - + + @@ -201,7 +201,7 @@

    diff --git a/examples/SphereArray.html b/examples/SphereArray.html index 83455b76ea0..d222c22e85c 100644 --- a/examples/SphereArray.html +++ b/examples/SphereArray.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SphereMapper.html b/examples/SphereMapper.html index 6c23d82610b..6eafa941166 100644 --- a/examples/SphereMapper.html +++ b/examples/SphereMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SphereSource.html b/examples/SphereSource.html index 25c93551c2f..5ad359cc1c4 100644 --- a/examples/SphereSource.html +++ b/examples/SphereSource.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SphereWidget.html b/examples/SphereWidget.html index 2babb46606b..563c3fbfdb7 100644 --- a/examples/SphereWidget.html +++ b/examples/SphereWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SpheresAndLabels.html b/examples/SpheresAndLabels.html index 8773863120a..d648958a778 100644 --- a/examples/SpheresAndLabels.html +++ b/examples/SpheresAndLabels.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SplineWidget.html b/examples/SplineWidget.html index 411cf069758..e9f518f1864 100644 --- a/examples/SplineWidget.html +++ b/examples/SplineWidget.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/StandaloneSceneLoader.html b/examples/StandaloneSceneLoader.html index 1c2ff90b312..6c214e3c6af 100644 --- a/examples/StandaloneSceneLoader.html +++ b/examples/StandaloneSceneLoader.html @@ -48,8 +48,8 @@ - - + + @@ -137,7 +137,7 @@

    diff --git a/examples/StickMapper.html b/examples/StickMapper.html index 0eabf058751..13efe59b71f 100644 --- a/examples/StickMapper.html +++ b/examples/StickMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SurfaceLICMapper.html b/examples/SurfaceLICMapper.html index 91bb2bd7f82..1889141d4fd 100644 --- a/examples/SurfaceLICMapper.html +++ b/examples/SurfaceLICMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/SynchronizableRenderWindow.html b/examples/SynchronizableRenderWindow.html index c1f7a79e41d..db1d56763ad 100644 --- a/examples/SynchronizableRenderWindow.html +++ b/examples/SynchronizableRenderWindow.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TestVolumeTypes.html b/examples/TestVolumeTypes.html index 21755aa8b75..83d8b330ff3 100644 --- a/examples/TestVolumeTypes.html +++ b/examples/TestVolumeTypes.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/Texture.html b/examples/Texture.html index 15ff6d058a8..bdfa51cc27b 100644 --- a/examples/Texture.html +++ b/examples/Texture.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TimeSeries.html b/examples/TimeSeries.html index 9c172e4bb68..83310bb752c 100644 --- a/examples/TimeSeries.html +++ b/examples/TimeSeries.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TimeStepBasedAnimationHandler.html b/examples/TimeStepBasedAnimationHandler.html index c72ccc51f14..2b49493742d 100644 --- a/examples/TimeStepBasedAnimationHandler.html +++ b/examples/TimeStepBasedAnimationHandler.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TriangleFilter.html b/examples/TriangleFilter.html index aba056e9072..9b1079d5db2 100644 --- a/examples/TriangleFilter.html +++ b/examples/TriangleFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TubeFilter.html b/examples/TubeFilter.html index b0baa82f79a..e077c7c9af7 100644 --- a/examples/TubeFilter.html +++ b/examples/TubeFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/TubesViewer.html b/examples/TubesViewer.html index 9f67eb8deef..66558e814e7 100644 --- a/examples/TubesViewer.html +++ b/examples/TubesViewer.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VR.html b/examples/VR.html index b754209c6dd..277482affbf 100644 --- a/examples/VR.html +++ b/examples/VR.html @@ -48,8 +48,8 @@ - - + + @@ -129,7 +129,7 @@

    diff --git a/examples/View2DProxy.html b/examples/View2DProxy.html index d50f7cb6502..3da5f2935da 100644 --- a/examples/View2DProxy.html +++ b/examples/View2DProxy.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeClipPlane.html b/examples/VolumeClipPlane.html index d502c8e071d..f07c541eed2 100644 --- a/examples/VolumeClipPlane.html +++ b/examples/VolumeClipPlane.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeContour.html b/examples/VolumeContour.html index 5ed1d5a74f8..87fb1d7cbce 100644 --- a/examples/VolumeContour.html +++ b/examples/VolumeContour.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeMapper.html b/examples/VolumeMapper.html index 3944460ae3c..0449fdb9f29 100644 --- a/examples/VolumeMapper.html +++ b/examples/VolumeMapper.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeMapperBlendModes.html b/examples/VolumeMapperBlendModes.html index cbd6dfab7e9..5825a09e766 100644 --- a/examples/VolumeMapperBlendModes.html +++ b/examples/VolumeMapperBlendModes.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeMapperLightAndShadow.html b/examples/VolumeMapperLightAndShadow.html index 6a137aaa314..623d522e695 100644 --- a/examples/VolumeMapperLightAndShadow.html +++ b/examples/VolumeMapperLightAndShadow.html @@ -48,8 +48,8 @@ - - + + @@ -134,7 +134,7 @@

    diff --git a/examples/VolumeMapperParallelProjection.html b/examples/VolumeMapperParallelProjection.html index a2a8a9c4fed..2a4e0c72c0c 100644 --- a/examples/VolumeMapperParallelProjection.html +++ b/examples/VolumeMapperParallelProjection.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeOutline.html b/examples/VolumeOutline.html index 5757dc0cd56..4b51b5539a7 100644 --- a/examples/VolumeOutline.html +++ b/examples/VolumeOutline.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumePicker.html b/examples/VolumePicker.html index 09aff71f7dd..23795266698 100644 --- a/examples/VolumePicker.html +++ b/examples/VolumePicker.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeRenderingWithPolyData.html b/examples/VolumeRenderingWithPolyData.html index 6565230b5aa..1decc73b4ec 100644 --- a/examples/VolumeRenderingWithPolyData.html +++ b/examples/VolumeRenderingWithPolyData.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/VolumeViewer.html b/examples/VolumeViewer.html index ad2a0dcd91d..534482da49b 100644 --- a/examples/VolumeViewer.html +++ b/examples/VolumeViewer.html @@ -48,8 +48,8 @@ - - + + @@ -162,7 +162,7 @@

    diff --git a/examples/WarpScalar.html b/examples/WarpScalar.html index fe997b5f472..efd18673ae9 100644 --- a/examples/WarpScalar.html +++ b/examples/WarpScalar.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/WebXRChestCTBlendedCVR.html b/examples/WebXRChestCTBlendedCVR.html index 88c552693b0..50d81b4c0ce 100644 --- a/examples/WebXRChestCTBlendedCVR.html +++ b/examples/WebXRChestCTBlendedCVR.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.html b/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.html index b777d32ed5a..61df1f975ee 100644 --- a/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.html +++ b/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.html @@ -8,7 +8,7 @@
    diff --git a/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.js b/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.js index 3223ff25afb..1029bd1deec 100644 --- a/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.js +++ b/examples/WebXRChestCTBlendedCVR/WebXRChestCTBlendedCVR.js @@ -1,2 +1,2 @@ /*! For license information please see WebXRChestCTBlendedCVR.js.LICENSE.txt */ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},845:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),te(t.resliceAxes,n)?null:(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return 0}return 1}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),gt.algo(e,t,1,1),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(566),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/item/62b38b37bddec9d0c45366e3/download"}=bh();wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r/2),Cx.addPoint(-1024,0),Cx.addPoint(67.4682,0),Cx.addPoint(67.469,0),Cx.addPoint(85,.1),Cx.addPoint(85.0031,0),Cx.addPoint(200.0031,0),Cx.addPoint(200.297,.626),Cx.addPoint(408.297,.626),Cx.addPoint(3532,.556),wx.addRGBPoint(-1024,.937254,.937254,.937254),wx.addRGBPoint(4.0927,.709019,.337254,.262745),wx.addRGBPoint(98.8057,.601372,.290196,.247058),wx.addRGBPoint(100,.881,.836078,.773333),wx.addRGBPoint(1e3,.881,.836078,.773333),wx.addRGBPoint(3532,.91,.826078,.783333),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Tx.getProperty().setAmbient(.2),Tx.getProperty().setDiffuse(1.3),Tx.getProperty().setSpecular(0),Sx.setGlobalIlluminationReach(.1),Sx.setVolumetricScatteringBlending(.5),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();let o=0;const i=document.createElement("button");let a="XR not available!";i.textContent=a,void 0!==navigator.xr&&bx.getXrSupported()&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?(o=fy.MobileAR,a="Start AR",i.textContent=a):navigator.xr.isSessionSupported("immersive-vr").then((e=>{e&&(o=fy.HmdVR,a="Start VR",i.textContent=a)}))})),i.addEventListener("click",(()=>{i.textContent===a?(bx.startXR(o),i.textContent="Exit XR"):(bx.stopXR(),i.textContent=a)})),document.querySelector(".content").appendChild(i)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},566:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},714:function(e,t,n){var r=n(845),o=n(903);void 0===o.WebXRChestCTBlendedCVR&&(o.WebXRChestCTBlendedCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(714)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},845:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),!te(t.resliceAxes,n)&&(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return!1}return!0}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(566),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/item/62b38b37bddec9d0c45366e3/download"}=bh();wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r/2),Cx.addPoint(-1024,0),Cx.addPoint(67.4682,0),Cx.addPoint(67.469,0),Cx.addPoint(85,.1),Cx.addPoint(85.0031,0),Cx.addPoint(200.0031,0),Cx.addPoint(200.297,.626),Cx.addPoint(408.297,.626),Cx.addPoint(3532,.556),wx.addRGBPoint(-1024,.937254,.937254,.937254),wx.addRGBPoint(4.0927,.709019,.337254,.262745),wx.addRGBPoint(98.8057,.601372,.290196,.247058),wx.addRGBPoint(100,.881,.836078,.773333),wx.addRGBPoint(1e3,.881,.836078,.773333),wx.addRGBPoint(3532,.91,.826078,.783333),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Tx.getProperty().setAmbient(.2),Tx.getProperty().setDiffuse(1.3),Tx.getProperty().setSpecular(0),Sx.setGlobalIlluminationReach(.1),Sx.setVolumetricScatteringBlending(.5),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();let o=0;const i=document.createElement("button");let a="XR not available!";i.textContent=a,void 0!==navigator.xr&&bx.getXrSupported()&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?(o=fy.MobileAR,a="Start AR",i.textContent=a):navigator.xr.isSessionSupported("immersive-vr").then((e=>{e&&(o=fy.HmdVR,a="Start VR",i.textContent=a)}))})),i.addEventListener("click",(()=>{i.textContent===a?(bx.startXR(o),i.textContent="Exit XR"):(bx.stopXR(),i.textContent=a)})),document.querySelector(".content").appendChild(i)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$
    ")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},566:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},714:function(e,t,n){var r=n(845),o=n(903);void 0===o.WebXRChestCTBlendedCVR&&(o.WebXRChestCTBlendedCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(714)}(); \ No newline at end of file diff --git a/examples/WebXRHeadFullVolumeCVR.html b/examples/WebXRHeadFullVolumeCVR.html index 9705e1f99c6..39c0bc1b26e 100644 --- a/examples/WebXRHeadFullVolumeCVR.html +++ b/examples/WebXRHeadFullVolumeCVR.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.html b/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.html index 47a70101fe7..7c9a0e3e421 100644 --- a/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.html +++ b/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.html @@ -8,7 +8,7 @@
    diff --git a/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.js b/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.js index 44b9a1f06c1..46bc65abb0f 100644 --- a/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.js +++ b/examples/WebXRHeadFullVolumeCVR/WebXRHeadFullVolumeCVR.js @@ -1,2 +1,2 @@ /*! For license information please see WebXRHeadFullVolumeCVR.js.LICENSE.txt */ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},36:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),te(t.resliceAxes,n)?null:(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return 0}return 1}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),gt.algo(e,t,1,1),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(230),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null}=bh();let Dx=Ex;Object.values(fy).includes(Dx)||(console.warn("Could not parse requested XR session type: ",Dx),Dx=null),Dx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill({numViews:12})})):null===Dx&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?Dx=fy.MobileAR:navigator.xr.isSessionSupported("immersive-vr").then((e=>{Dx=e?fy.HmdVR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[-1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r),Cx.addPoint(0,0),Cx.addPoint(1100.58,.0117188),Cx.addPoint(2334.07,.808594),Cx.addPoint(3305.9,0),Cx.addPoint(4095,0),wx.addRGBPoint(0,0,0,0),wx.addRGBPoint(490.071,.901961,0,0),wx.addRGBPoint(1449.45,.866667,.0745098,.0196078),wx.addRGBPoint(1511.74,.631373,.552941,.152941),wx.addRGBPoint(2321.61,.992157,.992157,.984314),wx.addRGBPoint(4095,1,1,1),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Tx.getProperty().setAmbient(0),Tx.getProperty().setDiffuse(2),Tx.getProperty().setSpecular(0),Sx.setGlobalIlluminationReach(1),Sx.setVolumetricScatteringBlending(1),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();const o=document.createElement("button");let i="XR not available!";o.textContent=i,void 0!==navigator.xr&&bx.getXrSupported()&&(i=Dx===fy.MobileAR?"Start AR":"Start VR",o.textContent=i),o.addEventListener("click",(()=>{o.textContent===i?(bx.startXR(Dx),o.textContent="Exit XR"):(bx.stopXR(),o.textContent=i)})),document.querySelector(".content").appendChild(o)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},230:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},298:function(e,t,n){var r=n(36),o=n(903);void 0===o.WebXRHeadFullVolumeCVR&&(o.WebXRHeadFullVolumeCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(298)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},36:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),!te(t.resliceAxes,n)&&(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return!1}return!0}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(230),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null}=bh();let Dx=Ex;Object.values(fy).includes(Dx)||(console.warn("Could not parse requested XR session type: ",Dx),Dx=null),Dx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill({numViews:12})})):null===Dx&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?Dx=fy.MobileAR:navigator.xr.isSessionSupported("immersive-vr").then((e=>{Dx=e?fy.HmdVR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[-1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r),Cx.addPoint(0,0),Cx.addPoint(1100.58,.0117188),Cx.addPoint(2334.07,.808594),Cx.addPoint(3305.9,0),Cx.addPoint(4095,0),wx.addRGBPoint(0,0,0,0),wx.addRGBPoint(490.071,.901961,0,0),wx.addRGBPoint(1449.45,.866667,.0745098,.0196078),wx.addRGBPoint(1511.74,.631373,.552941,.152941),wx.addRGBPoint(2321.61,.992157,.992157,.984314),wx.addRGBPoint(4095,1,1,1),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Tx.getProperty().setAmbient(0),Tx.getProperty().setDiffuse(2),Tx.getProperty().setSpecular(0),Sx.setGlobalIlluminationReach(1),Sx.setVolumetricScatteringBlending(1),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();const o=document.createElement("button");let i="XR not available!";o.textContent=i,void 0!==navigator.xr&&bx.getXrSupported()&&(i=Dx===fy.MobileAR?"Start AR":"Start VR",o.textContent=i),o.addEventListener("click",(()=>{o.textContent===i?(bx.startXR(Dx),o.textContent="Exit XR"):(bx.stopXR(),o.textContent=i)})),document.querySelector(".content").appendChild(o)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$
    ")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},230:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},298:function(e,t,n){var r=n(36),o=n(903);void 0===o.WebXRHeadFullVolumeCVR&&(o.WebXRHeadFullVolumeCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(298)}(); \ No newline at end of file diff --git a/examples/WebXRHeadGradientCVR.html b/examples/WebXRHeadGradientCVR.html index c0ffed3b0c0..ecf33312cb3 100644 --- a/examples/WebXRHeadGradientCVR.html +++ b/examples/WebXRHeadGradientCVR.html @@ -48,8 +48,8 @@ - - + + @@ -122,7 +122,7 @@

    diff --git a/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.html b/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.html index 8a61dc5bc0e..ac6b05492b8 100644 --- a/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.html +++ b/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.html @@ -8,7 +8,7 @@
    diff --git a/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.js b/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.js index 10dd50604d1..78a44cc396a 100644 --- a/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.js +++ b/examples/WebXRHeadGradientCVR/WebXRHeadGradientCVR.js @@ -1,2 +1,2 @@ /*! For license information please see WebXRHeadGradientCVR.js.LICENSE.txt */ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},706:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),te(t.resliceAxes,n)?null:(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return 0}return 1}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),gt.algo(e,t,1,1),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(759),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null}=bh();let Dx=Ex;Object.values(fy).includes(Dx)||(console.warn("Could not parse requested XR session type: ",Dx),Dx=null),Dx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill})):null===Dx&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?Dx=fy.MobileAR:navigator.xr.isSessionSupported("immersive-vr").then((e=>{Dx=e?fy.HmdVR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[-1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r),Cx.addPoint(0,0),Cx.addPoint(1100.58,.0117188),Cx.addPoint(2334.07,.808594),Cx.addPoint(3305.9,0),Cx.addPoint(4095,0),wx.addRGBPoint(0,0,0,0),wx.addRGBPoint(490.071,.901961,0,0),wx.addRGBPoint(1449.45,.866667,.0745098,.0196078),wx.addRGBPoint(1511.74,.631373,.552941,.152941),wx.addRGBPoint(2321.61,.992157,.992157,.984314),wx.addRGBPoint(4095,1,1,1),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Sx.setGlobalIlluminationReach(0),Sx.setVolumetricScatteringBlending(0),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();const o=document.createElement("button");let i="XR not available!";o.textContent=i,void 0!==navigator.xr&&bx.getXrSupported()&&(i=Dx===fy.MobileAR?"Start AR":"Start VR",o.textContent=i),o.addEventListener("click",(()=>{o.textContent===i?(bx.startXR(Dx),o.textContent="Exit XR"):(bx.stopXR(),o.textContent=i)})),document.querySelector(".content").appendChild(o)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},759:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},295:function(e,t,n){var r=n(706),o=n(903);void 0===o.WebXRHeadGradientCVR&&(o.WebXRHeadGradientCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},480:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(295)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},706:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return P},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return O},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,O=y*I-b*D+x*E+_*A-T*C+S*w;return O?(O=1/O,e[0]=(s*I-l*D+u*E)*O,e[1]=(o*D-r*I-i*E)*O,e[2]=(m*S-g*T+v*_)*O,e[3]=(p*T-d*S-f*_)*O,e[4]=(l*A-a*I-u*C)*O,e[5]=(n*I-o*A+i*C)*O,e[6]=(g*x-h*S-v*b)*O,e[7]=(c*S-p*x+f*b)*O,e[8]=(a*D-s*A+u*w)*O,e[9]=(r*A-n*D-i*w)*O,e[10]=(h*T-m*x+v*y)*O,e[11]=(d*x-c*T-f*y)*O,e[12]=(s*C-a*E-l*w)*O,e[13]=(n*E-r*C+o*w)*O,e[14]=(m*b-h*_-g*y)*O,e[15]=(c*_-d*b+p*y)*O,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],O=r[1],P=r[2],N=Math.hypot(I,O,P);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),P(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,O=(f-x)*T,P=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=O,e[5]=P,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+O*C+M*A),e[13]=n[1]+C-(D*w+P*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],O=t[11],P=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-O)<=o*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(m-P)<=o*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Oe,newTypedArrayFrom:Pe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Oe,newTypedArrayFrom:Pe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Ot={};function Pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ot,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Pt,"vtkOpenGLViewNodeFactory"),extend:Pt};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Or(e){return Math.round(255*e)}var Pr={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:Pn,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Or).join(", ")})`:`rgba(${Or(e[0]||0)}, ${Or(e[1]||0)}, ${Or(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Oe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Pe(t.dataType,t.values)):t.values=Oe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Oo={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Po={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Po;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Po};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Oi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Pi(e,t,n,r){Oi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Oi,computeNormal:Pi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Pi(e,t,n,d),Pi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,O=50,P=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(O=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(P=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[O],A[O]=e}if(C>2){C--;const e=E[2];E[2]=E[P],E[P]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Pi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Oi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Oo.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Pe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/P>1e6||Math.abs(Math.log10(P))>3||0===P&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Oa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Pa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Oa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Oa.Lines||n===Oa.TrisEdges||n===Oa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Oa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Oa.Points?2:t.primitiveType===Oa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Pa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Oa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||On(n.width)&&On(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),O=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Pr.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Pr.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Pr.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Pr.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Pr.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Os,e.Fragment=Ps,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],O=[],P=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),O[0+3*D]=A[0],O[1+3*D]=A[1],O[2+3*D]=A[2],P[0+3*D]=-.5*A[0],P[1+3*D]=-.5*A[1],P[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",O),s.setUniform3fv("lightHalfAngleVC",P),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Ol(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Pl={newInstance:gt.newInstance(Ol,"vtkWebGPUShaderModule"),extend:Ol};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Pu=Ou;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Oe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Oc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Pc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Oc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Pc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var O=0,P=0;for(16==D?(P=3+od(e,u,3),u+=2,O=T[w-1]):17==D?(P=3+od(e,u,7),u+=3):18==D&&(P=11+od(e,u,127),u+=7);P--;)T[w++]=O}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&O)>m){i&&ld(0);break}if(O||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Od(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Pd=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Pd(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Od(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Op(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Pp={newInstance:gt.newInstance(Op,"vtkLight"),extend:Op,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Pp.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Of(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Pf(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Of(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Pf(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Of};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Oh={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Ph}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Ph("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Om={framebuffer:null,copyShader:null,tris:null};function Pm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Om,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Pm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Pm};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Og(){Dg++,Ig.forEach((e=>e(Dg)))}function Pg(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Pg),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Og(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Ov(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Pv={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pv,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Ov(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const{vtkErrorMacro:Cy}=gt;function Ay(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(Cy("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return Cy("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return Cy("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Cy("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const Ey={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function Dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),Ay(e,t)}var Iy={newInstance:gt.newInstance(Dy,"vtkPiecewiseFunction"),extend:Dy};const{InterpolationType:Oy,OpacityMode:Py}=nl,{vtkErrorMacro:Ny}=gt;function My(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(Ny("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=Iy.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=Iy.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return Ny("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(Ny("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(Oy.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(Oy.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(Oy.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(Oy,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const Ry={independentComponents:!0,interpolationType:Oy.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function Fy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Ry,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:Py.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),My(e,t)}var ky={newInstance:gt.newInstance(Fy,"vtkVolumeProperty"),extend:Fy,...nl};const{vtkDebugMacro:Ly}=gt;function By(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=ky.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){Ly("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const Vy={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Uy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,n),Oh.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),By(e,t)}var Gy={newInstance:gt.newInstance(Uy,"vtkVolume"),extend:Uy};const{BlendMode:zy,FilterMode:jy}=ol,Wy={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=Iy.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function Hy(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(zy.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(zy.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(zy.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(zy.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(zy.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(zy.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(zy,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(jy,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(jy.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(jy.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(jy.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Xy={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:zy.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:jy.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Ky(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),Hy(e,t)}var qy={newInstance:gt.newInstance(Ky,"vtkVolumeMapper"),extend:Ky,...Wy},$y=n(206);function Yy(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Zy({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Jy={name:"",numberOfComponents:1,size:0,dataType:"string"};function Qy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Jy,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Yy(e,t)}const Zy=gt.newInstance(Qy,"vtkStringArray");var eb={newInstance:Zy,extend:Qy};function tb(e){return new TextDecoder("latin1").decode(e)}var nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=tb(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:rb,vtkDebugMacro:ob}=gt,ib=()=>(rb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let ab=0;function sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const lb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?ib():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=sb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++ab&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(ob(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&rb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?ib():new Promise(((r,o)=>{const i=sb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++ab&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--ab&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=sb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function ub(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>lb));const cb={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},db={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function pb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Pd(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=mb(e,o);c=new cb[a](t.buffer),/^U?Int64$/.test(a)&&(c=pb(c))}else c=new cb[a](e.buffer,db[o]),-1!==a.indexOf("Int64")&&(c=pb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=fb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function vb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function yb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,$y.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(ub(s,"AppendedData")){const e=ub(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(gb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=eb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const bb={};var xb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),yb(e,t)},_b=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});_b(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),_b(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Sb={dataType:"ImageData"};function wb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),xb(e,t,n),Tb(e,t)}var Cb={newInstance:gt.newInstance(wb,"vtkXMLImageDataReader"),extend:wb};const Ab={CLAMP:0,REPEAT:1,MIRROR:2},Eb={NEAREST:0,LINEAR:1,CUBIC:2};var Db={ImageBorderMode:Ab,InterpolationMode:Eb};const Ib={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Ab.CLAMP,interpolationMode:Eb.LINEAR,extraInfo:null},Ob={...Ib,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Pb(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Nb(e){return Math.round(e)}function Mb(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function Rb(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Fb(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:kb}=Db;function Lb(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Bb={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:kb.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Ib},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function Vb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bb,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),Lb(e,t)}var Ub={newInstance:gt.newInstance(Vb,"vtkAbstractImageInterpolator"),extend:Vb,...Db};function Gb(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Eb.LINEAR?n=2:t.interpolationMode===Eb.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Nb(t[0]),s=Nb(t[1]),l=Nb(t[2]);switch(e.borderMode){case Ab.REPEAT:a=Rb(a,r[0],r[1]),s=Rb(s,r[2],r[3]),l=Rb(l,r[4],r[5]);break;case Ab.MIRROR:a=Fb(a,r[0],r[1]),s=Fb(s,r[2],r[3]),l=Fb(l,r[4],r[5]);break;default:a=Mb(a,r[0],r[1]),s=Mb(s,r[2],r[3]),l=Mb(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Pb(t[0]),s=Pb(t[1]),l=Pb(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Ab.REPEAT:u=Rb(u,r[0],r[1]),c=Rb(c,r[2],r[3]),d=Rb(d,r[4],r[5]),m=Rb(m,r[0],r[1]),g=Rb(g,r[2],r[3]),v=Rb(v,r[4],r[5]);break;case Ab.MIRROR:u=Fb(u,r[0],r[1]),c=Fb(c,r[2],r[3]),d=Fb(d,r[4],r[5]),m=Fb(m,r[0],r[1]),g=Fb(g,r[2],r[3]),v=Fb(v,r[4],r[5]);break;default:u=Mb(u,r[0],r[1]),c=Mb(c,r[2],r[3]),d=Mb(d,r[4],r[5]),m=Mb(m,r[0],r[1]),g=Mb(g,r[2],r[3]),v=Mb(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,O=1-h,P=I*O,N=f*O,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateLinear(n,r,o);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,O=C*A,P=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Eb.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Eb.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Ob.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Eb.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Eb.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const zb={interpolationMode:Eb.NEAREST};function jb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zb,n),Ub.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Gb(e,t)}var Wb={newInstance:gt.newInstance(jb,"vtkImageInterpolator"),extend:jb};function Hb(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Xb={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Kb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xb,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Hb(e,t)}var qb={newInstance:gt.newInstance(Kb,"vtkImagePointDataIterator"),extend:Kb},$b={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:Yb}=$b,{vtkErrorMacro:Jb}=gt;function Qb(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),!te(t.resliceAxes,n)&&(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Jb("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Eb.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Ab.CLAMP;I=t.wrap?Ab.REPEAT:I,I=t.mirror?Ab.MIRROR:I,t.interpolator.setBorderMode(I);const O=762939453125e-17;let P=.5*t.border;P=I===Ab.CLAMP?P:4294967294,P=P>O?P:O,t.interpolator.setTolerance(P),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Eb.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Eb.NEAREST&&y===Ab.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],O=[0,0,0,0],P=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],O[e]=c[8+e],P[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Eb.LINEAR||d>1&&t.slabMode===Yb.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=qb.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=P[0]+V*O[0],U[1]=P[1]+V*O[1],U[2]=P[2]+V*O[2],U[3]=P[3]+V*O[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Nb(a[0])-x[0],h=Nb(a[1])-x[2],g=Nb(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*O[0],s[1]=a[1]+e*O[1],s[2]=a[2]+e*O[2],s[3]=a[3]+e*O[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Pr.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case Yb.MIN:n=s;break;case Yb.MAX:n=l;break;case Yb.MEAN:n=t?d:u;break;case Yb.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Pb(o).error,s=Pb(i).error;if(0!==a||0!==s)return!1}return!0}}const Zb={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Eb.NEAREST,slabMode:Yb.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:Wb.newInstance(),usePermuteExecute:!1};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkImageReslice"),extend:ex,...$b},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(759),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=Cb.newInstance(),_x=tx.newInstance(),Tx=Gy.newInstance(),Sx=qy.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=Iy.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null}=bh();let Dx=Ex;Object.values(fy).includes(Dx)||(console.warn("Could not parse requested XR session type: ",Dx),Dx=null),Dx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill})):null===Dx&&navigator.xr.isSessionSupported("immersive-ar").then((e=>{e?Dx=fy.MobileAR:navigator.xr.isSessionSupported("immersive-vr").then((e=>{Dx=e?fy.HmdVR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();E(t,Pr.radiansFromDegrees(90),[-1,0,0]),_x.setResliceAxes(t);const n=_x.getOutputData(0),r=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(r),Cx.addPoint(0,0),Cx.addPoint(1100.58,.0117188),Cx.addPoint(2334.07,.808594),Cx.addPoint(3305.9,0),Cx.addPoint(4095,0),wx.addRGBPoint(0,0,0,0),wx.addRGBPoint(490.071,.901961,0,0),wx.addRGBPoint(1449.45,.866667,.0745098,.0196078),wx.addRGBPoint(1511.74,.631373,.552941,.152941),wx.addRGBPoint(2321.61,.992157,.992157,.984314),wx.addRGBPoint(4095,1,1,1),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),Tx.getProperty().setShade(!0),Sx.setGlobalIlluminationReach(0),Sx.setVolumetricScatteringBlending(0),Sx.setVolumeShadowSamplingDistFactor(1),Sx.setAutoAdjustSampleDistances(!1),vx.resetCamera(),yx.render();const o=document.createElement("button");let i="XR not available!";o.textContent=i,void 0!==navigator.xr&&bx.getXrSupported()&&(i=Dx===fy.MobileAR?"Start AR":"Start VR",o.textContent=i),o.addEventListener("click",(()=>{o.textContent===i?(bx.startXR(Dx),o.textContent="Exit XR"):(bx.stopXR(),o.textContent=i)})),document.querySelector(".content").appendChild(o)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=O;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=P},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),O=n(57),P=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=O("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(P,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),P[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var O=e._previousSibling,P=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],O,P)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((P=C.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((P=D.value)._nodeType===l.NodeType.Element&&P!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),O=I.next();!O.done;O=I.next()){var P;if((P=O.value)._nodeType===l.NodeType.DocumentType&&P!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{O&&!O.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],O=1;O=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){P=F;break}if(null!==P)if(l.Guard.isNode(P.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(P.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(P.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var O=n(162);t.NodeList=O.NodeListImpl;var P=n(163);t.NodeListStatic=P.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(O(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&P(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&P(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&O(t[0])||e.path.splice(e.path.length-1,1))}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&P(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=O,t.isWindowsDriveLetter=P,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$
    ")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=O.slice(0,E),L=O.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,P=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=O?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;P--){var N;if(b(N=O[P],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var O=null;if(!c.tree_isAncestorOf(T,w,!0))for(var P=i(A._children),N=P.length-1;N>0;N--){var M;if(b(M=P[N],t)){O=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(O)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==O&&(L=f.node_clone(O),_.append(L),B=x(u.create_range([O,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var O=r(I.value,2),P=O[0],N=O[1];if("xmlns"===P)A=N;else{var M=r(l.namespace_extractQName(P),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(P=U[0],N=U[1],r(l.namespace_extractQName(P),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,P,this._decodeAttributeValue(N)):k.setAttribute(P,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),O=I.next();!O.done;O=I.next()){var P=i(O.value,2),N=P[0],M=P[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function O(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(O(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(O(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return O(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},759:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},295:function(e,t,n){var r=n(706),o=n(903);void 0===o.WebXRHeadGradientCVR&&(o.WebXRHeadGradientCVR=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},480:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(295)}(); \ No newline at end of file diff --git a/examples/WebXRVolume.html b/examples/WebXRVolume.html index 3b9fb94a058..268d53e7a36 100644 --- a/examples/WebXRVolume.html +++ b/examples/WebXRVolume.html @@ -48,8 +48,8 @@ - - + + @@ -156,7 +156,7 @@

    diff --git a/examples/WebXRVolume/WebXRVolume.html b/examples/WebXRVolume/WebXRVolume.html index df93338d7d7..cf06346fba6 100644 --- a/examples/WebXRVolume/WebXRVolume.html +++ b/examples/WebXRVolume/WebXRVolume.html @@ -8,7 +8,7 @@
    diff --git a/examples/WebXRVolume/WebXRVolume.js b/examples/WebXRVolume/WebXRVolume.js index 26b0d860e4d..6e9dc0bf027 100644 --- a/examples/WebXRVolume/WebXRVolume.js +++ b/examples/WebXRVolume/WebXRVolume.js @@ -1,2 +1,2 @@ /*! For license information please see WebXRVolume.js.LICENSE.txt */ -!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},775:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return O},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return P},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,P=y*I-b*D+x*E+_*A-T*C+S*w;return P?(P=1/P,e[0]=(s*I-l*D+u*E)*P,e[1]=(o*D-r*I-i*E)*P,e[2]=(m*S-g*T+v*_)*P,e[3]=(p*T-d*S-f*_)*P,e[4]=(l*A-a*I-u*C)*P,e[5]=(n*I-o*A+i*C)*P,e[6]=(g*x-h*S-v*b)*P,e[7]=(c*S-p*x+f*b)*P,e[8]=(a*D-s*A+u*w)*P,e[9]=(r*A-n*D-i*w)*P,e[10]=(h*T-m*x+v*y)*P,e[11]=(d*x-c*T-f*y)*P,e[12]=(s*C-a*E-l*w)*P,e[13]=(n*E-r*C+o*w)*P,e[14]=(m*b-h*_-g*y)*P,e[15]=(c*_-d*b+p*y)*P,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],P=r[1],O=r[2],N=Math.hypot(I,P,O);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),O(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,P=(f-x)*T,O=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=P,e[5]=O,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+P*C+M*A),e[13]=n[1]+C-(D*w+O*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],P=t[11],O=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-P)<=o*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(m-O)<=o*Math.max(1,Math.abs(m),Math.abs(O))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Pe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Pe,newTypedArrayFrom:Oe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Pe,newTypedArrayFrom:Oe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Pt={};function Ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pt,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Ot,"vtkOpenGLViewNodeFactory"),extend:Ot};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Pr(e){return Math.round(255*e)}var Or={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:On,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Pr).join(", ")})`:`rgba(${Pr(e[0]||0)}, ${Pr(e[1]||0)}, ${Pr(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Pe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Oe(t.dataType,t.values)):t.values=Pe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Po={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Oo={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Oo;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Oo};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Pi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Oi(e,t,n,r){Pi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Pi,computeNormal:Oi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Oi(e,t,n,d),Oi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,P=50,O=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(P=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(O=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[P],A[P]=e}if(C>2){C--;const e=E[2];E[2]=E[O],E[O]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Oi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Pi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Po.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Oe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/O>1e6||Math.abs(Math.log10(O))>3||0===O&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Pa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Oa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Pa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Pa.Lines||n===Pa.TrisEdges||n===Pa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Pa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Pa.Points?2:t.primitiveType===Pa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Oa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Pa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||Pn(n.width)&&Pn(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),P=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Or.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Or.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Or.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Or.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Or.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Ps,e.Fragment=Os,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Ps,e.Fragment=Os,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],P=[],O=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),P[0+3*D]=A[0],P[1+3*D]=A[1],P[2+3*D]=A[2],O[0+3*D]=-.5*A[0],O[1+3*D]=-.5*A[1],O[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",P),s.setUniform3fv("lightHalfAngleVC",O),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Pl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Ol={newInstance:gt.newInstance(Pl,"vtkWebGPUShaderModule"),extend:Pl};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Ou=Pu;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Pe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Pc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Oc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Pc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Oc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var P=0,O=0;for(16==D?(O=3+od(e,u,3),u+=2,P=T[w-1]):17==D?(O=3+od(e,u,7),u+=3):18==D&&(O=11+od(e,u,127),u+=7);O--;)T[w++]=P}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&P)>m){i&&ld(0);break}if(P||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Pd(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Od=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Od(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Pd(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Pp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Op={newInstance:gt.newInstance(Pp,"vtkLight"),extend:Pp,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Op.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Pf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Of(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Pf(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Of(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Pf};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Ph={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Oh}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Oh("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Ph.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Pm={framebuffer:null,copyShader:null,tris:null};function Om(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pm,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Om,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Om};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Pg(){Dg++,Ig.forEach((e=>e(Dg)))}function Og(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Og),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Pg(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Pv(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Ov={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ov,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Pv(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const Cy={CLAMP:0,REPEAT:1,MIRROR:2},Ay={NEAREST:0,LINEAR:1,CUBIC:2};var Ey={ImageBorderMode:Cy,InterpolationMode:Ay};const Dy={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Cy.CLAMP,interpolationMode:Ay.LINEAR,extraInfo:null},Iy={...Dy,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Py(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Oy(e){return Math.round(e)}function Ny(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function My(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Ry(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:Fy}=Ey;function ky(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Ly={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:Fy.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Dy},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function By(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ly,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),ky(e,t)}var Vy={newInstance:gt.newInstance(By,"vtkAbstractImageInterpolator"),extend:By,...Ey};function Uy(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Ay.LINEAR?n=2:t.interpolationMode===Ay.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Oy(t[0]),s=Oy(t[1]),l=Oy(t[2]);switch(e.borderMode){case Cy.REPEAT:a=My(a,r[0],r[1]),s=My(s,r[2],r[3]),l=My(l,r[4],r[5]);break;case Cy.MIRROR:a=Ry(a,r[0],r[1]),s=Ry(s,r[2],r[3]),l=Ry(l,r[4],r[5]);break;default:a=Ny(a,r[0],r[1]),s=Ny(s,r[2],r[3]),l=Ny(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Py(t[0]),s=Py(t[1]),l=Py(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Cy.REPEAT:u=My(u,r[0],r[1]),c=My(c,r[2],r[3]),d=My(d,r[4],r[5]),m=My(m,r[0],r[1]),g=My(g,r[2],r[3]),v=My(v,r[4],r[5]);break;case Cy.MIRROR:u=Ry(u,r[0],r[1]),c=Ry(c,r[2],r[3]),d=Ry(d,r[4],r[5]),m=Ry(m,r[0],r[1]),g=Ry(g,r[2],r[3]),v=Ry(v,r[4],r[5]);break;default:u=Ny(u,r[0],r[1]),c=Ny(c,r[2],r[3]),d=Ny(d,r[4],r[5]),m=Ny(m,r[0],r[1]),g=Ny(g,r[2],r[3]),v=Ny(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,P=1-h,O=I*P,N=f*P,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Ay.LINEAR:e.interpolateLinear(n,r,o);break;case Ay.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,P=C*A,O=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Ay.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Ay.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Iy.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Ay.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Ay.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const Gy={interpolationMode:Ay.NEAREST};function zy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gy,n),Vy.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Uy(e,t)}var jy={newInstance:gt.newInstance(zy,"vtkImageInterpolator"),extend:zy};function Wy(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Hy={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Xy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hy,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Wy(e,t)}var Ky={newInstance:gt.newInstance(Xy,"vtkImagePointDataIterator"),extend:Xy},qy={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:$y}=qy,{vtkErrorMacro:Yy}=gt;function Jy(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),te(t.resliceAxes,n)?null:(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Yy("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Ay.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Cy.CLAMP;I=t.wrap?Cy.REPEAT:I,I=t.mirror?Cy.MIRROR:I,t.interpolator.setBorderMode(I);const P=762939453125e-17;let O=.5*t.border;O=I===Cy.CLAMP?O:4294967294,O=O>P?O:P,t.interpolator.setTolerance(O),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Ay.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Ay.NEAREST&&y===Cy.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],P=[0,0,0,0],O=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],P[e]=c[8+e],O[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Ay.LINEAR||d>1&&t.slabMode===$y.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=Ky.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=O[0]+V*P[0],U[1]=O[1]+V*P[1],U[2]=O[2]+V*P[2],U[3]=O[3]+V*P[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Oy(a[0])-x[0],h=Oy(a[1])-x[2],g=Oy(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*P[0],s[1]=a[1]+e*P[1],s[2]=a[2]+e*P[2],s[3]=a[3]+e*P[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Or.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case $y.MIN:n=s;break;case $y.MAX:n=l;break;case $y.MEAN:n=t?d:u;break;case $y.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return 0}return 1},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return 0;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Py(o).error,s=Py(i).error;if(0!==a||0!==s)return 0}return 1}}const Qy={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Ay.NEAREST,slabMode:$y.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:jy.newInstance(),usePermuteExecute:!1};function Zy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qy,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),gt.algo(e,t,1,1),Jy(e,t)}var eb={newInstance:gt.newInstance(Zy,"vtkImageReslice"),extend:Zy,...qy};const{vtkErrorMacro:tb}=gt;function nb(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(tb("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return tb("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return tb("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return tb("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const rb={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function ob(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rb,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),nb(e,t)}var ib={newInstance:gt.newInstance(ob,"vtkPiecewiseFunction"),extend:ob};const{InterpolationType:ab,OpacityMode:sb}=nl,{vtkErrorMacro:lb}=gt;function ub(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(lb("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=ib.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=ib.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return lb("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(lb("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(ab.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(ab.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(ab.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(ab,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const cb={independentComponents:!0,interpolationType:ab.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,cb,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:sb.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),ub(e,t)}var pb={newInstance:gt.newInstance(db,"vtkVolumeProperty"),extend:db,...nl};const{vtkDebugMacro:fb}=gt;function hb(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=pb.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){fb("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const mb={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function gb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mb,n),Ph.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),hb(e,t)}var vb={newInstance:gt.newInstance(gb,"vtkVolume"),extend:gb};const{BlendMode:yb,FilterMode:bb}=ol,xb={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=ib.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function _b(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(yb.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(yb.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(yb.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(yb.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(yb.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(yb.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(yb,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(bb,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(bb.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(bb.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(bb.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Tb={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:yb.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:bb.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tb,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),_b(e,t)}var wb={newInstance:gt.newInstance(Sb,"vtkVolumeMapper"),extend:Sb,...xb},Cb=n(206);function Ab(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Ib({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Eb={name:"",numberOfComponents:1,size:0,dataType:"string"};function Db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Eb,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Ab(e,t)}const Ib=gt.newInstance(Db,"vtkStringArray");var Pb={newInstance:Ib,extend:Db};function Ob(e){return new TextDecoder("latin1").decode(e)}var Nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=Ob(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:Mb,vtkDebugMacro:Rb}=gt,Fb=()=>(Mb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let kb=0;function Lb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const Bb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?Fb():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=Lb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++kb&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Rb(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Mb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Fb():new Promise(((r,o)=>{const i=Lb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++kb&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Fb():new Promise(((r,o)=>{const i=Lb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++kb&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=Lb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function Vb(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>Bb));const Ub={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},Gb={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function zb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Od(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=Hb(e,o);c=new Ub[a](t.buffer),/^U?Int64$/.test(a)&&(c=zb(c))}else c=new Ub[a](e.buffer,Gb[o]),-1!==a.indexOf("Int64")&&(c=zb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=jb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function Kb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function qb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=Nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,Cb.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(Vb(s,"AppendedData")){const e=Vb(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(Xb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=Pb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const $b={};var Yb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$b,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),qb(e,t)},Jb=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});Jb(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),Jb(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Zb={dataType:"ImageData"};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),Yb(e,t,n),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkXMLImageDataReader"),extend:ex},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(551),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=tx.newInstance(),_x=eb.newInstance(),Tx=vb.newInstance(),Sx=wb.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=ib.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null,colorPreset:Dx=null,rotateX:Ix=0,rotateY:Px=0,rotateZ:Ox=0}=bh();let Nx=Ex;Object.values(fy).includes(Nx)||(console.warn("Could not parse requested XR session type: ",Nx),Nx=null),Nx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill})):null===Nx&&navigator.xr.isSessionSupported("immersive-vr").then((e=>{e?Nx=fy.HmdVr:navigator.xr.isSessionSupported("immersive-ar").then((e=>{Nx=e?fy.MobileAR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();if(Ix){const e=l();E(e,Or.radiansFromDegrees(Ix),[1,0,0]),y(t,t,e)}if(Px){const e=l();E(e,Or.radiansFromDegrees(Px),[0,1,0]),y(t,t,e)}if(Ox){const e=l();E(e,Or.radiansFromDegrees(Ox),[0,0,1]),y(t,t,e)}_x.setResliceAxes(t);const n=_x.getOutputData(0),r=(n.getPointData().getScalars()||n.getPointData().getArrays()[0]).getRange(),o=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(o),"CT-AAA"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(143,.62,.36,.18),wx.addRGBPoint(166,.68,.6,.34),wx.addRGBPoint(214,.7,.7,.7),wx.addRGBPoint(419,.9,.84,.85),wx.addRGBPoint(3071,.83,.66,1),Cx.addPoint(-3024,0),Cx.addPoint(144,0),Cx.addPoint(166,.69),Cx.addPoint(214,.7),Cx.addPoint(420,.83),Cx.addPoint(3071,.8)):"CT-Bone"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(-16.4458,.729412,.254902,.301961),wx.addRGBPoint(641.385,.905882,.815686,.552941),wx.addRGBPoint(3071,1,1,1),Cx.addPoint(-3024,0),Cx.addPoint(-16.4458,0),Cx.addPoint(641.385,.715686),Cx.addPoint(3071,.705882)):"CT-Cardiac2"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(42,.55,.25,.15),wx.addRGBPoint(163,.92,.64,.06),wx.addRGBPoint(278,1,.88,.62),wx.addRGBPoint(1587,1,1,1),wx.addRGBPoint(3071,.83,.66,1),Cx.addPoint(-3024,0),Cx.addPoint(43,0),Cx.addPoint(163,.42),Cx.addPoint(277,.78),Cx.addPoint(1587,.75),Cx.addPoint(3071,.8)):"CT-Chest-Contrast-Enhanced"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(67.0106,.54902,.25098,.14902),wx.addRGBPoint(251.105,.882353,.603922,.290196),wx.addRGBPoint(439.291,1,.937033,.954531),wx.addRGBPoint(3071,.827451,.658824,1),Cx.addPoint(-3024,0),Cx.addPoint(67.0106,0),Cx.addPoint(251.105,.446429),Cx.addPoint(439.291,.625),Cx.addPoint(3071,.616071)):(wx.addRGBPoint(r[0],0,.3,.3),wx.addRGBPoint(r[1],1,1,1),Cx.addPoint(r[0],0),Cx.addPoint((r[1]-r[0])/4,0),Cx.addPoint(r[1],.5)),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),vx.resetCamera(),yx.render();const i=document.createElement("button");let a="XR not available!";i.textContent=a,void 0!==navigator.xr&&bx.getXrSupported()&&(a=Nx===fy.MobileAR?"Start AR":"Start VR",i.textContent=a),i.addEventListener("click",(()=>{i.textContent===a?(bx.startXR(Nx),i.textContent="Exit XR"):(bx.stopXR(),i.textContent=a)})),document.querySelector(".content").appendChild(i)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=P;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=O},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),P=n(57),O=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=P("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(O,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),O[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var P=e._previousSibling,O=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],P,O)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((O=C.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((O=D.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),P=I.next();!P.done;P=I.next()){var O;if((O=P.value)._nodeType===l.NodeType.DocumentType&&O!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{P&&!P.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],P=1;P=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){O=F;break}if(null!==O)if(l.Guard.isNode(O.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(O.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var P=n(162);t.NodeList=P.NodeListImpl;var O=n(163);t.NodeListStatic=O.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(P(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&O(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&O(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&P(t[0])||e.path.splice(e.path.length-1,1))}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&O(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=P,t.isWindowsDriveLetter=O,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=P.slice(0,E),L=P.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,O=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,P=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=P?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!P&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;O--){var N;if(b(N=P[O],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var P=null;if(!c.tree_isAncestorOf(T,w,!0))for(var O=i(A._children),N=O.length-1;N>0;N--){var M;if(b(M=O[N],t)){P=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(P)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==P&&(L=f.node_clone(P),_.append(L),B=x(u.create_range([P,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var P=r(I.value,2),O=P[0],N=P[1];if("xmlns"===O)A=N;else{var M=r(l.namespace_extractQName(O),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(O=U[0],N=U[1],r(l.namespace_extractQName(O),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,O,this._decodeAttributeValue(N)):k.setAttribute(O,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),P=I.next();!P.done;P=I.next()){var O=i(P.value,2),N=O[0],M=O[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{P&&!P.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function P(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(P(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(P(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return P(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},551:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},991:function(e,t,n){var r=n(775),o=n(903);void 0===o.WebXRVolume&&(o.WebXRVolume=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(991)}(); \ No newline at end of file +!function(){var e={334:function(){const e=document.querySelector("head");e&&[16,32,96,160,196].forEach((t=>{const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",`https://kitware.github.io/vtk-js/icon/favicon-${t}x${t}.png`),n.setAttribute("sizes",`${t}x${t}`),n.setAttribute("type","image/png"),e.appendChild(n)}))},775:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,{add:function(){return J},adjoint:function(){return g},clone:function(){return u},copy:function(){return c},create:function(){return l},determinant:function(){return v},equals:function(){return ne},exactEquals:function(){return te},frob:function(){return Y},fromQuat:function(){return B},fromQuat2:function(){return N},fromRotation:function(){return E},fromRotationTranslation:function(){return O},fromRotationTranslationScale:function(){return k},fromRotationTranslationScaleOrigin:function(){return L},fromScaling:function(){return A},fromTranslation:function(){return C},fromValues:function(){return d},fromXRotation:function(){return D},fromYRotation:function(){return I},fromZRotation:function(){return P},frustum:function(){return V},getRotation:function(){return F},getScaling:function(){return R},getTranslation:function(){return M},identity:function(){return f},invert:function(){return m},lookAt:function(){return K},mul:function(){return re},multiply:function(){return y},multiplyScalar:function(){return Z},multiplyScalarAndAdd:function(){return ee},ortho:function(){return H},orthoNO:function(){return W},orthoZO:function(){return X},perspective:function(){return G},perspectiveFromFieldOfView:function(){return j},perspectiveNO:function(){return U},perspectiveZO:function(){return z},rotate:function(){return _},rotateX:function(){return T},rotateY:function(){return S},rotateZ:function(){return w},scale:function(){return x},set:function(){return p},str:function(){return $},sub:function(){return oe},subtract:function(){return Q},targetTo:function(){return q},translate:function(){return b},transpose:function(){return h}});var o=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var a=Math.PI/180;function s(e){return e*a}function l(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){var t=new i(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n,r,o,a,s,l,u,c,d,p,f,h,m,g){var v=new i(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=u,v[9]=c,v[10]=d,v[11]=p,v[12]=f,v[13]=h,v[14]=m,v[15]=g,v}function p(e,t,n,r,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function f(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(e,t){if(e===t){var n=t[1],r=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function m(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15],y=n*s-r*a,b=n*l-o*a,x=n*u-i*a,_=r*l-o*s,T=r*u-i*s,S=o*u-i*l,w=c*m-d*h,C=c*g-p*h,A=c*v-f*h,E=d*g-p*m,D=d*v-f*m,I=p*v-f*g,P=y*I-b*D+x*E+_*A-T*C+S*w;return P?(P=1/P,e[0]=(s*I-l*D+u*E)*P,e[1]=(o*D-r*I-i*E)*P,e[2]=(m*S-g*T+v*_)*P,e[3]=(p*T-d*S-f*_)*P,e[4]=(l*A-a*I-u*C)*P,e[5]=(n*I-o*A+i*C)*P,e[6]=(g*x-h*S-v*b)*P,e[7]=(c*S-p*x+f*b)*P,e[8]=(a*D-s*A+u*w)*P,e[9]=(r*A-n*D-i*w)*P,e[10]=(h*T-m*x+v*y)*P,e[11]=(d*x-c*T-f*y)*P,e[12]=(s*C-a*E-l*w)*P,e[13]=(n*E-r*C+o*w)*P,e[14]=(m*b-h*_-g*y)*P,e[15]=(c*_-d*b+p*y)*P,e):null}function g(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],v=t[15];return e[0]=s*(p*v-f*g)-d*(l*v-u*g)+m*(l*f-u*p),e[1]=-(r*(p*v-f*g)-d*(o*v-i*g)+m*(o*f-i*p)),e[2]=r*(l*v-u*g)-s*(o*v-i*g)+m*(o*u-i*l),e[3]=-(r*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*v-f*g)-c*(l*v-u*g)+h*(l*f-u*p)),e[5]=n*(p*v-f*g)-c*(o*v-i*g)+h*(o*f-i*p),e[6]=-(n*(l*v-u*g)-a*(o*v-i*g)+h*(o*u-i*l)),e[7]=n*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*v-f*m)-c*(s*v-u*m)+h*(s*f-u*d),e[9]=-(n*(d*v-f*m)-c*(r*v-i*m)+h*(r*f-i*d)),e[10]=n*(s*v-u*m)-a*(r*v-i*m)+h*(r*u-i*s),e[11]=-(n*(s*f-u*d)-a*(r*f-i*d)+c*(r*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=n*(d*g-p*m)-c*(r*g-o*m)+h*(r*p-o*d),e[14]=-(n*(s*g-l*m)-a*(r*g-o*m)+h*(r*l-o*s)),e[15]=n*(s*p-l*d)-a*(r*p-o*d)+c*(r*l-o*s),e}function v(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-n*i)*(d*g-p*m)-(t*s-r*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(n*s-r*a)*(u*g-p*f)-(n*l-o*a)*(u*m-d*f)+(r*l-o*s)*(u*h-c*f)}function y(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=n[0],x=n[1],_=n[2],T=n[3];return e[0]=b*r+x*s+_*d+T*m,e[1]=b*o+x*l+_*p+T*g,e[2]=b*i+x*u+_*f+T*v,e[3]=b*a+x*c+_*h+T*y,b=n[4],x=n[5],_=n[6],T=n[7],e[4]=b*r+x*s+_*d+T*m,e[5]=b*o+x*l+_*p+T*g,e[6]=b*i+x*u+_*f+T*v,e[7]=b*a+x*c+_*h+T*y,b=n[8],x=n[9],_=n[10],T=n[11],e[8]=b*r+x*s+_*d+T*m,e[9]=b*o+x*l+_*p+T*g,e[10]=b*i+x*u+_*f+T*v,e[11]=b*a+x*c+_*h+T*y,b=n[12],x=n[13],_=n[14],T=n[15],e[12]=b*r+x*s+_*d+T*m,e[13]=b*o+x*l+_*p+T*g,e[14]=b*i+x*u+_*f+T*v,e[15]=b*a+x*c+_*h+T*y,e}function b(e,t,n){var r,o,i,a,s,l,u,c,d,p,f,h,m=n[0],g=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=r,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=r*m+s*g+d*v+t[12],e[13]=o*m+l*g+p*v+t[13],e[14]=i*m+u*g+f*v+t[14],e[15]=a*m+c*g+h*v+t[15]),e}function x(e,t,n){var r=n[0],o=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _(e,t,n,r){var i,a,s,l,u,c,d,p,f,h,m,g,v,y,b,x,_,T,S,w,C,A,E,D,I=r[0],P=r[1],O=r[2],N=Math.hypot(I,P,O);return N0?(n[0]=2*(l*s+d*r+u*a-c*o)/p,n[1]=2*(u*s+d*o+c*r-l*a)/p,n[2]=2*(c*s+d*a+l*o-u*r)/p):(n[0]=2*(l*s+d*r+u*a-c*o),n[1]=2*(u*s+d*o+c*r-l*a),n[2]=2*(c*s+d*a+l*o-u*r)),O(e,t,n),e}function M(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function R(e,t){var n=t[0],r=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(n,r,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function F(e,t){var n=new i(3);R(n,t);var r=1/n[0],o=1/n[1],a=1/n[2],s=t[0]*r,l=t[1]*o,u=t[2]*a,c=t[4]*r,d=t[5]*o,p=t[6]*a,f=t[8]*r,h=t[9]*o,m=t[10]*a,g=s+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-h)/v,e[1]=(f-u)/v,e[2]=(l-c)/v):s>d&&s>m?(v=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(f+u)/v):d>m?(v=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(p+h)/v):(v=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/v,e[0]=(f+u)/v,e[1]=(p+h)/v,e[2]=.25*v),e}function k(e,t,n,r){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,v=s*l,y=s*u,b=s*c,x=r[0],_=r[1],T=r[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+v)*_,e[7]=0,e[8]=(f+y)*T,e[9]=(m-v)*T,e[10]=(1-(d+h))*T,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L(e,t,n,r,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,v=s*d,y=l*u,b=l*c,x=l*d,_=r[0],T=r[1],S=r[2],w=o[0],C=o[1],A=o[2],E=(1-(m+v))*_,D=(f+x)*_,I=(h-b)*_,P=(f-x)*T,O=(1-(p+v))*T,N=(g+y)*T,M=(h+b)*S,R=(g-y)*S,F=(1-(p+m))*S;return e[0]=E,e[1]=D,e[2]=I,e[3]=0,e[4]=P,e[5]=O,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=n[0]+w-(E*w+P*C+M*A),e[13]=n[1]+C-(D*w+O*C+R*A),e[14]=n[2]+A-(I*w+N*C+F*A),e[15]=1,e}function B(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=n+n,s=r+r,l=o+o,u=n*a,c=r*a,d=r*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,v=i*l;return e[0]=1-d-h,e[1]=c+v,e[2]=p-g,e[3]=0,e[4]=c-v,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,n,r,o,i,a){var s=1/(n-t),l=1/(o-r),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+r)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function U(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=(o+r)*i,e[14]=2*o*r*i):(e[10]=-1,e[14]=-2*r),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var G=U;function z(e,t,n,r,o){var i,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(r-o),e[10]=o*i,e[14]=o*r*i):(e[10]=-1,e[14]=-r),e}function j(e,t,n,r){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function W(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=(a+i)*u,e[15]=1,e}var H=W;function X(e,t,n,r,o,i,a){var s=1/(t-n),l=1/(r-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+n)*s,e[13]=(o+r)*l,e[14]=i*u,e[15]=1,e}function K(e,t,n,r){var i,a,s,l,u,c,d,p,h,m,g=t[0],v=t[1],y=t[2],b=r[0],x=r[1],_=r[2],T=n[0],S=n[1],w=n[2];return Math.abs(g-T)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function $(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Y(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function J(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Z(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function ee(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function te(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=t[0],x=t[1],_=t[2],T=t[3],S=t[4],w=t[5],C=t[6],A=t[7],E=t[8],D=t[9],I=t[10],P=t[11],O=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(n-b)<=o*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=o*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-_)<=o*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-T)<=o*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=o*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-w)<=o*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(u-C)<=o*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-A)<=o*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=o*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=o*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=o*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-P)<=o*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(m-O)<=o*Math.max(1,Math.abs(m),Math.abs(O))&&Math.abs(g-N)<=o*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(v-M)<=o*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-R)<=o*Math.max(1,Math.abs(y),Math.abs(R))}var re=y,oe=Q;function ie(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ae(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function se(e,t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=n*d+r*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*r+o*u)*h,e[2]=(s*r-o*a)*h,e[3]=p*h,e[4]=(c*n-o*l)*h,e[5]=(-s*n+o*i)*h,e[6]=f*h,e[7]=(-u*n+r*l)*h,e[8]=(a*n-r*i)*h,e):null}function le(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=n[0],f=n[1],h=n[2],m=n[3],g=n[4],v=n[5],y=n[6],b=n[7],x=n[8];return e[0]=p*r+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*r+g*a+v*u,e[4]=m*o+g*s+v*c,e[5]=m*i+g*l+v*d,e[6]=y*r+b*a+x*u,e[7]=y*o+b*s+x*c,e[8]=y*i+b*l+x*d,e}n(334);var ue=n(152),ce=n.n(ue),de=n(177);const pe=n.n(de)()(),fe={vtkObject:()=>null};function he(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return pe.console&&pe.console.error&&pe.console.error("Invalid VTK object"),null;const t=fe[e.vtkClass];if(!t)return pe.console&&pe.console.error&&pe.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const n={...e};Object.keys(n).forEach((e=>{n[e]&&"object"==typeof n[e]&&n[e].vtkClass&&(n[e]=he(n[e]))}));const r=t(n);return r&&r.modified&&r.modified(),r}he.register=function(e,t){fe[e]=t};class me extends Array{push(){for(let e=0;e{ye[e]=be})),pe.console=console.hasOwnProperty("log")?console:ye;const xe={debug:be,error:pe.console.error||be,info:pe.console.info||be,log:pe.console.log||be,warn:pe.console.warn||be};function _e(e,t){xe[e]&&(xe[e]=t||be)}function Te(){xe.log(...arguments)}function Se(){xe.info(...arguments)}function we(){xe.debug(...arguments)}function Ce(){xe.error(...arguments)}function Ae(){xe.warn(...arguments)}const Ee={};function De(e){Ee[e]||(xe.error(e),Ee[e]=!0)}const Ie=Object.create(null);Ie.Float32Array=Float32Array,Ie.Float64Array=Float64Array,Ie.Uint8Array=Uint8Array,Ie.Int8Array=Int8Array,Ie.Uint16Array=Uint16Array,Ie.Int16Array=Int16Array,Ie.Uint32Array=Uint32Array,Ie.Int32Array=Int32Array,Ie.Uint8ClampedArray=Uint8ClampedArray;try{Ie.BigInt64Array=BigInt64Array,Ie.BigUint64Array=BigUint64Array}catch{}function Pe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const r=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>n;)o/=n,i=r.pop();return`${o.toFixed(t)} ${i}`}function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const n=[];let r=e;for(;r>1e3;)n.push(("000"+r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)}function Le(e){Object.keys(e).forEach((t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))}))}function Be(e){return Object.values(Ie).some((t=>e instanceof t))}function Ve(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n{const e=performance.now()-n;t(e)}))}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le(t);const n=[];if(Number.isInteger(t.mtime)||(t.mtime=++ge),"classHierarchy"in t){if(!(t.classHierarchy instanceof me)){const e=new me;for(let n=0;n!!t.deleted,e.modified=r=>{t.deleted?Ce("instance deleted - cannot call any method"):r&&rt&&t(e))))},e.onModified=e=>{if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const r=n.length;return n.push(e),o(r)},e.getMTime=()=>t.mtime,e.isA=e=>{let n=t.classHierarchy.length;for(;n--;)if(t.classHierarchy[n]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach((a=>{const s=o?null:e[`set${Ne(a)}`];s&&Array.isArray(n[a])&&s.length>1?i=s(...n[a])||i:s?i=s(n[a])||i:(-1!==["mtime"].indexOf(a)||r||Ae(`Warning: Set value to model directly ${a}, ${n[a]}`),i=t[a]!==n[a]||i,t[a]=n[a])})),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r{o[e]=t[e]})),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach((e=>delete t[e])),n.forEach(((e,t)=>r(t))),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};Object.keys(n).forEach((e=>{null===n[e]||void 0===n[e]||"_"===e[0]?delete n[e]:n[e].isA?n[e]=n[e].getState():Array.isArray(n[e])?n[e]=n[e].map(Ue):Be(n[e])&&(n[e]=Array.from(n[e]))}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.shallowCopy=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${n.getClassName()} into ${e.getClassName()}`);const o=n.get(),i=Object.keys(t).sort(),a=Object.keys(o).sort();a.forEach((e=>{const n=i.indexOf(e);-1===n?r&&we(`add ${e} in shallowCopy`):i.splice(n,1),t[e]=o[e]})),i.length&&r&&we(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const We={object:(e,t,n)=>function(){return{...t[n.name]}}};function He(e,t,n){n.forEach((n=>{if("object"==typeof n){const r=We[n.type];e[`get${Me(n.name)}`]=r?r(e,t,n):()=>t[n.name]}else e[`get${Me(n)}`]=()=>t[n]}))}const Xe={enum(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==n.enum[o])return t[n.name]!==n.enum[o]&&(t[n.name]=n.enum[o],e.modified(),!0);throw Ce(`Set Enum with invalid argument ${n}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[n.name]!==o){if(-1!==Object.keys(n.enum).map((e=>n.enum[e])).indexOf(o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}throw Ce(`Set Enum outside numeric range ${n}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ce(`Set Enum with invalid argument (String/Number) ${n}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,n){const r=`_on${Me(n.name)}Changed`;return o=>{if(!ce()(t[n.name],o)){const i=t[n.name];return t[n.name]=o,t[r]?.(e,t,o,i),e.modified(),!0}return!1}}};function Ke(e){if("object"==typeof e){const t=Xe[e.type];if(t)return(n,r)=>t(n,r,e);throw Ce(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,n){const r=`_on${Me(e)}Changed`;return function(o){if(n.deleted)return Ce("instance deleted - cannot call any method"),!1;if(n[e]!==o){const i=n[e.name];return n[e]=o,n[r]?.(t,n,o,i),t.modified(),!0}return!1}}}function qe(e,t,n){n.forEach((n=>{"object"==typeof n?e[`set${Me(n.name)}`]=Ke(n)(e,t):e[`set${Me(n)}`]=Ke(n)(e,t)}))}function $e(e,t,n){He(e,t,n),qe(e,t,n)}function Ye(e,t,n){n.forEach((n=>{e[`get${Me(n)}`]=()=>t[n]?Array.from(t[n]):t[n],e[`get${Me(n)}ByReference`]=()=>t[n]}))}function Je(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach((n=>{if(t[n]&&r&&t[n].length!==r)throw new RangeError(`Invalid initial number of values for array (${n})`);const i=`_on${Me(n)}Changed`;e[`set${Me(n)}`]=function(){if(t.deleted)return Ce("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[n]!==c;else{if(r&&c.length!==r){if(!(c.length{const r=t[n];e.forEach(((e,t)=>{r[t]=e}))}}))}function Qe(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;Ye(e,t,n),Je(e,t,n,r,o)}function Ze(e,t,n){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ce("instance deleted - cannot call any method"):r>=t.numberOfInputs?Ce(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function i(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ce("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){let n=`algorithm ${e.getClassName()} only has `;return n+=`${t.numberOfInputs}`,n+=" input ports. To add more input ports, use addInputConnection()",void Ce(n)}t.inputData[r]=null,t.inputConnection[r]=n}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ce("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(he):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(he):t.inputConnection=[],t.output?t.output=t.output.map(he):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(he):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=()=>{const n=e.getMTime();let o=1/0,i=r;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let n=t.numberOfInputs;for(;n--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ce("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ce("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}r&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=()=>s(t);return n.filter=e,n}),e.update=()=>{const n=[];if(t.numberOfInputs){let r=0;for(;rt.numberOfInputs,e.getNumberOfOutputPorts=()=>r||t.output.length,e.getInputArrayToProcess=e=>{const n=t.inputArrayToProcess[e],r=t.inputData[e];return n&&r?r[`get${n.fieldAssociation}`]().getArray(n.arrayName):null},e.setInputArrayToProcess=function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthr.apply(e,arguments)),1-o);else if(r.apply(e,arguments)===tt)break}},e[`on${Me(n)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${n}`),null;if(t.deleted)return Ce("instance deleted - cannot call any method"),null;const a=i++;return r.push([a,e,o]),r.sort(((e,t)=>t[2]-e[2])),s(a)},e.delete=()=>{o(),r.forEach((e=>{let[t]=e;return a(t)}))}}function rt(e,t){const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={},r={};return e(r,n,t),Object.freeze(r)};return t&&he.register(t,n),n}function ot(){for(var e=arguments.length,t=new Array(e),n=0;n!!e)).map((e=>e(...n)))}}function it(e){return e&&e.isA&&e.isA("vtkObject")}function at(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(it(e)){if(r.indexOf(e)>=0)return n;r.push(e);const o=t(e);void 0!==o&&n.push(o);const i=e.get();Object.keys(i).forEach((e=>{const o=i[e];Array.isArray(o)?o.forEach((e=>{at(e,t,n,r)})):at(o,t,n,r)}))}return n}function st(e,t,n){var r=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,n||e.apply(l,a)},c=n&&!o;clearTimeout(o),o=setTimeout(u,t),c&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function lt(e,t){let n=!1,r=null;function o(){n=!1,null!==r&&(i(...r),r=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=(e,n)=>{t.keystore[e]=n},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach((e=>delete t.keystore[e]))}let ct=1;const dt="__root__";function pt(e,t){ut(e,t);const n=e.delete;t.proxyId=""+ct++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),He(e,t,["proxyId","proxyGroup","proxyName"]),$e(e,t,["proxyManager"]);const r={},o={};function i(e,t){o[t]||(o[t]=[]);const n=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:dt;return o[e]}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dt;const r=[],o=t.proxyId,i=a(n)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(n||[])),Object.keys(r).forEach((e=>delete r[e])),Object.keys(o).forEach((e=>delete o[e])),i(t.ui,dt),e.modified()},e.updateProxyProperty=(e,t)=>{const n=r[e];n?Object.assign(n,t):r[e]={...t}},e.activate=()=>{if(t.proxyManager){const n=`setActive${Me(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[n]&&t.proxyManager[n](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,n)=>{n in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[n]=[]),t.propertyLinkSubscribers[n].push(e)},e.gcPropertyLinks=n=>{const r=t.propertyLinkSubscribers[n]||[];for(;r.length;)r.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let r=null;const o=[];let i=0,a=!1;function s(n){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===n?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${Me(u.propertyName)}`]();if(!Ve(c,r)||s){for(r=c,a=!0;l.length;){const e=l.pop();e.instance.set({[e.propertyName]:r})}a=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=c),c}function l(e,t){const n=[];for(i=o.length;i--;){const r=o[i];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(i))}for(;n.length;)o.splice(n.pop(),1)}function u(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=n.onModified(s),u=o[0];return o.push({instance:n,propertyName:r,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set({[r]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(n,r)}}function c(){for(;o.length;)o.pop().subscription.unsubscribe()}const d={bind:u,unbind:l,unsubscribe:c,persistent:n};return t.propertyLinkMap[e]=d,d},e.listPropertyNames=()=>s().map((e=>e.name)),e.getPropertyByName=e=>s().find((t=>t.name===e)),e.getPropertyDomainByName=e=>(r[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}),e.delete=()=>{const r=Object.keys(t.propertyLinkMap);let o=r.length;for(;o--;)t.propertyLinkMap[r[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},e.getState=()=>null,Ge((function(){if(t.links)for(let n=0;n{for(;o.length;)o.pop().unsubscribe();r()}}function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const n=Object.keys(e);let r=n.length;for(;r--;){const o=n[r];t[o].set(e[o])}}t.this=e;const i=Object.keys(r);let a=i.length;for(;a--;){const s=i[a];t[s]=r[s];const l=n[s];e[`set${Me(s)}`]=n=>{n!==t[s]&&(t[s]=n,o(l[n]),e.modified())}}i.length&&He(e,t,i)}function mt(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n||t,pixelX:r,pixelY:o||r}}var gt={algo:et,capitalize:Ne,chain:ot,debounce:st,enumToString:function(e,t){return Object.keys(e).find((n=>e[n]===t))},event:nt,EVENT_ABORT:tt,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,get:He,getArray:Ye,getCurrentGlobalMTime:function(){return ge},getStateArrayMapFunc:Ue,isVtkObject:it,keystore:ut,measurePromiseExecution:ze,moveToProtected:Ze,newInstance:rt,newTypedArray:Pe,newTypedArrayFrom:Oe,normalizeWheel:mt,obj:je,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,safeArrays:Le,set:qe,setArray:Je,setGet:$e,setGetArray:Qe,setImmediate:Ge,setLoggerFunction:_e,throttle:lt,traverseInstanceTree:at,TYPED_ARRAYS:Ie,uncapitalize:Re,VOID:ve,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkInfoMacro:Se,vtkLogMacro:Te,vtkOnceErrorMacro:De,vtkWarningMacro:Ae},vt=Object.freeze({__proto__:null,VOID:ve,setLoggerFunction:_e,vtkLogMacro:Te,vtkInfoMacro:Se,vtkDebugMacro:we,vtkErrorMacro:Ce,vtkWarningMacro:Ae,vtkOnceErrorMacro:De,TYPED_ARRAYS:Ie,newTypedArray:Pe,newTypedArrayFrom:Oe,capitalize:Ne,_capitalize:Me,uncapitalize:Re,formatBytesToProperUnit:Fe,formatNumbersWithThousandSeparator:ke,setImmediateVTK:Ge,measurePromiseExecution:ze,obj:je,get:He,set:qe,setGet:$e,getArray:Ye,setArray:Je,setGetArray:Qe,moveToProtected:Ze,algo:et,EVENT_ABORT:tt,event:nt,newInstance:rt,chain:ot,isVtkObject:it,traverseInstanceTree:at,debounce:st,throttle:lt,keystore:ut,proxy:pt,proxyPropertyMapping:ft,proxyPropertyState:ht,normalizeWheel:mt,default:gt});const{vtkErrorMacro:yt}=gt;function bt(e,t){t.classHierarchy.push("vtkViewNode"),e.build=e=>{},e.render=e=>{},e.traverse=n=>{const r=n.getTraverseOperation(),o=e[r];if(o)o(n);else{e.apply(n,!0);for(let e=0;e{const r=e[t.getOperation()];r&&r(n,t)},e.getViewNodeFor=n=>{if(t.renderable===n)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.addMissingNode=n=>{if(!n)return;const r=t._renderableChildMap.get(n);if(void 0!==r)r.setVisited(!0);else{const r=e.createViewNode(n);r&&(r.setParent(e),r.setVisited(!0),t._renderableChildMap.set(n,r),t.children.push(r))}},e.addMissingNodes=n=>{if(n&&n.length)for(let r=0;r{if(n&&n.length)for(let r=0;r{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let n=0;n{if(!t.myFactory)return yt("Cannot create view nodes without my own factory"),null;const n=t.myFactory.createNode(e);return n&&n.setRenderable(e),n};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),gt.obj(e,t),gt.event(e,t,"event"),t._renderableChildMap=new Map,gt.get(e,t,["visited"]),gt.setGet(e,t,["_parent","renderable","myFactory"]),gt.getArray(e,t,["children"]),gt.moveToProtected(e,t,["parent"]),bt(e,t)}var Tt={newInstance:gt.newInstance(_t,"vtkViewNode"),extend:_t,PASS_TYPES:["Build","Render"]};function St(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=n=>{if(n.isDeleted())return null;let r=0,o=n.getClassName(r++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=n.getClassName(r++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s},e.registerOverride=(e,n)=>{t.overrides[e]=n}}const wt={};function Ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wt,n),gt.obj(e,t),St(e,t)}var At={newInstance:gt.newInstance(Ct,"vtkViewNodeFactory"),extend:Ct};const Et=Object.create(null);function Dt(e,t){Et[e]=t}function It(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}const Pt={};function Ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pt,n),t.overrides=Et,At.extend(e,t,n),It(0,t)}var Nt={newInstance:gt.newInstance(Ot,"vtkOpenGLViewNodeFactory"),extend:Ot};function Mt(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=n=>{n&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=n=>{if(n!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){c(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),ie(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),se(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();c(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),h(t.keyMatrices.vcpc,t.keyMatrices.vcpc),y(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}const Rt={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const Ft=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},$e(e,t,["context","keyMatrixTime"]),Mt(e,t)}));Dt("vtkCamera",Ft);const{vtkDebugMacro:kt}=vt;function Lt(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(kt("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=n=>{if(n){let n=0;const r=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),n|=r.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.colorMask(!0,!0,!0,!0),n&&r.clear(n),r.enable(r.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let n=0;const r=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();t.context.clearColor(e[0],e[1],e[2],e[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,t.context.depthMask(!0)),r.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n&&r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach((e=>{e.modified()}))},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Bt={context:null,_openGLRenderWindow:null,selector:null};const Vt=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bt,n),Tt.extend(e,t,n),He(e,t,["shaderCache"]),$e(e,t,["selector"]),Ze(0,t,["openGLRenderWindow"]),Lt(e,t)}),"vtkOpenGLRenderer");function Ut(){var e=new i(3);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Gt(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function zt(e,t,n){var r=new i(3);return r[0]=e,r[1]=t,r[2]=n,r}function jt(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function Wt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Ht(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function Xt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Kt(e,t){var n=t[0],r=t[1],o=t[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $t(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-i*s,e[1]=i*a-r*l,e[2]=r*s-o*a,e}function Yt(e,t,n){var r=t[0],o=t[1],i=t[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,e[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,e[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,e[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,e}function Jt(e,t,n){var r=t[0],o=t[1],i=t[2];return e[0]=r*n[0]+o*n[3]+i*n[6],e[1]=r*n[1]+o*n[4]+i*n[7],e[2]=r*n[2]+o*n[5]+i*n[8],e}function Qt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Zt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function en(e,t){var n=e[0],r=e[1],i=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(n-a)<=o*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=o*Math.max(1,Math.abs(i),Math.abs(l))}Dt("vtkRenderer",Vt);var tn=Wt,nn=Gt;Ut();const rn={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},on={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var an={DefaultDataType:on.FLOAT,DataTypeByteSize:rn,VtkDataTypes:on},sn=n(640),ln=n.n(sn);const un=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],cn=[1,0,0,0,1,0,0,0,1],dn=1e-6,pn=1e-12,{vtkErrorMacro:fn,vtkWarningMacro:hn}=gt;let mn=0;function gn(e){return()=>fn(`vtkMath::${e} - NOT IMPLEMENTED`)}function vn(e,t,n,r){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let n=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:dn;if(e.length!==t.length)return!1;function r(e,r){return Math.abs(e-t[r])<=n}return e.every(r)}const $n=qn;function Yn(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Jn(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const n=`${e}`.split("e");let r="";return+n[1]+t>0&&(r="+"),+`${Math.round(`${+n[0]}e${r}${+n[1]+t}`)}e-${t}`}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Zn(e[0],n),t[1]=Zn(e[1],n),t[2]=Zn(e[2],n),t}function tr(e,t,n,r){let o,i,a,s,l,u,c,d,p,f,h,m,g,v,y,b;const x=bn(t),_=bn(t),T=(e,t,n)=>{v=e[t],g=e[n],e[t]=v-m*(g+v*f),e[n]=g+m*(v-g*f)};for(Jn(t,r),l=0;l3&&Math.abs(n[l])+v===Math.abs(n[l])&&Math.abs(n[s])+v===Math.abs(n[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=n[s]-n[l],Math.abs(g)+v===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),y=1/Math.sqrt(1+p*p),m=p*y,f=m/(1+y),g=p*e[l*t+s],_[l]-=g,_[s]+=g,n[l]-=g,n[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)T(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)T(e,l*t+i,i*t+s);for(i=s+1;i=20)return hn("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(n[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(ur?i:r,o=a>o?a:o,n[e]=1,0!==o&&(n[e]/=o)}const i=Math.abs(t[0])*n[0],a=Math.abs(t[3])*n[1],s=Math.abs(t[6])*n[2];r[0]=0,o=i,a>=o&&(o=a,r[0]=1),s>=o&&(r[0]=2),0!==r[0]&&(yn(t,3,r[0],0),n[r[0]]=n[0]);const l=Math.abs(t[4])*n[1],u=Math.abs(t[7])*n[2];r[1]=1,o=l,u>=o&&(r[1]=2,yn(t,3,1,2)),r[2]=2;let c=0;if(Kn(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=bn(4);if(nr(t,d),Qn(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==r[1]&&yn(t,3,r[1],1),0!==r[0]&&yn(t,3,r[0],0)}function or(e,t,n){let r,o,i,a,s,l;if(tr([...e],3,t,n),t[0]!==t[1]||t[0]!==t[2]){for(Xn(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(l=Math.abs(n[3*r]),a=0,o=1;o<3;o++)l<(s=Math.abs(n[3*r+o]))&&(l=s,a=o);a!==r&&(s=t[a],t[a]=t[r],t[r]=s,vn(n,3,r,a)),n[3*a+a]<0&&(n[3*a]=-n[3*a],n[3*a+1]=-n[3*a+1],n[3*a+2]=-n[3*a+2]),o=(a+1)%3,i=(a+2)%3,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=0,n[3*o+o]=1;const e=Bn([n[3*a],n[3*a+1],n[3*a+2]],[n[3*o],n[3*o+1],n[3*o+2]],[]);Un(e);const u=Bn(e,[n[3*a],n[3*a+1],n[3*a+2]],[]);for(let t=0;t<3;t++)n[3*i+t]=e[t],n[3*o+t]=u[t];return void Xn(n,n)}for(l=Math.abs(n[0]),a=0,r=1;r<3;r++)l<(s=Math.abs(n[3*r]))&&(l=s,a=r);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,vn(n,3,a,0)}if(Math.abs(n[4])a&&(a=u);if(0===a)return hn("Unable to factor linear system"),0;d[r]=1/a}for(o=0;o=a&&(a=l,c=r)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*r+i]*n[i];else 0!==l&&(a=o);n[o]=l}for(o=r-1;o>=0;o--){for(l=n[o],i=o+1;i3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i=r||bn(n),a=o||bn(n);if(0===ir(e,i,n))return null;for(let r=0;rl?l=i:il?l=a:a0?(l-u)/l:0,r>0?(n=o===l?s*(i-a)/(l-u):i===l?.3333333333333333+s*(a-o)/(l-u):.6666666666666666+s*(o-i)/(l-u),n<0&&(n+=1)):n=0,t[0]=n,t[1]=r,t[2]=c}function dr(e,t){const[n,r,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;n>a&&n<=i?(c=1,u=(i-n)/a,d=0):n>i&&n<=.5?(c=1,d=(n-i)/a,u=0):n>.5&&n<=s?(d=1,c=(s-n)/a,u=0):n>s&&n<=l?(d=1,u=(n-s)/a,c=0):n>l&&n<=1?(u=1,d=(1-n)/a,c=0):(u=1,c=n/a,d=0),u=r*u+(1-r),c=r*c+(1-r),d=r*d+(1-r),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function pr(e,t){const[n,r,o]=e;let i=(n+16)/116,a=r/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function fr(e,t){const[n,r,o]=e;let i=n/.9505,a=r/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function hr(e,t){const[n,r,o]=e;let i=3.2406*n+-1.5372*r+-.4986*o,a=-.9689*n+1.8758*r+.0415*o,s=.0557*n+-.204*r+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function mr(e,t){let[n,r,o]=e;n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*n+.3576*r+.1805*o,t[1]=.2126*n+.7152*r+.0722*o,t[2]=.0193*n+.1192*r+.9505*o}function gr(e,t){const n=[0,0,0];mr(e,n),fr(n,t)}function vr(e,t){const n=[0,0,0];pr(e,n),hr(n,t)}function yr(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function br(e){return!(e[1]-e[0]<0)}function xr(e,t,n){return en?n:e}function _r(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return r[0]=xr(e[0],t[0],n[0]),r[1]=xr(e[1],t[1],n[1]),r[2]=xr(e[2],t[2],n[2]),r}const Tr=gn("GetScalarTypeFittingRange"),Sr=gn("GetAdjustedScalarRange");const wr=e=>!Number.isFinite(e),{isFinite:Cr,isNaN:Ar}=Number,Er=Ar;function Dr(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Ir(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Pr(e){return Math.round(255*e)}var Or={Pi:()=>Math.PI,radiansFromDegrees:xn,degreesFromRadians:_n,round:Tn,floor:Sn,ceil:wn,ceilLog2:En,min:Cn,max:An,arrayMin:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let o=t,i=e.length;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,o=-1/0;for(let i=t,a=e.length;i=0;--o)if(n[o]0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=t-e;return e+n*Math.random()},gaussian:On,add:Nn,subtract:Mn,multiplyScalar:Rn,multiplyScalar2D:Fn,multiplyAccumulate:kn,multiplyAccumulate2D:function(e,t,n,r){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r},dot:Ln,outer:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[0]*t[2],n[3]=e[1]*t[0],n[4]=e[1]*t[1],n[5]=e[1]*t[2],n[6]=e[2]*t[0],n[7]=e[2]*t[1],n[8]=e[2]*t[2]},cross:Bn,norm:Vn,normalize:Un,perpendiculars:function(e,t,n,r){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==r){const e=Math.sin(r),o=Math.cos(r);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),n&&(n[l]=(-f*e-d*p*o)/h,n[u]=o*h,n[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),n&&(n[l]=-d*p/h,n[u]=h,n[c]=-p*f/h)},projectVector:function(e,t,n){const r=Ln(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;const o=Ln(e,t)/r;for(let e=0;e<3;e++)n[e]=t[e];return Rn(n,o),!0},projectVector2D:function(e,t,n){const r=Gn(t,t);if(0===r)return n[0]=0,n[1]=0,!1;const o=Gn(e,t)/r;for(let e=0;e<2;e++)n[e]=t[e];return Fn(n,o),!0},distance2BetweenPoints:zn,angleBetweenVectors:function(e,t){const n=[0,0,0];return Bn(e,t,n),Math.atan2(Vn(n),Ln(e,t))},gaussianAmplitude:function(e,t,n){const r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(r**2)/(2*t))},gaussianWeight:function(e,t,n){const r=Math.abs(e-n);return Math.exp(-(r**2)/(2*t))},dot2D:Gn,outer2D:function(e,t,n){n[0]=e[0]*t[0],n[1]=e[0]*t[1],n[2]=e[1]*t[0],n[3]=e[1]*t[1]},norm2D:jn,normalize2D:function(e){const t=jn(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:Wn,LUFactor3x3:function(e,t){let n,r,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(r=Math.abs(e[3*t+1]))>o&&(o=r),(r=Math.abs(e[3*t+2]))>o&&(o=r),i[t]=1/o;o=i[0]*Math.abs(e[0]),n=0,(r=i[1]*Math.abs(e[3]))>=o&&(o=r,n=1),(r=i[2]*Math.abs(e[6]))>=o&&(n=2),0!==n&&(vn(e,3,n,0),i[n]=i[0]),t[0]=n,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),n=1,(r=i[2]*Math.abs(e[7]))>=o&&(n=2,vn(e,3,1,2),i[2]=i[1]),t[1]=n,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,n){let r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[3]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[6]*n[0]-e[7]*n[1],n[2]/=e[8],n[1]=(n[1]-e[5]*n[2])/e[4],n[0]=(n[0]-e[1]*n[1]-e[2]*n[2])/e[0]},linearSolve3x3:function(e,t,n){const r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+Wn(s,c,l,d),f=-Wn(a,u,l,d),h=+Wn(a,u,s,c),m=-Wn(o,c,i,d),g=+Wn(r,u,i,d),v=-Wn(r,u,o,c),y=+Wn(o,s,i,l),b=-Wn(r,a,i,l),x=+Wn(r,a,o,s),_=r*p+o*f+i*h,T=p*t[0]+m*t[1]+y*t[2],S=f*t[0]+g*t[1]+b*t[2],w=h*t[0]+v*t[1]+x*t[2];n[0]=T/_,n[1]=S/_,n[2]=w/_},multiply3x3_vect3:function(e,t,n){const r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];n[0]=r,n[1]=o,n[2]=i},multiply3x3_mat3:Hn,multiplyMatrix:function(e,t,n,r,o,i,a){r!==o&&fn("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,un,t)},isIdentity3x3:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dn;return $n(e,cn,t)},determinant3x3:Kn,quaternionToMatrix3x3:Qn,areEquals:qn,areMatricesEqual:$n,roundNumber:Zn,roundVector:er,matrix3x3ToQuaternion:nr,multiplyQuaternion:function(e,t,n){const r=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],v=e[3]*t[2],y=e[3]*t[3];n[0]=r-l-f-y,n[1]=o+s+h-v,n[2]=i-c+d+g,n[3]=a+u-p+m},orthogonalize3x3:rr,diagonalize3x3:or,singularValueDecomposition3x3:function(e,t,n,r){let o;const i=[...e],a=Kn(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];rr(i,t),Xn(i,i),Hn(i,t,r),or(r,n,r),Hn(t,r,t),Xn(r,r),a<0&&(n[0]=-n[0],n[1]=-n[1],n[2]=-n[2])},solveLinearSystem:sr,invertMatrix:lr,luFactorLinearSystem:ir,luSolveLinearSystem:ar,estimateMatrixCondition:function(e,t){let n=+Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;nr&&(r=Math.abs(e[n*t+o]));for(let r=0;r6&&void 0!==arguments[6])||arguments[6];if(epn&&(p=0,s[c]=0);if(p&&1===o)return hn("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),ur(e,t,n,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:cr,hsv2rgb:dr,lab2xyz:pr,xyz2lab:fr,xyz2rgb:hr,rgb2xyz:mr,rgb2lab:gr,lab2rgb:vr,uninitializeBounds:yr,areBoundsInitialized:br,computeBoundsFromPoints:function(e,t,n){return n[0]=Math.min(e[0],t[0]),n[1]=Math.max(e[0],t[0]),n[2]=Math.min(e[1],t[1]),n[3]=Math.max(e[1],t[1]),n[4]=Math.min(e[2],t[2]),n[5]=Math.max(e[2],t[2]),n},clampValue:xr,clampVector:_r,clampAndNormalizeValue:function(e,t){let n=0;return t[0]!==t[1]&&(n=et[1]?t[1]:e,n=(n-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:Tr,getAdjustedScalarRange:Sr,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(let r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){const o=bn(3),i=bn(3),a=bn(3),s=bn(3),l=bn(3),u=bn(3);for(let r=0;r<3;++r)o[r]=e[r]-t[r],i[r]=t[r]-n[r],a[r]=n[r]-e[r],s[r]=-o[r],l[r]=-i[r],u[r]=-a[r];const c=Vn(s),d=Vn(l),p=Vn(a),f=bn(3);Bn(o,i,f);const h=Vn(f),m=c*d*p/(2*h),g=2*h*h,v=d*d*Ln(o,u)/g,y=p*p*Ln(s,i)/g,b=c*c*Ln(a,l)/g;for(let o=0;o<3;++o)r[o]=v*e[o]+y*t[o]+b*n[o];return m},inf:1/0,negInf:-1/0,isInf:wr,isNan:Ar,isNaN:Ar,isFinite:Cr,createUninitializedBounds:Dr,getMajorAxisIndex:function(e){let t=-1,n=-1;for(let r=0;rt&&(n=r,t=o)}return n},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const n=new Array(t),r=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=n[l];for(let n=0;n<=o;++n){const o=r[n],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=n)}}[n[o],n[a]]=[n[a],n[o]],[r[o],r[s]]=[r[s],r[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#";return`${t}${e.map(Ir).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Pr).join(", ")})`:`rgba(${Pr(e[0]||0)}, ${Pr(e[1]||0)}, ${Pr(e[2]||0)}, ${e[3]||0})`}};const{vtkErrorMacro:Nr}=vt,{DefaultDataType:Mr}=an,Rr=1e-6;function Fr(e,t,n){const r=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function kr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&n>1){const t=e.length/n,r=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const n=e||[];for(;n.length<=t;)n.push(null);return n}function Br(e){return Object.prototype.toString.call(e).slice(8,-1)}const Vr={computeRange:kr,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:n,sum:r,mean:r/n}),getRange:()=>({min:e,max:t})}},fastComputeRange:Fr,getDataType:Br,getMaxNorm:function(e){const t=e.getNumberOfComponents();let n=0;const r=new Array(t);for(let o=0;on&&(n=i)}return n}};function Ur(e,t){function n(n){if(n<0)return!1;const r=e.getNumberOfComponents(),o=t.values.length/(r>0?r:1);if(n===o)return!0;if(n>o){const e=t.values;return t.values=Pe(t.dataType,(n+o)*r),t.values.set(e),!0}return t.size>n*r&&(t.size=n*r,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.resize=r=>{n(r);const o=r*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>{e.resize(0)},e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.dataChange())},e.getValue=n=>{const r=n/t.numberOfComponents,o=n%t.numberOfComponents;return e.getComponent(r,o)},e.setValue=(n,r)=>{const o=n/t.numberOfComponents,i=n%t.numberOfComponents;e.setComponent(o,i,r)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=n;r<0&&(r=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents)),o=t.ranges[r],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=kr(e.getData(),n,t.numberOfComponents),t.ranges[r]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,n)=>{t.ranges||(t.ranges=Lr(t.ranges,t.numberOfComponents));const r={min:e.min,max:e.max};return t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple},e.setTuple=(e,n)=>{const r=e*t.numberOfComponents;for(let e=0;e{let r=e*t.numberOfComponents;const o=Math.min(n.length,t.size-r);for(let e=0;e(t.size<=r*t.numberOfComponents&&(t.size=(r+1)*t.numberOfComponents,n(r+1)),e.setTuple(r,o),r),e.insertTuples=(r,o)=>{const i=r+o.length/t.numberOfComponents;return t.size{const r=t.size/t.numberOfComponents;return e.insertTuple(r,n)},e.insertNextTuples=n=>{const r=t.size/t.numberOfComponents;return e.insertTuples(r,n)},e.findTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rr;for(let r=0;rn){o=!1;break}if(o)return r/t.numberOfComponents}return-1},e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1,o=e*r;switch(r){case 4:n[3]=t.values[o+3];case 3:n[2]=t.values[o+2];case 2:n[1]=t.values[o+1];case 1:n[0]=t.values[o];break;default:for(let e=r-1;e>=0;--e)n[e]=t.values[o+e]}return n},e.getTuples=(n,r)=>{const o=(n??0)*t.numberOfComponents,i=(r??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>jr({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,t.dataType=Br(n),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const n={...t,vtkClass:e.getClassName()};n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach((e=>{n[e]||delete n[e]}));const r={};return Object.keys(n).sort().forEach((e=>{r[e]=n[e]})),r.mtime&&delete r.mtime,r},e.deepCopy=n=>{const r=e.getDataType(),o=t.values;e.shallowCopy(n),o?.length>=n.getNumberOfValues()&&r===n.getDataType()?(o.set(n.getData()),t.values=o,e.dataChange()):e.setData(n.getData().slice())},e.interpolateTuple=(n,r,o,i,a,s)=>{const l=t.numberOfComponents||1;l===r.getNumberOfComponents()&&l===i.getNumberOfComponents()||Nr("numberOfComponents must match");const u=r.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Gr,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=Oe(t.dataType,t.values)):t.values=Pe(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=Br(t.values)),je(e,t),qe(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!=0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");Ur(e,t)}const jr=rt(zr,"vtkDataArray");var Wr={newInstance:jr,extend:zr,...Vr,...an};function Hr(e){let t=0;return e.filter(((e,n)=>n===t&&(t+=e+1,!0)))}function Xr(e){let t=0;for(let n=0;nvoid 0===t.numberOfCells||n?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Xr(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=n=>void 0===t.cellSizes||n?(t.cellSizes=Hr(e.getData()),t.cellSizes):t.cellSizes,e.resize=r=>{const o=e.getNumberOfTuples();n.resize(r);const i=e.getNumberOfTuples();i{n.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let n=e;const r=t.values[n++];return t.values.subarray(n,n+r)},e.insertNextCell=n=>{const r=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),r}}function $r(e){return{empty:!0,numberOfComponents:1,dataType:on.UNSIGNED_INT,...e}}function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Wr.extend(e,t,$r(n)),qr(e,t)}var Jr={newInstance:gt.newInstance(Yr,"vtkCellArray"),extend:Yr,...Kr};const{vtkErrorMacro:Qr}=gt,Zr=[1,-1,1,-1,1,-1];function eo(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=gt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oe.insertNextTuple([t,n,r]),e.getBounds=()=>{if(3===e.getNumberOfComponents()){const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);t.bounds[2]=r[0],t.bounds[3]=r[1];const o=e.getRange(2);return t.bounds[4]=o[0],t.bounds[5]=o[1],t.bounds}if(2!==e.getNumberOfComponents())return Qr(`getBounds called on an array with components of\n ${e.getNumberOfComponents()}`),Zr;const n=e.getRange(0);t.bounds[0]=n[0],t.bounds[1]=n[1];const r=e.getRange(1);return t.bounds[2]=r[0],t.bounds[3]=r[1],t.bounds[4]=0,t.bounds[5]=0,t.bounds},e.computeBounds=e.getBounds,e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}const to={empty:!0,numberOfComponents:3,dataType:on.FLOAT,bounds:[1,-1,1,-1,1,-1]};function no(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,to,n),Wr.extend(e,t,n),eo(e,t)}var ro={newInstance:gt.newInstance(no,"vtkPoints"),extend:no};function oo(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n){t.pointsIds=n;let r=t.points.getData();r.length!==3*t.pointsIds.length&&(r=gt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach(((e,t)=>{let n=3*e,i=3*t;r[i]=o[n],r[++i]=o[++n],r[++i]=o[++n]})),t.points.setData(r)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let n=e.getNumberOfPoints()-1;n>=0;--n)t.pointsIds[n]=n}},e.getBounds=()=>{const e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(let r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else yr(t.bounds);return t.bounds},e.getLength2=()=>{e.getBounds();let n=0,r=0;for(let e=0;e<3;e++)r=t.bounds[2*e+1]-t.bounds[2*e],n+=r*r;return n},e.getParametricDistance=e=>{let t,n=0;for(let r=0;r<3;r++)t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0,t>n&&(n=t);return n},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,n,r,o,i,a)=>{},e.evaluatePosition=(e,t,n,r,o,i)=>{gt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}const io={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function ao(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,io,n),gt.obj(e,t),t.points||(t.points=ro.newInstance()),gt.get(e,t,["points","pointsIds"]),oo(e,t)}var so={newInstance:gt.newInstance(ao,"vtkCell"),extend:ao};function lo(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),o=n.getNumberOfCells(),i=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)}))}e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}}else{for(let t=0;t{e.incrementLinkCount(t)}));e.allocateLinks(r),t.maxId=r-1;for(let t=0;t{e.insertCellReference(n,i[n]++,t)}))}},e.allocate=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map((()=>({ncells:0,cells:null}))),t.extend=n,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,n)=>{t.array[e].cells[t.array[e].ncells++]=n},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,n)=>{t.array[n].cells=t.array[n].cells.filter((t=>t!==e)),t.array[n].ncells=t.array[n].cells.length},e.addCellReference=(e,n)=>{t.array[n].cells[t.array[n].ncells++]=e},e.resizeCellList=(e,n)=>{t.array[e].cells.length=n},e.squeeze=()=>{!function(e,t){let n=t;for(t>=e.array.length&&(n+=e.array.length);n>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=n}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let n=0;n{t.array[e].cells[n]=r}}const uo={array:null,maxId:0,extend:0};function co(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uo,n),gt.obj(e,t),lo(e,t)}var po={newInstance:gt.newInstance(co,"vtkCellLinks"),extend:co};const fo=0,ho=1,mo=2,go=3,vo=4,yo=5,bo=6,xo=7,_o=9,To=21,So=41,wo=42,Co=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],Ao={getClassNameFromTypeId:function(e){return e0&&void 0!==arguments[0]?arguments[0]:512,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=n>0?n:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,n,r)=>{t.typeArray[e]=n,t.locationArray[e]=r,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(n,r)=>(e.insertCell(++t.maxId,n,r),t.maxId),e.setCellTypes=(e,n,r)=>{t.size=e,t.typeArray=n,t.locationArray=r,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=fo},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const n=e.getNumberOfTypes();for(let r=0;re.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=n=>{e.allocate(n.getSize(),n.getExtend()),t.typeArray.set(n.getTypeArray()),t.locationArray.set(n.getLocationArray()),t.maxId=n.getMaxId()}}const Do={size:0,maxId:-1,extend:1e3};function Io(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Do,n),gt.obj(e,t),gt.get(e,t,["size","maxId","extend"]),gt.getArray(e,t,["typeArray","locationArray"]),Eo(e,t)}var Po={newInstance:gt.newInstance(Io,"vtkCellTypes"),extend:Io,...Ao},Oo={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}};function No(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function Mo(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3];return e[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,e[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,e[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,e[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,e}function Ro(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fo(e,t,n){n*=.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ko(e,t,n){var r=t[0],o=t[1],i=t[2],a=t[3],s=n[0],l=n[1],u=n[2],c=n[3];return e[0]=r*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-r*u,e[2]=i*c+a*u+r*l-o*s,e[3]=a*c-r*s-o*l-i*u,e}!function(){var e;e=new i(4),i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var Lo,Bo=function(e,t,n,r){var o=new i(4);return o[0]=e,o[1]=t,o[2]=n,o[3]=r,o};Ut(),zt(1,0,0),zt(0,1,0),Ro(),Ro(),Lo=new i(9),i!=Float32Array&&(Lo[1]=0,Lo[2]=0,Lo[3]=0,Lo[5]=0,Lo[6]=0,Lo[7]=0),Lo[0]=1,Lo[4]=1,Lo[8]=1;const{IntersectionState:Vo}=Oo;function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=n[0]-t[0],i[1]=n[1]-t[1],i[2]=n[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ln(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=n:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),r&&(r[0]=a[0],r[1]=a[1],r[2]=a[2]),o.distance=zn(a,e),o}function Go(e,t,n,r,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Mn(t,e,a),Mn(r,n,s),Mn(n,e,l);const u=[Ln(a,a),-Ln(a,s),-Ln(a,s),Ln(s,s)],c=[];if(c[0]=Ln(a,l),c[1]=-Ln(s,l),0===sr(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,n,r],l=[n,n,e,e],u=[r,r,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Uo(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Vo.YES_INTERSECTION:Vo.NO_INTERSECTION}const zo={distanceToLine:Uo,intersection:Go};function jo(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,n,r,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=Go(e,n,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Vo.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(n[t]-e[t]);if(zn(o,s)<=r*r)return a.intersect=1,a}else{let t;if(a.t<0)return t=Uo(e,l,u,o),t.distance<=r*r?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Uo(n,l,u,o),t.distance<=r*r?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Uo(l,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Uo(u,e,n,o),a.t=t.t,t.distance<=r*r?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,n,r)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)n[t]=o[t]+e[0]*(i[t]-o[t]);r[0]=1-e[0],r[1]=e[0]},e.evaluateOrientation=(e,n,r)=>!!t.orientations&&(function(e,t,n,r){var i,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=n[0],m=n[1],g=n[2],v=n[3];(a=c*h+d*m+p*g+f*v)<0&&(a=-a,h=-h,m=-m,g=-g,v=-v),1-a>o?(i=Math.acos(a),s=Math.sin(i),l=Math.sin((1-r)*i)/s,u=Math.sin(r*i)/s):(l=1-r,u=r),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*v}(n,t.orientations[0],t.orientations[1],e[0]),r[0]=1-e[0],r[1]=e[0],!0)}const Wo={orientations:null};function Ho(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wo,n),so.extend(e,t,n),gt.setGet(e,t,["orientations"]),jo(e,t)}var Xo={newInstance:gt.newInstance(Ho,"vtkLine"),extend:Ho,...zo,...Oo};const{vtkErrorMacro:Ko,vtkWarningMacro:qo}=gt;function $o(e,t){t.classHierarchy.push("vtkFieldData");const n=e.getState;t.arrays&&(t.arrays=t.arrays.map((e=>({data:he(e.data)})))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=n=>{e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map((e=>e)),t.arrays=n.arrays().map((e=>({array:e})))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=n=>{const r=n.getName(),{array:o,index:i}=e.getArrayWithIndex(r);return null!=o?(t.arrays[i]={data:n},i):(t.arrays=[].concat(t.arrays,{data:n}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=n=>{const r=t.arrays.findIndex((e=>e.data.getName()===n));return e.removeArrayByIndex(r)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map((e=>e.data)),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce(((t,n,r)=>n.data.getName()===e?n.data:t),null),e.getArrayWithIndex=e=>{const n=t.arrays.findIndex((t=>t.data.getName()===e));return{array:-1!==n?t.arrays[n].data:null,index:n}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach((i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?o:r;t.insertTuple(e,i.getTuple(r))}else t.insertTuples(0,i.getTuples());else Ko("Unhandled case in passData");else if(r<0||r>i.getNumberOfTuples())e.addArray(i),n.getAttributes(i).forEach((t=>{e.setAttribute(i,t)}));else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:r;s<=l*a&&(s=(l+1)*a),t=Wr.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:gt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(r)),e.addArray(t),n.getAttributes(i).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.interpolateData=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;n.getArrays().forEach((s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(r>-1&&r-1?i:r;t.interpolateTuple(e,s,r,s,o,a),qo("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else Ko("Unhandled case in interpolateData");else if(r<0||o<0||r>s.getNumberOfTuples())e.addArray(s),n.getAttributes(s).forEach((t=>{e.setAttribute(s,t)}));else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:r;u<=c*l&&(u=(c+1)*l),t=Wr.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:gt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,r,s,o,a),e.addArray(t),n.getAttributes(s).forEach((n=>{e.setAttribute(t,n)}))}}}))},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.deepCopy(e),{data:t}}))},e.copyFlags=e=>e.getCopyFieldFlags().map((e=>e)),e.reset=()=>t.arrays.forEach((e=>e.data.reset())),e.getMTime=()=>t.arrays.reduce(((e,t)=>t.data.getMTime()>e?t.data.getMTime():e),t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce(((e,t)=>e+t.data.getNumberOfComponents()),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=n();return e&&(e.arrays=t.arrays.map((e=>({data:e.data.getState()})))),e}}const Yo={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Jo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yo,n),gt.obj(e,t),$o(e,t)}var Qo={newInstance:gt.newInstance(Jo,"vtkFieldData"),extend:Jo},Zo={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:{SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8},CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:ei,AttributeCopyOperations:ti}=Zo,{vtkWarningMacro:ni}=gt;function ri(e,t){const n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function r(e){let t=n.find((t=>ei[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()));return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(n,o)=>{const i=r(o);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return ni(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(n&&!e.checkNumberOfComponents(n,i))return ni(`Cannot set attribute ${i}. Incorrect number of components.`),-1;let a=t[`active${i}`];if(a>=0&&an.filter((n=>e[`get${n}`]()===t)),e.setActiveAttributeByName=(t,n)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e.setActiveAttributeByIndex=(n,o)=>{const i=r(o);if(n>=0&&n{const n=r(t);return e[`get${n}`]()},e.removeAllArrays=()=>{n.forEach((e=>{t[`active${e}`]=-1})),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&n.forEach((n=>{e===t[`active${n}`]?t[`active${n}`]=-1:e{const r=`active${n}`;e[`get${n}`]=()=>e.getArrayByIndex(t[r]),e[`set${n}`]=t=>e.setAttribute(t,n),e[`setActive${n}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,n),e[`copy${n}Off`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!1},e[`copy${n}On`]=()=>{const e=n.toUpperCase();t.copyAttributeFlags[ti.PASSDATA][ei[e]]=!0}})),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(ti).filter((e=>"ALLCOPY"!==e)).forEach((e=>{t.copyAttributeFlags[ti[e]]=Object.keys(ei).filter((e=>"NUM_ATTRIBUTES"!==e)).reduce(((e,t)=>(e[ei[t]]=!0,e)),[])})),t.copyAttributeFlags[ti.COPYTUPLE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.INTERPOLATE][ei.GLOBALIDS]=!1,t.copyAttributeFlags[ti.COPYTUPLE][ei.PEDIGREEIDS]=!1},e.initialize=gt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach((n=>{t.dataArrays[n].ref||"vtkDataArray"!==t.dataArrays[n].type||e.addArray(Wr.newInstance(t.dataArrays[n]))}));const i=e.shallowCopy;e.shallowCopy=(e,n)=>{i(e,n),t.arrays=e.getArrays().map((e=>{const t=e.newClone();return t.shallowCopy(e,n),{data:t}}))},e.initializeAttributeCopyFlags()}const oi={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function ii(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oi,n),Qo.extend(e,t,n),gt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),ri(e,t)}var ai={newInstance:gt.newInstance(ii,"vtkDataSetAttributes"),extend:ii,...Zo};const si=["pointData","cellData","fieldData"];function li(e,t){t.classHierarchy.push("vtkDataSet"),si.forEach((e=>{t[e]?t[e]=he(t[e]):t[e]=ai.newInstance()}));const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),si.forEach((n=>{t[n]=ai.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))}}const ui={};function ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),gt.obj(e,t),gt.setGet(e,t,si),li(e,t)}var di={newInstance:gt.newInstance(ci,"vtkDataSet"),extend:ci,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};function pi(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=he(t.points):t.points=ro.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=ro.newInstance(),t.points.shallowCopy(e.getPoints())}}const fi={};function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fi,n),di.extend(e,t,n),gt.setGet(e,t,["points"]),pi(e,t)}var mi={newInstance:gt.newInstance(hi,"vtkPointSet"),extend:hi};const gi=1e-6,vi="coincide",yi="disjoint";function bi(e,t,n){const r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function xi(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o);r[0]=e[0]-i*n[0],r[1]=e[1]-i*n[1],r[2]=e[2]-i*n[2]}function _i(e,t,n){const r=Ln(e,t);let o=Ln(t,t);return 0===o&&(o=1),n[0]=e[0]-r*t[0]/o,n[1]=e[1]-r*t[1]/o,n[2]=e[2]-r*t[2]/o,n}function Ti(e,t,n,r){const o=[];Mn(e,t,o);const i=Ln(n,o),a=Ln(n,n);0!==a?(r[0]=e[0]-i*n[0]/a,r[1]=e[1]-i*n[1]/a,r[2]=e[2]-i*n[2]/a):(r[0]=e[0],r[1]=e[1],r[2]=e[2])}function Si(e,t,n,r){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Mn(t,e,i),Mn(n,e,a);const s=Ln(r,a),l=Ln(r,i);let u,c;return u=l<0?-l:l,c=s<0?-s*gi:s*gi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function wi(e,t,n,r){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Bn(t,r,i);const a=i.map((e=>Math.abs(e)));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ln(t,e),c=-Ln(r,n);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*r[2])/i[0],l[2]=(u*r[1]-c*t[1])/i[0];break;case"y":l[0]=(u*r[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*r[0])/i[1];break;case"z":l[0]=(c*t[1]-u*r[1])/i[2],l[1]=(u*r[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Nn(l,i,o.l1),o.intersection=!0,o}const Ci={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:bi,projectPoint:xi,projectVector:_i,generalizedProjectPoint:Ti,intersectWithLine:Si,intersectWithPlane:wi,DISJOINT:yi,COINCIDE:vi};function Ai(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>bi(e,t.origin,t.normal),e.projectPoint=(e,n)=>{xi(e,t.origin,t.normal,n)},e.projectVector=(e,n)=>_i(e,t.normal,n),e.push=e=>{if(0!==e)for(let n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=(e,n)=>{Ti(e,t.origin,t.normal,n)},e.evaluateFunction=(e,n,r)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,n)=>Si(e,n,t.origin,t.normal),e.intersectWithPlane=(e,n)=>wi(e,n,t.origin,t.normal)}const Ei={normal:[0,0,1],origin:[0,0,0]};function Di(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ei,n),gt.obj(e,t),gt.setGetArray(e,t,["normal","origin"],3),Ai(e,t)}var Ii={newInstance:gt.newInstance(Di,"vtkPlane"),extend:Di,...Ci};function Pi(e,t,n,r){const o=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];r[0]=i*u-a*l,r[1]=a*s-o*u,r[2]=o*l-i*s}function Oi(e,t,n,r){Pi(e,t,n,r);const o=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==o&&(r[0]/=o,r[1]/=o,r[2]/=o)}const Ni={computeNormalDirection:Pi,computeNormal:Oi,intersectWithTriangle:function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];Oi(e,t,n,d),Oi(r,o,i,p);const f=-Ln(d,e),h=-Ln(p,r),m=[Ln(p,e)+h,Ln(p,t)+h,Ln(p,n)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ln(d,r)+f,Ln(d,o)+f,Ln(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const v=[e,t,n],y=[r,o,i],b=Ln(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),T=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],S=Bn(d,p,[]);Un(S);let w=0,C=0;const A=[],E=[];let D,I,P=50,O=50;for(let t=0;t<3;t++){const n=t,o=(t+1)%3,i=Ii.intersectWithLine(v[n],v[o],r,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(P=w),A[w++]=Ln(i.x,S)-Ln(T,S));const s=Ii.intersectWithLine(y[n],y[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(O=C),E[C++]=Ln(s.x,S)-Ln(T,S))}if(w>2){w--;const e=A[2];A[2]=A[P],A[P]=e}if(C>2){C--;const e=E[2];E[2]=E[O],E[O]=e}if(2!==w||2!==C)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2,e.intersectWithLine=(n,r,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(Oi(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=Ii.intersectWithLine(n,r,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=zn(c,d),g=zn(d,p),v=zn(p,c);t.line||(t.line=Xo.newInstance()),m>g&&m>v?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>v&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const y=t.line.intersectWithLine(n,r,o,i,a);if(s.betweenPoints=y.betweenPoints,s.t=y.t,y.intersect){const e=[],t=[],n=[];for(let r=0;r<3;r++)e[r]=c[r]-p[r],t[r]=d[r]-p[r],n[r]=i[r]-p[r];return a[0]=Ln(n,e)/v,a[1]=Ln(n,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,n,r,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,v=0;const y=[];let b,x,_,T=[];const S=[],w=[],C=[];i.subId=0,r[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),Pi(l,u,c,d),Ii.generalizedProjectPoint(e,l,d,C);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,v=a);for(s=0,a=0;a<3;a++)a!==v&&(y[s++]=a);for(a=0;a<2;a++)f[a]=C[y[a]]-c[y[a]],h[a]=l[y[a]]-c[y[a]],m[a]=u[y[a]]-c[y[a]];if(g=Wn(h,m),0===g)return r[0]=0,r[1]=0,i.evaluation=-1,i;if(r[0]=Wn(f,m)/g,r[1]=Wn(h,f)/g,o[0]=1-(r[0]+r[1]),o[1]=r[0],o[2]=r[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)n&&(i.dist2=zn(C,e),n[0]=C[0],n[1]=C[1],n[2]=C[2]),i.evaluation=1;else{let t;if(n)if(o[1]<0&&o[2]<0)for(b=zn(e,c),x=Xo.distanceToLine(e,l,c,t,S),_=Xo.distanceToLine(e,c,u,t,w),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)n[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];r[0]=s,r[1]=e[0],r[2]=e[1]},e.getParametricDistance=e=>{let t,n=0;const r=[];r[0]=e[0],r[1]=e[1],r[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=r[e]<0?-r[e]:r[e]>1?r[e]-1:0,t>n&&(n=t);return n}}const Ri={};function Fi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ri,n),so.extend(e,t,n),Mi(e,t)}var ki={newInstance:gt.newInstance(Fi,"vtkTriangle"),extend:Fi,...Ni};const Li=["verts","lines","polys","strips"],{vtkWarningMacro:Bi}=gt,Vi={[go]:Xo,[vo]:Xo,[yo]:ki};function Ui(e,t){t.classHierarchy.push("vtkPolyData"),Li.forEach((n=>{e[`getNumberOf${function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e=>e.toUpperCase())).replace(/\s+/g,"")}(n)}`]=()=>t[n].getNumberOfCells(),t[n]?t[n]=he(t[n]):t[n]=Jr.newInstance()})),e.getNumberOfCells=()=>Li.reduce(((e,n)=>e+t[n].getNumberOfCells()),0);const n=e.shallowCopy;e.shallowCopy=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),Li.forEach((n=>{t[n]=Jr.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))}))},e.buildCells=()=>{const n=e.getNumberOfVerts(),r=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=n+r+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(n){let e=0;t.verts.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>1?mo:ho,e+=t+1})),c=c.subarray(n),l=l.subarray(n)}if(r){let e=0;t.lines.getCellSizes().forEach(((t,n)=>{c[n]=e,l[n]=t>2?vo:go,1===t&&Bi("Building VTK_LINE ",n," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1})),c=c.subarray(r),l=l.subarray(r)}if(o){let e=0;t.polys.getCellSizes().forEach(((t,n)=>{switch(c[n]=e,t){case 3:l[n]=yo;break;case 4:l[n]=_o;break;default:l[n]=xo}t<3&&Bi("Building VTK_TRIANGLE ",n," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1})),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(bo,0,i),t.strips.getCellSizes().forEach(((t,n)=>{c[n]=e,e+=t+1}))}t.cells=Po.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;void 0===t.cells&&e.buildCells(),t.links=po.newInstance(),n>0?t.links.allocate(n):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=n=>{const r=e.getCellType(n);let o=null;switch(r){case ho:case mo:o=t.verts;break;case go:case vo:o=t.lines;break;case yo:case _o:case xo:o=t.polys;break;case bo:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(n);return{cellType:r,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,n,r)=>{const o=t.links.getLink(n),i=t.links.getLink(r);return o.cells.filter((t=>t!==e&&-1!==i.cells.indexOf(t)))},e.getCell=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=e.getCellPoints(t),o=n||Vi[r.cellType].newInstance();return o.initialize(e.getPoints(),r.cellPointIds),o}}const Gi={};function zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gi,n),mi.extend(e,t,n),gt.get(e,t,["cells","links"]),gt.setGet(e,t,["verts","lines","polys","strips"]),Ui(e,t)}var ji={newInstance:gt.newInstance(zi,"vtkPolyData"),extend:zi};const{vtkErrorMacro:Wi}=gt;class Hi{constructor(){this.segmentMapping={},this.segments=[null],this.faces=[]}addSegment(e){const t=e[0],n=e[e.length-1];if(t===n||e.length<2)return;const r=this.segmentMapping[t],o=this.segmentMapping[n];if(void 0!==r&&void 0!==o)if(Math.abs(r)===Math.abs(o)){const i=r0)for(let t=1;t0){const t=this.segments[r];for(let n=1;n0){const n=this.segments[o];for(let t=1;t{const n=e[0];if(!n)return void Wi("Invalid or missing input");const r=ji.newInstance();r.shallowCopy(n);const o=new Hi,i=n.getLines().getData();let a=0;for(;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ki,n),gt.obj(e,t),gt.algo(e,t,1,1),Xi(e,t)}var $i={newInstance:gt.newInstance(qi,"vtkClosedPolyLineToSurfaceFilter"),extend:qi};const{vtkErrorMacro:Yi}=vt;function Ji(e,t){t.classHierarchy.push("vtkCutter");const n={...e};e.getMTime=()=>{let e=n.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,n)=>{const r=e[0];if(!r)return void Yi("Invalid or missing input");if(!t.cutFunction)return void Yi("Missing cut function");const o=ji.newInstance();(function(e,n){const r=e.getPoints(),o=r.getData(),i=r.getNumberOfPoints(),a=[],s=[],l=[];(!t.cutScalars||t.cutScalars.length0;let r=!0;for(let t=1;t0!==e){r=!1;break}if(r)continue;const i=[];for(let e=0;e0;if(h[r]>0===a)continue;let s=e,l=r,u=h[l]-h[s];u<=0&&(s=r,l=e,u*=-1);let c=0;0!==u&&(c=(t.cutValue-h[s])/u);const d=n.cell[s],m=n.cell[l];p[0]=o[3*d],p[1]=o[3*d+1],p[2]=o[3*d+2],f[0]=o[3*m],f[1]=o[3*m+1],f[2]=o[3*m+2];const g=[p[0]+c*(f[0]-p[0]),p[1]+c*(f[1]-p[1]),p[2]+c*(f[2]-p[2])];i.push({pointEdge1:d,pointEdge2:m,intersectedPoint:g,newPointID:-1})}for(let e=0;e2&&(l.push(u),i.forEach((e=>{l.push(e.newPointID)})))}n.getPoints().setData(Oe(r.getDataType(),a),3),0!==s.length&&n.getLines().setData(Uint16Array.from(s)),0!==l.length&&n.getPolys().setData(Uint16Array.from(l))})(r,o),n[0]=o}}const Qi={cutFunction:null,cutScalars:null,cutValue:0};function Zi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,n),je(e,t),et(e,t,1,1),$e(e,t,["cutFunction","cutValue"]),Ji(e,t)}var ea={newInstance:rt(Zi,"vtkCutter"),extend:Zi};const ta={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var na={ObjectType:ta};const{ObjectType:ra}=na;function oa(e,t){function n(e){switch(e){case ra.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ra.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case ra.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let r=null,o=null,i=!0,a="";e.getType=()=>r,e.setType=e=>{r=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=n(e);return null===o&&(o=t.context.createBuffer(),r=e),n(r)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(n(r),o),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(n(r),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(n(r),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}const ia={objectType:ra.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function aa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ia,n),gt.obj(e,t),gt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),gt.moveToProtected(e,t,["openGLRenderWindow"]),oa(e,t)}var sa={newInstance:gt.newInstance(aa),extend:aa,...na};const la={FLAT:0,GOURAUD:1,PHONG:2},ua={POINTS:0,WIREFRAME:1,SURFACE:2};var ca={Shading:la,Representation:ua,Interpolation:la};const{vtkErrorMacro:da}=gt;function pa(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(ta.ARRAY_BUFFER),e.createVBO=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach((e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())})),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=sa.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,v=0,y=0,b=0;const x={anythingToPoints(e,t,n){for(let r=0;r2)for(let r=0;r2){for(let r=0;re,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,n)=>e>2?3*(e-2):0};let T=null,S=null;o===ua.POINTS||"verts"===r?(T=x.anythingToPoints,S=_.anythingToPoints):o===ua.WIREFRAME||"lines"===r?(T=x[`${r}ToWireframe`],S=_[`${r}ToWireframe`]):(T=x[`${r}ToSurface`],S=_[`${r}ToSurface`]);const w=n.getData(),C=w.length;let A=0;for(let e=0;e0&&(Math.abs(N)/O>1e6||Math.abs(Math.log10(O))>3||0===O&&N>1e6);if(M){const t=new Float64Array(3),n=new Float64Array(3);for(let e=0;e<3;++e){const r=i.points.getRange(e),o=r[1]-r[0];t[e]=.5*(r[1]+r[0]),n[e]=o>0?1/o:1}e.setCoordShiftAndScale(t,n)}else!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null);if(a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[I++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[I++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[I++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[I++]=s[h++],D[I++]=s[h++],D[I++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[I++]=l[m++],D[I++]=l[m++],D[I++]=l[m++]),t.customData.forEach((t=>{y=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===n||n.constructor===Float64Array&&3===n.length?(null!==t.coordShift&&null!==e&&en(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==n&&en(n,t.coordScale)||(t.coordScale=n),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Zt(e,[0,0,0])&&Zt(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const n=new Float64Array(3);Xt(n,t);const r=new Float64Array(16);return k(r,Ro(),e,n),r}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):da("Wrong type for coordScale, expected vec3 or null"):da("Wrong type for coordShift, expected vec3 or null")}}const fa={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ha(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fa,n),sa.extend(e,t,n),gt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),gt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),pa(e,t)}var ma={newInstance:gt.newInstance(ha),extend:ha};const{vtkErrorMacro:ga}=gt;function va(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return ga(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}const ya={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function ba(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ya,n),gt.obj(e,t),gt.setGet(e,t,["shaderType","source","error","handle","context"]),va(e,t)}var xa={newInstance:gt.newInstance(ba,"vtkShader"),extend:ba};const{vtkErrorMacro:_a}=gt;function Ta(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(_a(`Links failed: ${t.error}`),0):(_a(t.error),0):(_a(t.fragmentShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.fragmentShader.getError()),0):(_a(t.vertexShader.getSource().split("\n").map(((e,t)=>`${t}: ${e}`)).join("\n")),_a(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return _a(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;const i=new Float32Array(r);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1f(o,r),!0)},e.setUniformfv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1fv(o,r),!0)},e.setUniformi=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1i(o,r),!0)},e.setUniformiv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform1iv(o,r),!0)},e.setUniform2f=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,o),!0},e.setUniform2fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2fv(o,r),!0)},e.setUniform2i=(n,r,o)=>{const i=e.findUniform(n);if(-1===i)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,o),!0},e.setUniform2iv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform2iv(o,r),!0)},e.setUniform3f=(n,r,o,i)=>{const a=e.findUniform(n);if(-1===a)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r,o,i),!0},e.setUniform3fArray=(n,r)=>{const o=e.findUniform(n);if(-1===o)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r[0],r[1],r[2]),!0},e.setUniform3fv=(n,r)=>{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3fv(o,r),!0)},e.setUniform3i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform3iv(o,r),!0)},e.setUniform4f=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4fv(o,r),!0)},e.setUniform4i=function(n){const r=e.findUniform(n);if(-1===r)return t.error=`Could not set uniform ${n} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(n);return-1===o?(t.error=`Could not set uniform ${n} . No such uniform.`,!1):(t.context.uniform4iv(o,r),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let n=t.uniformLocs[e];return void 0!==n?n:(n=t.context.getUniformLocation(t.handle,e),null===n?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=n,n))},e.isUniformUsed=e=>{if(!e)return!1;let n=t.uniformLocs[e];return void 0!==n?null!==n:t.linked?(n=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=n,null!==n):(_a("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return _a("attempt to find uniform when the shader program is not linked"),!1;const n=t.context.getAttribLocation(t.handle,e);return-1!==n&&(t.attributeLocs[e]=n,!0)},e.attachShader=n=>{if(0===n.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===n.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===n.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=n.getHandle()),"Fragment"===n.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=n.getHandle()),t.context.attachShader(t.handle,n.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}const Sa={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function wa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sa,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=xa.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=xa.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=xa.newInstance(),t.geometryShader.setShaderType("Geometry"),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),Ta(e,t)}var Ca={newInstance:gt.newInstance(wa,"vtkShaderProgram"),extend:wa,substitute:function(e,t,n,r){const o="string"==typeof n?n:n.join("\n"),i=!1===r?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};function Aa(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,1):e.vertexAttribDivisor(o.index+n,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let n=0;n0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+n,0):e.vertexAttribDivisor(o.index+n,0)),e.disableVertexAttribArray(o.index+n)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,n,r,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,n,r,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(n,r,o,i,a,s,l,u,c,d)=>{if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==ta.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(r.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=r.getHandle(),!t.supported){let e=!1;for(let n=0;n{const d=e.addAttributeArrayWithDivisor(n,r,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=n=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))}}const Ea={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Da(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ea,n),t.buffers=[],gt.obj(e,t),gt.get(e,t,["supported"]),gt.setGet(e,t,["forceEmulation"]),Aa(e,t)}var Ia={newInstance:gt.newInstance(Da,"vtkOpenGLVertexArrayObject"),extend:Da};const Pa={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function Oa(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(n,r,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(n,r),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(n,r,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(l.lineWidth(r.getProperty().getLineWidth()),e.updateShaders(n,r,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const n=t.primitiveType;return e===ua.POINTS||n===Pa.Points?t.context.POINTS:e===ua.WIREFRAME||n===Pa.Lines||n===Pa.TrisEdges||n===Pa.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,n)=>n.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=n.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,n,r)=>!!(r.getNeedToRebuildShaders(e,t,n)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,n,r);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,n,r),o.setPropertyShaderParameters(e,n,r),o.setCameraShaderParameters(e,n,r),o.setLightingShaderParameters(e,n,r),o.invokeShaderCallbacks(e,n,r)},e.setMapperShaderParameters=(n,r,o)=>{if(e.haveWideLines(n,r)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(r.getProperty().getLineWidth()),n=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",n)}t.primitiveType===Pa.Points||r.getProperty().getRepresentation()===ua.POINTS?e.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(n,r,o)=>{let i=n.Vertex;i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(r,o)&&(i=Ca.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===Pa.Points?2:t.primitiveType===Pa.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}const Na={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Ma(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Na,n),gt.obj(e,t),t.shaderSourceTime={},gt.obj(t.shaderSourceTime),t.attributeUpdateTime={},gt.obj(t.attributeUpdateTime),gt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=Ca.newInstance(),t.VAO=Ia.newInstance(),t.CABO=ma.newInstance(),Oa(e,t)}var Ra={newInstance:gt.newInstance(Ma),extend:Ma,primTypes:Pa};const Fa=e=>e,ka=1e-6;class La{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=f(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?s:Fa}rotateFromDirections(e,t){const n=new Float64Array(3),r=new Float64Array(3),o=new Float64Array(16);jt(n,e[0],e[1],e[2]),jt(r,t[0],t[1],t[2]),Kt(n,n),Kt(r,r);const i=qt(n,r);return i>=1||($t(this.tmp,n,r),Gt(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($n(un,this.matrix))return this;const r=-1===n?e.length:t+3*n;for(let n=t;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ja,n),gt.obj(e,t),gt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),gt.setGetArray(e,t,["center","rotations"],3),gt.setGetArray(e,t,["matrix"],16),t._polys=Jr.newInstance({values:Uint16Array.from(Ga)}),t._lineCells=Jr.newInstance({values:Uint16Array.from(Ua)}),gt.moveToProtected(e,t,["polys","lineCells"]),gt.algo(e,t,0,1),za(e,t)}var Ha={newInstance:gt.newInstance(Wa,"vtkCubeSource"),extend:Wa};const{vtkErrorMacro:Xa}=gt;function Ka(e,t){t.classHierarchy.push("vtkImageDataOutlineFilter");const n={...e};e.requestData=(e,n)=>{const r=e[0];if(!r||!r.isA("vtkImageData"))return void Xa("Invalid or missing input");const o=r.getSpatialExtent();o?(t._cubeSource.setBounds(o),t._cubeSource.setMatrix(r.getIndexToWorld()),n[0]=t._cubeSource.getOutputData()):Xa("Unable to fetch spatial extents of input image.")},e.getMTime=()=>Math.max(n.getMTime(),t._cubeSource.getMTime()),e.setGenerateFaces=t._cubeSource.setGenerateFaces,e.setGenerateLines=t._cubeSource.setGenerateLines,e.getGenerateFaces=t._cubeSource.getGenerateFaces,e.getGenerateLines=t._cubeSource.getGenerateLines}const qa={};function $a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qa,n),gt.obj(e,t),gt.algo(e,t,1,1),t._cubeSource=Ha.newInstance(),gt.moveToProtected(e,t,["cubeSource","tmpOut"]),Ka(e,t)}var Ya={newInstance:gt.newInstance($a,"vtkImageDataOutlineFilter"),extend:$a};const Ja={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Qa={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var Za={Wrap:Ja,Filter:Qa};const es=new Float32Array(1),ts=new Int32Array(es.buffer);var ns={fromHalf:function(e){const t=(32768&e)>>15,n=(31744&e)>>10,r=1023&e;return 0===n?(t?-1:1)*2**-14*(r/1024):31===n?r?NaN:1/0*(t?-1:1):(t?-1:1)*2**(n-15)*(1+r/1024)},toHalf:function(e){es[0]=e;const t=ts[0];let n=t>>16&32768,r=t>>12&2047;const o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(255===o?0:1)&&8388607&t,n):o<113?(r|=2048,n|=(r>>114-o)+(r>>113-o&1),n):(n|=o-112<<10|r>>1,n+=1&r,n)}};const{Wrap:rs,Filter:os}=Za,{VtkDataTypes:is}=Wr,{vtkDebugMacro:as,vtkErrorMacro:ss,vtkWarningMacro:ls}=vt,{toHalf:us}=ns;function cs(e,t){function n(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=[];let i=t.width*t.height*t.components;if(r&&(i*=t.depth),e!==is.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Float32Array(t))}else o.push(null);if(e!==is.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;ei?n[e].subarray(0,i):n[e];o.push(new Uint8Array(t))}else o.push(null);let a=!1;if(t._openGLRenderWindow.getWebgl2())a=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");a=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(a)for(let e=0;e=o&&(u=o-1);const m=a-l,g=1-m;l=l*r*i,u=u*r*i;for(let t=0;t=r&&(p=r-1);const v=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(r,o)||i);t.useHalfFloat=s}(i,u.offset,u.scale,r),t.useHalfFloat||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(n?t._openGLRenderWindow=n:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent()),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(os.LINEAR),e.setMagnificationFilter(os.LINEAR)):(e.setMinificationFilter(os.NEAREST),e.setMagnificationFilter(os.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(rs.REPEAT),e.setWrapS(rs.REPEAT),e.setWrapT(rs.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR));const n=t.renderable.getCanvas();e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const n=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(os.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw(n.width,n.height,4,is.UNSIGNED_CHAR,n.data,!0),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const n=t.renderable.getInputData(0);if(n&&n.getPointData().getScalars()){const r=n.getExtent(),o=n.getPointData().getScalars(),i=[];for(let e=0;e{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=n=>{n&&t.handle&&(n.activateTexture(e),n.deactivateTexture(e),t.context.deleteTexture(t.handle),t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(n),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let n=0;t.target===t.context.TEXTURE_2D?n=t.context.TEXTURE_BINDING_2D:ls("impossible case"),e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(n,r)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(n,r)),t.internalFormat||as(`Unable to find suitable internal format for T=${n} NC= ${r}`),t.internalFormat),e.getDefaultInternalFormat=(e,n)=>{let r=0;return r=t._openGLRenderWindow.getDefaultTextureInternalFormat(e,n,t.oglNorm16Ext,t.useHalfFloat),r||(r||(as("Unsupported internal texture type!"),as(`Unable to find suitable internal format for T=${e} NC= ${n}`)),r)},e.setInternalFormat=n=>{t._forceInternalFormat=!0,n!==t.internalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=(n,r)=>(t.format=e.getDefaultFormat(n,r),t.format),e.getDefaultFormat=(e,n)=>{if(t._openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=e=>{if(t._openGLRenderWindow.getWebgl2())switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case t.oglNorm16Ext&&!t.useHalfFloat&&is.SHORT:return t.context.SHORT;case t.oglNorm16Ext&&!t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case t.useHalfFloat&&is.SHORT:case t.useHalfFloat&&is.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case is.FLOAT:case is.VOID:default:return t.context.FLOAT}switch(e){case is.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case is.FLOAT:case is.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!r||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:n=127.5,e=n-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:n=32767.5,e=n-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:n=2147483647.5,e=n-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=e=>{switch(e){case os.NEAREST:return t.context.NEAREST;case os.LINEAR:return t.context.LINEAR;case os.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case os.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case os.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case os.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case rs.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case rs.REPEAT:return t.context.REPEAT;case rs.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(i,a,s,l,u){let c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e.getOpenGLDataType(l,!0),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=n(l,d),f=r(p);return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(l)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=f[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,f[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,f[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createCubeFromRaw=(i,a,s,l,u)=>{if(e.getOpenGLDataType(l),e.getInternalFormat(l,s),e.getFormat(l,s),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=s,t.width=i,t.height=a,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=r(n(l,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&i>=1;){let a=null;n<=t.maxLevel&&(a=d[6*n+e]),o(l)?null!=a&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r,i,t.format,t.openGLDataType,a):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,t.internalFormat,r,i,0,t.format,t.openGLDataType,a),n++,r/=2,i/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*s*t._openGLRenderWindow.getDefaultTextureByteSize(l,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.createDepthFromRaw=(n,r,i,a)=>(e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===is.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0):(ss("Failed to determine texture parameters."),!1)),e.create2DFromImage=n=>{if(e.getOpenGLDataType(is.UNSIGNED_CHAR),e.getInternalFormat(is.UNSIGNED_CHAR,4),e.getFormat(is.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);const r=!(t._openGLRenderWindow.getWebgl2()||Pn(n.width)&&Pn(n.height)),i=document.createElement("canvas");i.width=r?In(n.width):n.width,i.height=r?In(n.height):n.height,t.width=i.width,t.height=i.height;const a=i.getContext("2d");a.translate(0,i.height),a.scale(1,-1),a.drawImage(n,0,0,n.width,n.height,0,0,i.width,i.height);const s=i;return o(is.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=s&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,s)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(is.UNSIGNED_CHAR,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create2DFilterableFromRaw=function(t,n,r,o,i){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return e.create2DFilterableFromDataArray(t,n,Wr.newInstance({numberOfComponents:r,dataType:o,values:i}),a)},e.create2DFilterableFromDataArray=function(t,n,r){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{numComps:a,dataType:s,data:l}=i(r,o);e.create2DFromRaw(t,n,a,s,l)},e.create3DFromRaw=(i,a,s,l,u,c)=>{if(e.getOpenGLDataType(u),e.getInternalFormat(u,l),e.getFormat(u,l),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_3D,t.components=l,t.width=i,t.height=a,t.depth=s,t.numberOfDimensions=3,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=r(n(u,[c],!0));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),o(u)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=d[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,d[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,d[0]),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(u,t.oglNorm16Ext,t.useHalfFloat),e.deactivate(),!0},e.create3DFilterableFromRaw=function(t,n,r,o,i,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return e.create3DFilterableFromDataArray(t,n,r,Wr.newInstance({numberOfComponents:o,dataType:i,values:a}),s)},e.create3DFilterableFromDataArray=function(n,r,a,s){let l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{numComps:u,dataType:c,data:d,scaleOffsets:p}=i(s,l),f=n*r*a,h=[],m=[];for(let e=0;e1/e));for(let e=0;e{e[t]=n},y=is.UNSIGNED_CHAR;if(c===is.UNSIGNED_CHAR)for(let e=0;e{e[t]=(n-r)/o}):(y=is.UNSIGNED_CHAR,v=(e,t,n,r,o)=>{e[t]=255*(n-r)/o});if(e.getOpenGLDataType(y),e.getInternalFormat(y,u),e.getFormat(y,u),!t.internalFormat||!t.format||!t.openGLDataType)return ss("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=u,t.depth=1,t.numberOfDimensions=2;let b=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);b>4096&&(y===is.FLOAT||u>=3)&&(b=4096);let x=1,_=1;f>b*b&&(x=Math.ceil(Math.sqrt(f/(b*b))),_=x);let T=Math.sqrt(f)/x;T=In(T);const S=Math.floor(T*x/n),w=Math.ceil(a/S),C=In(r*w/_);let A;t.width=T,t.height=C,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=S,t.volumeInfo.yreps=w,t.volumeInfo.xstride=x,t.volumeInfo.ystride=_,t.volumeInfo.offset=g.offset,t.volumeInfo.scale=g.scale;const E=T*C*u;A=y===is.FLOAT?new Float32Array(E):new Uint8Array(E);let D=0;const I=Math.floor(n/x),P=Math.floor(r/_);for(let e=0;e{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1}const ds={_openGLRenderWindow:null,_forceInternalFormat:!1,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:rs.CLAMP_TO_EDGE,wrapT:rs.CLAMP_TO_EDGE,wrapR:rs.CLAMP_TO_EDGE,minificationFilter:os.NEAREST,magnificationFilter:os.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,useHalfFloat:!0,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0};function ps(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ds,n),Tt.extend(e,t,n),t.sendParametersTime={},je(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},je(t.textureBuildTime,{mtime:0}),qe(e,t,["format","openGLDataType"]),$e(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),He(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Ze(0,t,["openGLRenderWindow"]),cs(e,t)}const fs=rt(ps,"vtkOpenGLTexture");var hs={newInstance:fs,extend:ps,...Za};Dt("vtkTexture",fs);var ms=function(e,t){e.replaceShaderCoincidentOffset=(n,r,o)=>{const i=e.getCoincidentParameters(r,o);if(i&&(0!==i.factor||0!==i.offset)){let e=n.Fragment;e=Ca.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=Ca.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=Ca.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=e}}},gs=function(e,t){e.applyShaderReplacements=(e,t,n)=>{let r=null;if(t&&(r=t.ShaderReplacements),r)for(let t=0;t{e.getReplacedShaderTemplate(n,r,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(n);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(n,i,!0),e.replaceShaderValues(n,r,o),e.applyShaderReplacements(n,i)},e.getReplacedShaderTemplate=(n,r,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(n,r,o);let a=n.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}n.Vertex=a;let s=n.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}n.Fragment=s;let l=n.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}n.Geometry=l}};let vs;function ys(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,n)=>(Yt(n,e,t.matrix),n),e.transformPoints=(e,n)=>{const r=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,n)=>(t.preMultiplyFlag?y(n,t.matrix,e):y(n,e,t.matrix),n),e.transformMatrices=(e,n)=>{const r=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>y(o,t.matrix,r):()=>y(o,r,t.matrix);for(let t=0;tvs({matrix:Or.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag})}const bs={preMultiplyFlag:!1,matrix:[...un]};function xs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bs,n),gt.obj(e,t),gt.setGet(e,t,["preMultiplyFlag"]),gt.setGetArray(e,t,["matrix"],16),ys(e,t)}vs=gt.newInstance(xs,"vtkTransform");var _s={newInstance:vs,extend:xs};const Ts=0,{vtkErrorMacro:Ss}=vt;function ws(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Cs(e,t,n){return t.identity(n),e.reduce(((e,n,r)=>0===r?n?t.copy(e,n):t.identity(e):n?t.multiply(e,e,n):e),n)}function As(e,t){t.classHierarchy.push("vtkOpenGLImageResliceMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t._openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const n=t._openGLRenderer.getRenderable();t._openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow)}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t._openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),t.currentInput?(e.updateResliceGeometry(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r),e.invokeEvent({type:"EndEvent"})):Ss("No input!")},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===Ts?(t.openGLTexture.setMinificationFilter(Qa.NEAREST),t.openGLTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.openGLTexture.setMinificationFilter(Qa.LINEAR),t.openGLTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const r=t.currentInput;if(!r)return;const o=r.getPointData()?.getScalars();if(!o)return;t._scalars!==o&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=o);const i=o.getNumberOfComponents();let a=`${r.getMTime()}A${o.getMTime()}`;const s=t._openGLRenderWindow.getGraphicsResourceForObject(o);if(s?.vtkObj&&s?.hash===a&&t.openGLTextureString===a)t.openGLTexture=s.vtkObj,t.openGLTextureString=s.hash;else{t.openGLTexture||(t.openGLTexture=hs.newInstance(),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const e=r.getDimensions();t.openGLTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.resetFormatAndType(),t.openGLTexture.create3DFilterableFromDataArray(e[0],e[1],e[2],o),t.openGLTextureString=a,o&&t._openGLRenderWindow.setGraphicsResourceForObject(o,t.openGLTexture,t.openGLTextureString)}const l=n.getProperty(),u=l.getIndependentComponents(),c=u?i:1,d=u?2*c:1,p=l.getRGBTransferFunction();a=ws(l,p,c);const f=t._openGLRenderWindow.getGraphicsResourceForObject(p);if(f?.vtkObj&&f?.hash===a&&t.colorTextureString===a)t.colorTexture=f.vtkObj,t.colorTextureString=f.hash;else{const e=1024,n=new Uint8Array(e*d*3);if(t.colorTexture||(t.colorTexture=hs.newInstance(),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),p){const r=new Float32Array(3*e);for(let t=0;t0){const e=t.resliceGeom.getPointData().getNormals();e?r.normals=e:Ss("Slab mode requested without normals")}t.tris.getCABO().createVBO(n,"polys",ua.SURFACE,r)}t.VBOBuildString=g,t.VBOBuildTime.modified()},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();if(n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){i.isUniformUsed("texture1")&&i.setUniformi("texture1",t.openGLTexture.getTextureUnit()),i.isAttributeUsed("vertexWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexWC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting vertexWC in shader VAO.")),i.isAttributeUsed("normalWC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"normalWC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ss("Error setting normalWC in shader VAO.")),i.isUniformUsed("slabThickness")&&i.setUniformf("slabThickness",t.renderable.getSlabThickness()),i.isUniformUsed("spacing")&&i.setUniform3fv("spacing",t.currentInput.getSpacing()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabType")&&i.setUniformi("slabType",t.renderable.getSlabType()),i.isUniformUsed("slabTrapezoid")&&i.setUniformi("slabTrapezoid",t.renderable.getSlabTrapezoidIntegration());const e=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null;if(i.isUniformUsed("WCTCMatrix")){const n=t.currentInput,r=n.getDimensions();c(t.tmpMat4,n.getIndexToWorld()),x(t.tmpMat4,t.tmpMat4,r),m(t.tmpMat4,t.tmpMat4),e&&y(t.tmpMat4,t.tmpMat4,e),i.setUniformMatrix("WCTCMatrix",t.tmpMat4)}i.isUniformUsed("vboScaling")&&i.setUniform3fv("vboScaling",n.getCABO().getCoordScale()),n.getAttributeUpdateTime().modified()}if(t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),n.getProgram().isUniformUsed("coffset")){const t=e.getCoincidentParameters(r,o);n.getProgram().setUniformf("coffset",t.offset),n.getProgram().isUniformUsed("cfactor")&&n.getProgram().setUniformf("cfactor",t.factor)}},e.setCameraShaderParameters=(e,n,o)=>{const i=t._openGLCamera.getKeyMatrices(n),a=t._openGLImageSlice.getKeyMatrices(),s=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,l=e.getProgram();l.isUniformUsed("MCPCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCPCMatrix",Cs([i.wcpc,a.mcwc,s],r,t.tmpMat4))),l.isUniformUsed("MCVCMatrix")&&(f(t.tmpMat4),l.setUniformMatrix("MCVCMatrix",Cs([i.wcvc,a.mcwc,s],r,t.tmpMat4)))},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.openGLTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=t.renderable.getSlabThickness(),s=t.renderable.getSlabType(),l=t.renderable.getSlabTrapezoidIntegration();let u=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(u=!0),!(!u&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i&&t.lastSlabThickness===a&&t.lastSlabType===s&&t.lastSlabTrapezoidIntegration===l||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,t.lastSlabThickness=a,t.lastSlabType=s,t.lastSlabTrapezoidIntegration=l,0))},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{if(e.replaceShaderTCoord(n,r,o),e.replaceShaderPositionVC(n,r,o),t.haveSeenDepthRequest){let e=n.Fragment;e=Ca.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=Ca.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=e}e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderTCoord=(e,n,r)=>{let o=e.Vertex;const i=e.Geometry;let a=e.Fragment;const s=t.renderable.getSlabThickness();o=Ca.substitute(o,"//VTK::TCoord::Dec",["uniform mat4 WCTCMatrix;","out vec3 fragTexCoord;"]).result,o=Ca.substitute(o,"//VTK::TCoord::Impl",["fragTexCoord = (WCTCMatrix * vertexWC).xyz;"]).result;const l=t.openGLTexture.getComponents(),u=r.getProperty().getIndependentComponents();let c=["in vec3 fragTexCoord;","uniform highp sampler3D texture1;","uniform mat4 WCTCMatrix;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;"];if(u){for(let e=1;e0&&(c=c.concat(["uniform vec3 spacing;","uniform float slabThickness;","uniform int slabType;","uniform int slabTrapezoid;","uniform vec3 vboScaling;"]),c=c.concat(["vec4 compositeValue(vec4 currVal, vec4 valToComp, int trapezoid)","{"," vec4 retVal = vec4(1.0);"," if (slabType == 0) // min"," {"," retVal = min(currVal, valToComp);"," }"," else if (slabType == 1) // max"," {"," retVal = max(currVal, valToComp);"," }"," else if (slabType == 3) // sum"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," else // mean"," {"," retVal = currVal + (trapezoid > 0 ? 0.5 * valToComp : valToComp); "," }"," return retVal;","}"])),a=Ca.substitute(a,"//VTK::TCoord::Dec",c).result;let d=["if (any(greaterThan(fragTexCoord, vec3(1.0))) || any(lessThan(fragTexCoord, vec3(0.0))))","{"," // set the background color and exit"," gl_FragData[0] = backgroundColor;"," return;","}","vec4 tvalue = texture(texture1, fragTexCoord);"];if(s>0&&(d=d.concat(["// Get the first and last samples","int numSlices = 1;","float scaling = min(min(spacing.x, spacing.y), spacing.z) * 0.5;","vec3 normalxspacing = scaling * normalWCVSOutput;","float distTraveled = length(normalxspacing);","int trapezoid = 0;","while (distTraveled < slabThickness * 0.5)","{"," distTraveled += length(normalxspacing);"," float fnumSlices = float(numSlices);"," if (distTraveled > slabThickness * 0.5)"," {"," // Before stepping outside the slab, sample at the boundaries"," normalxspacing = normalWCVSOutput * slabThickness * 0.5 / fnumSlices;"," trapezoid = slabTrapezoid;"," }"," vec3 fragTCoordNeg = (WCTCMatrix * vec4(vertexWCVSOutput.xyz - fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordNeg);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }"," vec3 fragTCoordPos = (WCTCMatrix * vec4(vertexWCVSOutput.xyz + fnumSlices * normalxspacing * vboScaling, 1.0)).xyz;"," if (!any(greaterThan(fragTCoordNeg, vec3(1.0))) && !any(lessThan(fragTCoordNeg, vec3(0.0))))"," {"," vec4 newVal = texture(texture1, fragTCoordPos);"," tvalue = compositeValue(tvalue, newVal, trapezoid);"," numSlices += 1;"," }","}","// Finally, if slab type is *mean*, divide the sum by the numSlices","if (slabType == 2)","{"," tvalue = tvalue / float(numSlices);","}"])),u){const e=["r","g","b","a"];for(let t=0;t{let i=n.Vertex;const a=n.Geometry;let s=n.Fragment;const l=t.renderable.getSlabThickness();let u=["attribute vec4 vertexWC;"];u=u.concat([`//${e.getMTime()}${t.resliceGeomUpdateString}`]),l>0&&(u=u.concat(["attribute vec3 normalWC;","varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),i=Ca.substitute(i,"//VTK::PositionVC::Dec",u).result;let c=["gl_Position = MCPCMatrix * vertexWC;"];l>0&&(c=c.concat(["normalWCVSOutput = normalWC;","vertexWCVSOutput = vertexWC;"])),i=Ca.substitute(i,"//VTK::PositionVC::Impl",c).result,i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result;let d=[];l>0&&(d=d.concat(["varying vec3 normalWCVSOutput;","varying vec4 vertexWCVSOutput;"])),s=Ca.substitute(s,"//VTK::PositionVC::Dec",d).result,n.Vertex=i,n.Geometry=a,n.Fragment=s},e.updateResliceGeometry=()=>{let e="";const n=t.currentInput,r=n?.getBounds();let o=!0,a=2;const s=t.renderable.getSlicePolyData(),l=t.renderable.getSlicePlane();if(s)e=e.concat(`PolyData${s.getMTime()}`);else if(l){e=e.concat(`Plane${l.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`));const t=function(e,t,n,r,o,a,s,l,u){var c=new i(9);return c[0]=e,c[1]=void 0,c[2]=void 0,c[3]=void 0,c[4]=void 0,c[5]=void 0,c[6]=void 0,c[7]=void 0,c[8]=void 0,c}(n?.getDirection());se(t,t);const r=[...l.getNormal()];Jt(r,r,t),[o,a]=function(e){Or.normalize(e);const t=[0,0,0];for(let n=0;n<3;++n){Qt(t),t[n]=1;const r=Or.dot(e,t);if(r<-.999||r>.999)return[!0,n]}return[!1,2]}(r)}else{const o=Ii.newInstance();o.setNormal(0,0,1);let i=[0,1,0,1,0,1];n&&(i=r),o.setOrigin(i[0],i[2],.5*(i[5]+i[4])),t.renderable.setSlicePlane(o),e=e.concat(`Plane${l?.getMTime()}`),n&&(e=e.concat(`Image${n.getMTime()}`))}if(!t.resliceGeom||t.resliceGeomUpdateString!==e){if(s)t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(s.getPoints().getData(),3),t.resliceGeom.getPolys().setData(s.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(s.getPointData().getNormals());else if(l)if(o){const e=new Float32Array(12),r=n.worldToIndex(l.getOrigin(),[0,0,0]),o=[(a+1)%3,(a+2)%3].sort(),i=n.getDimensions(),s=[0,i[0]-1,0,i[1]-1,0,i[2]-1];let u=0;for(let t=0;t<2;++t)for(let n=0;n<2;++n)e[u+a]=r[a],e[u+o[0]]=s[2*o[0]+n],e[u+o[1]]=s[2*o[1]+t],u+=3;t.transform.setMatrix(n.getIndexToWorld()),t.transform.transformPoints(e,e);const c=new Uint16Array(8);c[0]=3,c[1]=0,c[2]=1,c[3]=3,c[4]=3,c[5]=0,c[6]=3,c[7]=2;const d=l.getNormal();Or.normalize(d);const p=new Float32Array(12);for(let e=0;e<4;++e)p[3*e]=d[0],p[3*e+1]=d[1],p[3*e+2]=d[2];t.resliceGeom||(t.resliceGeom=ji.newInstance()),t.resliceGeom.getPoints().setData(e,3),t.resliceGeom.getPolys().setData(c,1);const f=Wr.newInstance({numberOfComponents:3,values:p,name:"Normals"});t.resliceGeom.getPointData().setNormals(f)}else{t.outlineFilter.setInputData(n),t.cutter.setInputConnection(t.outlineFilter.getOutputPort()),t.cutter.setCutFunction(l),t.lineToSurfaceFilter.setInputConnection(t.cutter.getOutputPort()),t.lineToSurfaceFilter.update(),t.resliceGeom||(t.resliceGeom=ji.newInstance());const e=t.lineToSurfaceFilter.getOutputData();t.resliceGeom.getPoints().setData(e.getPoints().getData(),3),t.resliceGeom.getPolys().setData(e.getPolys().getData(),1),t.resliceGeom.getPointData().setNormals(e.getPointData().getNormals());const r=l.getNormal(),o=t.resliceGeom.getNumberOfPoints();Or.normalize(r);const i=new Float32Array(3*o);for(let e=0;e{e&&(t.openGLTexture=e,t._externalOpenGLTexture=!0)}}const Es={VBOBuildTime:{},VBOBuildString:null,haveSeenDepthRequest:!1,lastHaveSeenDepthRequest:!1,lastIndependentComponents:!1,lastTextureComponents:0,lastSlabThickness:0,lastSlabTrapezoidIntegration:0,lastSlabType:-1,openGLTexture:null,openGLTextureString:null,colorTextureString:null,pwfTextureString:null,resliceGeom:null,resliceGeomUpdateString:null,tris:null,colorTexture:null,pwfTexture:null,_externalOpenGLTexture:!1,_scalars:null};const Ds=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.openGLTexture=null,t.colorTexture=null,t.pwfTexture=null,t.VBOBuildTime={},je(t.VBOBuildTime),t.tmpMat4=f(new Float64Array(16)),t.outlineFilter=Ya.newInstance(),t.outlineFilter.setGenerateFaces(!0),t.outlineFilter.setGenerateLines(!1),t.cubePolyData=ji.newInstance(),t.cutter=ea.newInstance(),t.lineToSurfaceFilter=$i.newInstance(),t.transform=_s.newInstance(),He(e,t,["openGLTexture"]),As(e,t)}),"vtkOpenGLImageResliceMapper");Dt("vtkImageResliceMapper",Ds);var Is={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},Ps="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",Os="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";const{vtkErrorMacro:Ns}=vt,{SlicingMode:Ms}=Is;function Rs(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function Fs(e){const t=e.split("\n"),n=[];for(let e=0;e0&&n.push(r)}return n}function ks(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=n=>{if(n){t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow);const n=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(n.getActiveCamera()),t.renderable.isA("vtkImageMapper")&&t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.zBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Ps,e.Fragment=Os,e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result,i=Ca.substitute(i,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result,i=Ca.substitute(i,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result;const s=t.openGLTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=["varying vec2 tcoordVCVSOutput;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform sampler2D labelOutlineTexture1;","uniform float opacity;","uniform float outlineOpacity;"];if(l){for(let e=1;e 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n float value = texture2D(texture1, neighborPosIS.xy).r;\n if (value != centerValue) {\n pixelOnBorder = true;\n break;\n }\n }\n if (pixelOnBorder == true) {\n break;\n }\n }\n if (pixelOnBorder == true) {\n gl_FragData[0] = vec4(tColor, outlineOpacity);\n }\n else {\n gl_FragData[0] = vec4(tColor, opacityToUse);\n }\n }\n #else\n float intensity = texture2D(texture1, tcoordVCVSOutput).r;\n vec3 tcolor = texture2D(colorTexture1, vec2(intensity * cscale0 + cshift0, 0.5)).rgb;\n float scalarOpacity = texture2D(pwfTexture1, vec2(intensity * pwfscale0 + pwfshift0, 0.5)).r;\n gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);\n #endif\n ")]).result;break;case 2:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*cscale0 + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);"]).result;break;case 3:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);"]).result;break;default:a=Ca.substitute(a,"//VTK::TCoord::Impl",["vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(a=Ca.substitute(a,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,a=Ca.substitute(a,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),n.Vertex=i,n.Fragment=a,e.replaceShaderClip(n,r,o),e.replaceShaderCoincidentOffset(n,r,o)},e.replaceShaderClip=(e,n,r)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getNeedToRebuildShaders=(e,n,r)=>{const o=t.openGLTexture.getComponents(),i=r.getProperty().getIndependentComponents();let a=!1;return(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(a=!0),!(!a&&t.lastHaveSeenDepthRequest===t.haveSeenDepthRequest&&0!==e.getProgram()?.getHandle()&&t.lastTextureComponents===o&&t.lastIndependentComponents===i||(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,0))},e.updateShaders=(n,r,o)=>{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ns("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),t.context.FALSE)||Ns("Error setting tcoordMC in shader VAO.")),n.getAttributeUpdateTime().modified());const i=t.openGLTexture.getTextureUnit();n.getProgram().setUniformi("texture1",i);const a=t.openGLTexture.getComponents(),s=o.getProperty().getIndependentComponents();if(s)for(let e=0;e6&&(Ce("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const i=n.getProgram(),a=t.openGLImageSlice.getKeyMatrices(),s=t.currentInput,l=s.getIndexToWorld();y(t.imagemat,a.mcwc,l);const u=t.openGLCamera.getKeyMatrices(r);if(y(t.imagemat,u.wcpc,t.imagemat),n.getCABO().getCoordShiftAndScaleEnabled()){const e=n.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,e)}if(i.setUniformMatrix("MCPCMatrix",t.imagemat),!0===o.getProperty().getUseLabelOutline()){const n=s.getWorldToIndex(),o=s.getDimensions();i.setUniform3i("imageDimensions",o[0],o[1],1),i.setUniformMatrix("vWCtoIDX",n);const a=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,a.wcpc),t.openGLCamera.getKeyMatrices(r),i.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const l=e.getRenderTargetSize();i.setUniformf("vpWidth",l[0]),i.setUniformf("vpHeight",l[1]);const u=e.getRenderTargetOffset();i.setUniformf("vpOffsetX",u[0]/l[0]),i.setUniformf("vpOffsetY",u[1]/l[1])}},e.setPropertyShaderParameters=(e,t,n)=>{const r=e.getProgram(),o=n.getProperty().getOpacity();r.setUniformf("opacity",o)},e.renderPieceStart=(n,r)=>{e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=(n,r)=>{const o=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getCurrentImage(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ns("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;const a=i.getDataType(),s=i.getNumberOfComponents(),l=r.getProperty(),u=l.getInterpolationType(),c=l.getIndependentComponents(),d=c?s:1,p=c?2*d:1,f=l.getRGBTransferFunction(),h=Rs(l,f,d),m=t._openGLRenderWindow.getGraphicsResourceForObject(f);if(m?.vtkObj&&m?.hash===h&&t.colorTextureString===h)t.colorTexture=m.vtkObj,t.colorTextureString=m.hash;else{const e=1024,n=new Uint8Array(e*p*3);if(t.colorTexture||(t.colorTexture=hs.newInstance({resizable:!0}),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow)),u===Ts?(t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST)):(t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR)),f){const r=new Float32Array(3*e);for(let t=0;t1?1:0;const d=[Ms.X,Ms.Y,Ms.Z].includes(t.renderable.getSlicingMode())?x:_,p=o.getSpatialExtent(),f=i.getData();let h=null;if(b===Ms.I){h=new f.constructor(e[2]*e[1]*s);let t=0;for(let n=0;n{t.labelOutlineThicknessTexture||(t.labelOutlineThicknessTexture=hs.newInstance({resizable:!1}),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow));const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]}}const Ls={VBOBuildTime:0,VBOBuildString:null,openGLTexture:null,tris:null,imagemat:null,imagematinv:null,colorTexture:null,pwfTexture:null,labelOutlineThicknessTexture:null,labelOutlineThicknessTextureString:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,_scalars:null};const Bs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ls,n),Tt.extend(e,t,n),ms(e,t,n),gs(e,t,n),t.tris=Ra.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),$e(e,t,[]),t.VBOBuildTime={},je(t.VBOBuildTime),ks(e,t)}),"vtkOpenGLImageMapper");Dt("vtkAbstractImageMapper",Bs);const{vtkErrorMacro:Vs}=gt;function Us(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-${n}`}return"0"}function Gs(e,t){t.classHierarchy.push("vtkOpenGLImageCPRMapper"),e.buildPass=n=>{n&&(t.currentRenderPass=null,t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera()),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.volumeTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.pwfTexture.setOpenGLRenderWindow(t._openGLRenderWindow))},e.opaquePass=(n,r)=>{n&&(t.currentRenderPass=r,e.render())},e.opaqueZBufferPass=n=>{n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.getCoincidentParameters=(e,n)=>t.renderable.getResolveCoincidentTopology()?t.renderable.getCoincidentTopologyPolygonOffsetParameters():null,e.render=()=>{const n=t.openGLImageSlice.getRenderable(),r=t._openGLRenderer.getRenderable();e.renderPiece(r,n)},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),e.invokeEvent({type:"EndEvent"}),t.renderable.preRenderCheck()&&(t.currentImageDataInput=t.renderable.getInputData(0),t.currentCenterlineInput=t.renderable.getOrientedCenterline(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r))},e.renderPieceStart=(t,n)=>{e.updateBufferObjects(t,n)},e.renderPieceDraw=(n,r)=>{const o=t.context;t.volumeTexture.activate(),t.colorTexture.activate(),t.pwfTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.volumeTexture.deactivate(),t.colorTexture.deactivate(),t.pwfTexture.deactivate()},e.renderPieceFinish=(e,t)=>{},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>{const o=t.VBOBuildTime.getMTime();return o{const r=t.currentImageDataInput,o=t.currentCenterlineInput;n.getProperty().getInterpolationType()===Ts?(t.volumeTexture.setMinificationFilter(Qa.NEAREST),t.volumeTexture.setMagnificationFilter(Qa.NEAREST),t.colorTexture.setMinificationFilter(Qa.NEAREST),t.colorTexture.setMagnificationFilter(Qa.NEAREST),t.pwfTexture.setMinificationFilter(Qa.NEAREST),t.pwfTexture.setMagnificationFilter(Qa.NEAREST)):(t.volumeTexture.setMinificationFilter(Qa.LINEAR),t.volumeTexture.setMagnificationFilter(Qa.LINEAR),t.colorTexture.setMinificationFilter(Qa.LINEAR),t.colorTexture.setMagnificationFilter(Qa.LINEAR),t.pwfTexture.setMinificationFilter(Qa.LINEAR),t.pwfTexture.setMagnificationFilter(Qa.LINEAR));const i=r.getMTime();if(t.volumeTextureTime!==i){const e=r.getDimensions(),n=r.getPointData().getScalars();if(!n)return;t.volumeTexture.setOglNorm16Ext(t.context.getExtension("EXT_texture_norm16")),t.volumeTexture.releaseGraphicsResources(t._openGLRenderWindow),t.volumeTexture.resetFormatAndType(),t.volumeTexture.create3DFilterableFromRaw(e[0],e[1],e[2],n.getNumberOfComponents(),n.getDataType(),n.getData(),t.renderable.getPreferSizeOverAccuracy()),t.volumeTextureTime=i}const a=r.getPointData()&&r.getPointData().getScalars();if(!a)return;const s=a.getNumberOfComponents(),l=n.getProperty(),u=l.getIndependentComponents(),c=u?s:1,d=u?2*c:1,p=Us(l,l.getRGBTransferFunction,c);if(t.colorTextureString!==p){const e=1024,n=new Uint8Array(e*d*3);let r=l.getRGBTransferFunction();if(r){const o=new Float32Array(3*e);for(let t=0;t{const o=t.volumeTexture.getComponents(),i=r.getProperty().getIndependentComponents(),a=!!t.renderable.getCenterPoint(),s=t.renderable.getUseUniformOrientation();return(0===e.getProgram()||t.lastUseCenterPoint!==a||t.lastUseUniformOrientation!==s||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||t.lastTextureComponents!==o||t.lastIndependentComponents!==i)&&(t.lastUseCenterPoint=a,t.lastUseUniformOrientation=s,t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=o,t.lastIndependentComponents=i,!0)},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.replaceShaderValues=(n,r,o)=>{let i=n.Vertex,a=n.Fragment;i=Ca.substitute(i,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,i=Ca.substitute(i,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result;const s=["attribute vec3 centerlinePosition;","attribute float quadIndex;","uniform float width;","out vec2 quadOffsetVSOutput;","out vec3 centerlinePosVSOutput;"],l=t.renderable.getUseUniformOrientation();l?s.push("out vec3 centerlineDirVSOutput;","uniform vec3 centerlineDirection;"):s.push("out vec3 centerlineTopDirVSOutput;","out vec3 centerlineBotDirVSOutput;","out float centerlineAngleVSOutput;","attribute vec3 centerlineTopDirection;","attribute vec3 centerlineBotDirection;"),i=Ca.substitute(i,"//VTK::Color::Dec",s).result;const u=["quadOffsetVSOutput = vec2(width * (mod(quadIndex, 2.0) == 0.0 ? -0.5 : 0.5), quadIndex > 1.0 ? 0.0 : 1.0);","centerlinePosVSOutput = centerlinePosition;"];l?u.push("centerlineDirVSOutput = centerlineDirection;"):u.push("vec3 sumVec = centerlineTopDirection + centerlineBotDirection;","float sumLen2 = dot(sumVec, sumVec);","float diffLen2 = 4.0 - sumLen2;","if (diffLen2 < 0.001) {"," // vectors are too close to each other, use lerp"," centerlineAngleVSOutput = -1.0; // use negative angle as a flag for lerp"," centerlineTopDirVSOutput = centerlineTopDirection;"," centerlineBotDirVSOutput = centerlineBotDirection;","} else if (sumLen2 == 0.0) {"," // vector are opposite to each other, don't make a choice for the user"," // use slerp without direction, it will display the centerline color on each row of pixel"," centerlineAngleVSOutput = 0.0;"," centerlineTopDirVSOutput = vec3(0.0);"," centerlineBotDirVSOutput = vec3(0.0);","} else {"," // use slerp"," centerlineAngleVSOutput = 2.0 * atan(sqrt(diffLen2/sumLen2));"," float sinAngle = sin(centerlineAngleVSOutput);"," centerlineTopDirVSOutput = centerlineTopDirection / sinAngle;"," centerlineBotDirVSOutput = centerlineBotDirection / sinAngle;","}"),i=Ca.substitute(i,"//VTK::Color::Impl",u).result;const c=t.volumeTexture.getComponents(),d=o.getProperty().getIndependentComponents();let p=["uniform mat4 MCTCMatrix; // Model coordinates to texture coordinates","in vec2 quadOffsetVSOutput;","in vec3 centerlinePosVSOutput;","uniform highp sampler3D volumeTexture;","uniform sampler2D colorTexture1;","uniform sampler2D pwfTexture1;","uniform float opacity;","uniform vec4 backgroundColor;","uniform float cshift0;","uniform float cscale0;","uniform float pwfshift0;","uniform float pwfscale0;"];l?p.push("in vec3 centerlineDirVSOutput;"):p.push("in vec3 centerlineTopDirVSOutput;","in vec3 centerlineBotDirVSOutput;","in float centerlineAngleVSOutput;");const f=t.renderable.getCenterPoint();if(f&&p.push("uniform vec3 globalCenterPoint;"),d){for(let e=1;e{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6),o=Ca.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,o=Ca.substitute(o,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ca.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ca.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getShaderTemplate=(e,t,n)=>{e.Vertex=Ps,e.Fragment=Os,e.Geometry=""},e.setMapperShaderParameters=(n,r,o)=>{n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Vs("Error setting vertexMC in shader VAO.")),n.getCABO().getCustomData().forEach((e=>{e&&n.getProgram().isAttributeUsed(e.name)&&!n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),e.name,e.offset,n.getCABO().getStride(),t.context.FLOAT,e.components,t.context.FALSE)&&Vs(`Error setting ${e.name} in shader VAO.`)})),n.getAttributeUpdateTime().modified());const i=t.volumeTexture.getTextureUnit();if(n.getProgram().setUniformi("volumeTexture",i),n.getProgram().setUniformf("width",t.renderable.getWidth()),n.getProgram().setUniform4f("backgroundColor",...t.renderable.getBackgroundColor()),n.getProgram().isUniformUsed("centerlineDirection")){const e=t.renderable.getUniformDirection();n.getProgram().setUniform3fArray("centerlineDirection",e)}if(n.getProgram().isUniformUsed("globalCenterPoint")){const e=t.renderable.getCenterPoint();n.getProgram().setUniform3fArray("globalCenterPoint",e)}const a=t.currentImageDataInput,s=a.getWorldToIndex(),l=A(new Float32Array(16),Xt([],a.getDimensions())),u=re(l,l,s);if(n.getProgram().setUniformMatrix("MCTCMatrix",u),t.haveSeenDepthRequest&&n.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),t.renderable.getNumberOfClippingPlanes()){let e=t.renderable.getNumberOfClippingPlanes();e>6&&(gt.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),e=6);const r=n.getCABO().getCoordShiftAndScaleEnabled()?n.getCABO().getInverseShiftAndScaleMatrix():null,i=r?c(t.imagematinv,o.getMatrix()):o.getMatrix();r&&(h(i,i),y(i,i,r),h(i,i)),h(t.imagemat,t.currentImageDataInput.getIndexToWorld()),y(t.imagematinv,i,t.imagemat);const a=[];for(let n=0;n{const o=t.openGLImageSlice.getKeyMatrices().mcwc,i=t.openGLCamera.getKeyMatrices(n).wcpc;if(y(t.imagemat,i,o),e.getCABO().getCoordShiftAndScaleEnabled()){const n=e.getCABO().getInverseShiftAndScaleMatrix();y(t.imagemat,t.imagemat,n)}e.getProgram().setUniformMatrix("MCPCMatrix",t.imagemat)},e.setPropertyShaderParameters=(e,n,r)=>{const o=e.getProgram(),i=r.getProperty(),a=i.getOpacity();o.setUniformf("opacity",a);const s=t.volumeTexture.getComponents(),l=i.getIndependentComponents();if(l)for(let e=0;e{if(e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o)}}const zs={currentRenderPass:null,volumeTexture:null,volumeTextureTime:0,colorTexture:null,colorTextureString:null,pwfTexture:null,pwfTextureString:null,tris:null,lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastTextureComponents:0,lastIndependentComponents:0,imagemat:null,imagematinv:null};const js=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zs,n),Tt.extend(e,t,n),ms(e,t,n),gt.algo(e,t,2,0),t.tris=Ra.newInstance(),t.volumeTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.pwfTexture=hs.newInstance(),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),Gs(e,t)}),"vtkOpenGLImageCPRMapper");function Ws(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseZBufferPass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.zBufferPass=(t,n)=>e.opaquePass(t,n),e.opaqueZBufferPass=(t,n)=>e.opaquePass(t,n),e.opaquePass=(e,n)=>{e&&t.context.depthMask(!0)},e.translucentPass=(e,n)=>{t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(c(t.keyMatrices.mcwc,t.renderable.getMatrix()),h(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices)}Dt("vtkImageCPRMapper",js);const Hs={context:null,keyMatrixTime:null,keyMatrices:null};const Xs=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},$e(e,t,["context"]),Ws(e,t)}),"vtkOpenGLImageSlice");function Ks(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=e=>{t.renderable&&t.renderable.getVisibility()&&t.context.depthMask(!e)},e.getKeyMatrices=()=>(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),c(t.MCWCMatrix,t.renderable.getMatrix()),h(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?ae(t.normalMatrix):(ie(t.normalMatrix,t.MCWCMatrix),se(t.normalMatrix,t.normalMatrix),function(e,t){if(e===t){var n=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix})}Dt("vtkImageSlice",Xs);const qs={};const $s=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qs,n),Tt.extend(e,t,n),t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.normalMatrix=new Float64Array(9),t.MCWCMatrix=new Float64Array(16),$e(e,t,["context"]),Ks(e,t)}),"vtkOpenGLVolume");function Ys(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=e=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=n;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n):Ce("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=t.context;if(!r)return void Ce("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=r.COLOR_ATTACHMENT0;if(n>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");o+=n}t.colorBuffers[n]=e,r.framebufferTexture2D(r.FRAMEBUFFER,o,r.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=t.context;if(!n)return void Ce("you must set the OpenGLRenderWindow before calling removeColorBuffer");let r=n.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ce("Using multiple framebuffer attachments requires WebGL 2");r+=e}n.framebufferTexture2D(n.FRAMEBUFFER,r,n.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const n=t.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.getHandle(),0)}else Ce("Attaching depth buffer textures to fbo requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ce("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ce("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=n=>{t._openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t._openGLRenderWindow=n,t.context=null,n&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>{const e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=()=>{if(!t.context)return void Ce("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const n=t.context,r=hs.newInstance();r.setOpenGLRenderWindow(t._openGLRenderWindow),r.setMinificationFilter(Qa.LINEAR),r.setMagnificationFilter(Qa.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,on.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}Dt("vtkVolume",$s);const Js={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Js,n),je(e,t),t.colorBuffers&&Ce("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],Ye(e,t,["colorBuffers"]),Ys(e,t)}var Zs={newInstance:rt(Qs,"vtkFramebuffer"),extend:Qs};const el={NEAREST:0,LINEAR:1,FAST_LINEAR:2},tl={FRACTIONAL:0,PROPORTIONAL:1};var nl={InterpolationType:el,OpacityMode:tl};const rl={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5};var ol={BlendMode:rl,FilterMode:{OFF:0,NORMALIZED:1,RAW:2}};const{vtkWarningMacro:il,vtkErrorMacro:al}=vt;function sl(e,t,n){if(t){const r=e.getIndependentComponents();return`${t.getMTime()}-${r}-${n}`}return"0"}function ll(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=()=>{t.zBufferTexture=null},e.zBufferPass=(e,n)=>{if(e){const e=n.getZBufferTexture();e!==t.zBufferTexture&&(t.zBufferTexture=e)}},e.opaqueZBufferPass=(t,n)=>e.zBufferPass(t,n),e.volumePass=(n,r)=>{if(n){t._openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.labelOutlineThicknessTexture.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");const n=t.openGLVolume.getRenderable();t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera()),e.renderPiece(r,n)}},e.buildShaders=(t,n,r)=>{e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=(e,t,n)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexDC;\n\nvarying vec3 vertexVCVSOutput;\nuniform mat4 PCVCMatrix;\n\nuniform float dcxmin;\nuniform float dcxmax;\nuniform float dcymin;\nuniform float dcymax;\n\nvoid main()\n{\n // dcsmall is the device coords reduced to the\n // x y area covered by the volume\n vec4 dcsmall = vec4(\n dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),\n dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),\n vertexDC.z,\n vertexDC.w);\n vec4 vcpos = PCVCMatrix * dcsmall;\n vertexVCVSOutput = vcpos.xyz/vcpos.w;\n gl_Position = dcsmall;\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkVolumeFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the volume mappers fragment shader\n\n// the output of this shader\n//VTK::Output::Dec\n\nvarying vec3 vertexVCVSOutput;\n\n// first declare the settings from the mapper\n// that impact the code paths in here\n\n// always set vtkNumComponents 1,2,3,4\n//VTK::NumComponents\n\n// possibly define vtkTrilinearOn\n//VTK::TrilinearOn\n\n// possibly define vtkIndependentComponents\n//VTK::IndependentComponentsOn\n\n// possibly define any \"proportional\" components\n//VTK::vtkProportionalComponents\n\n// Define the blend mode to use\n#define vtkBlendMode //VTK::BlendMode\n\n// Possibly define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n#ifdef vtkImageLabelOutlineOn\n\nuniform float outlineOpacity;\nuniform float vpWidth;\nuniform float vpHeight;\nuniform float vpOffsetX;\nuniform float vpOffsetY;\nuniform mat4 PCWCMatrix;\nuniform mat4 vWCtoIDX;\n#endif\n\n// define vtkLightComplexity\n//VTK::LightComplexity\n#if vtkLightComplexity > 0\nuniform float vSpecularPower;\nuniform float vAmbient;\nuniform float vDiffuse;\nuniform float vSpecular;\n//VTK::Light::Dec\n#endif\n\n//VTK::VolumeShadowOn\n//VTK::SurfaceShadowOn\n//VTK::localAmbientOcclusionOn\n//VTK::LAO::Dec\n//VTK::VolumeShadow::Dec\n\n// define vtkComputeNormalFromOpacity\n//VTK::vtkComputeNormalFromOpacity\n\n// possibly define vtkGradientOpacityOn\n//VTK::GradientOpacityOn\n#ifdef vtkGradientOpacityOn\nuniform float goscale0;\nuniform float goshift0;\nuniform float gomin0;\nuniform float gomax0;\n#if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\nuniform float goscale1;\nuniform float goshift1;\nuniform float gomin1;\nuniform float gomax1;\n#if vtkNumComponents >= 3\nuniform float goscale2;\nuniform float goshift2;\nuniform float gomin2;\nuniform float gomax2;\n#endif\n#if vtkNumComponents >= 4\nuniform float goscale3;\nuniform float goshift3;\nuniform float gomin3;\nuniform float gomax3;\n#endif\n#endif\n#endif\n\n// if you want to see the raw tiled\n// data in webgl1 uncomment the following line\n// #define debugtile\n\n// camera values\nuniform float camThick;\nuniform float camNear;\nuniform float camFar;\nuniform int cameraParallel;\n\n// values describing the volume geometry\nuniform vec3 vOriginVC;\nuniform vec3 vSpacing;\nuniform ivec3 volumeDimensions; // 3d texture dimensions\nuniform vec3 vPlaneNormal0;\nuniform float vPlaneDistance0;\nuniform vec3 vPlaneNormal1;\nuniform float vPlaneDistance1;\nuniform vec3 vPlaneNormal2;\nuniform float vPlaneDistance2;\nuniform vec3 vPlaneNormal3;\nuniform float vPlaneDistance3;\nuniform vec3 vPlaneNormal4;\nuniform float vPlaneDistance4;\nuniform vec3 vPlaneNormal5;\nuniform float vPlaneDistance5;\n\n//VTK::ClipPlane::Dec\n\n// opacity and color textures\nuniform sampler2D otexture;\nuniform float oshift0;\nuniform float oscale0;\nuniform sampler2D ctexture;\nuniform float cshift0;\nuniform float cscale0;\n\n// jitter texture\nuniform sampler2D jtexture;\nuniform sampler2D ttexture;\n\n\n// some 3D texture values\nuniform float sampleDistance;\nuniform vec3 vVCToIJK;\n\n// the heights defined below are the locations\n// for the up to four components of the tfuns\n// the tfuns have a height of 2XnumComps pixels so the\n// values are computed to hit the middle of the two rows\n// for that component\n#ifdef vtkIndependentComponentsOn\n#if vtkNumComponents == 2\nuniform float mix0;\nuniform float mix1;\n#define height0 0.25\n#define height1 0.75\n#endif\n#if vtkNumComponents == 3\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\n#define height0 0.17\n#define height1 0.5\n#define height2 0.83\n#endif\n#if vtkNumComponents == 4\nuniform float mix0;\nuniform float mix1;\nuniform float mix2;\nuniform float mix3;\n#define height0 0.125\n#define height1 0.375\n#define height2 0.625\n#define height3 0.875\n#endif\n#endif\n\n#if vtkNumComponents >= 2\nuniform float oshift1;\nuniform float oscale1;\nuniform float cshift1;\nuniform float cscale1;\n#endif\n#if vtkNumComponents >= 3\nuniform float oshift2;\nuniform float oscale2;\nuniform float cshift2;\nuniform float cscale2;\n#endif\n#if vtkNumComponents >= 4\nuniform float oshift3;\nuniform float oscale3;\nuniform float cshift3;\nuniform float cscale3;\n#endif\n\nuniform vec4 ipScalarRangeMin;\nuniform vec4 ipScalarRangeMax;\n\n// declaration for intermixed geometry\n//VTK::ZBuffer::Dec\n\n//=======================================================================\n// global and custom variables (a temporary section before photorealistics rendering module is complete)\nvec3 rayDirVC;\nfloat sampleDistanceISVS;\nfloat sampleDistanceIS;\n\n#define SQRT3 1.7321\n#define INV4PI 0.0796\n#define EPSILON 0.001\n#define PI 3.1415\n#define PI2 9.8696\n\n//=======================================================================\n// Webgl2 specific version of functions\n#if __VERSION__ == 300\n\nuniform highp sampler3D texture1;\n\nvec4 getTextureValue(vec3 pos)\n{\n vec4 tmp = texture(texture1, pos);\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.a = tmp.g;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n return tmp;\n}\n\n//=======================================================================\n// WebGL1 specific version of functions\n#else\n\nuniform sampler2D texture1;\n\nuniform float texWidth;\nuniform float texHeight;\nuniform int xreps;\nuniform int xstride;\nuniform int ystride;\n\n// if computing trilinear values from multiple z slices\n#ifdef vtkTrilinearOn\nvec4 getTextureValue(vec3 ijk)\n{\n float zoff = 1.0/float(volumeDimensions.z);\n vec4 val1 = getOneTextureValue(ijk);\n vec4 val2 = getOneTextureValue(vec3(ijk.xy, ijk.z + zoff));\n\n float indexZ = float(volumeDimensions)*ijk.z;\n float zmix = indexZ - floor(indexZ);\n\n return mix(val1, val2, zmix);\n}\n\nvec4 getOneTextureValue(vec3 ijk)\n#else // nearest or fast linear\nvec4 getTextureValue(vec3 ijk)\n#endif\n{\n vec3 tdims = vec3(volumeDimensions);\n\n#ifdef debugtile\n vec2 tpos = vec2(ijk.x, ijk.y);\n vec4 tmp = texture2D(texture1, tpos);\n tmp.a = 1.0;\n\n#else\n int z = int(ijk.z * tdims.z);\n int yz = z / xreps;\n int xz = z - yz*xreps;\n\n int tileWidth = volumeDimensions.x/xstride;\n int tileHeight = volumeDimensions.y/ystride;\n\n xz *= tileWidth;\n yz *= tileHeight;\n\n float ni = float(xz) + (ijk.x*float(tileWidth));\n float nj = float(yz) + (ijk.y*float(tileHeight));\n\n vec2 tpos = vec2(ni/texWidth, nj/texHeight);\n\n vec4 tmp = texture2D(texture1, tpos);\n\n#if vtkNumComponents == 1\n tmp.a = tmp.r;\n#endif\n#if vtkNumComponents == 2\n tmp.g = tmp.a;\n#endif\n#if vtkNumComponents == 3\n tmp.a = length(tmp.rgb);\n#endif\n#endif\n\n return tmp;\n}\n\n// End of Webgl1 specific code\n//=======================================================================\n#endif\n\n//=======================================================================\n// transformation between VC and IS space\n\n// convert vector position from idx to vc\n#if (vtkLightComplexity > 0) || (defined vtkClippingPlanesOn)\nvec3 IStoVC(vec3 posIS){\n vec3 posVC = posIS / vVCToIJK;\n return posVC.x * vPlaneNormal0 +\n posVC.y * vPlaneNormal2 +\n posVC.z * vPlaneNormal4 +\n vOriginVC;\n}\n\n// convert vector position from vc to idx\nvec3 VCtoIS(vec3 posVC){\n posVC = posVC - vOriginVC;\n posVC = vec3(\n dot(posVC, vPlaneNormal0),\n dot(posVC, vPlaneNormal2),\n dot(posVC, vPlaneNormal4));\n return posVC * vVCToIJK;\n}\n#endif\n\n//Rotate vector to view coordinate\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\nvoid rotateToViewCoord(inout vec3 dirIS){\n dirIS.xyz =\n dirIS.x * vPlaneNormal0 +\n dirIS.y * vPlaneNormal2 +\n dirIS.z * vPlaneNormal4;\n}\n\n//Rotate vector to idx coordinate\nvec3 rotateToIDX(vec3 dirVC){\n vec3 dirIS;\n dirIS.xyz = vec3(\n dot(dirVC, vPlaneNormal0),\n dot(dirVC, vPlaneNormal2),\n dot(dirVC, vPlaneNormal4));\n return dirIS;\n}\n#endif\n\n//=======================================================================\n// Given a normal compute the gradient opacity factors\nfloat computeGradientOpacityFactor(\n float normalMag, float goscale, float goshift, float gomin, float gomax)\n{\n#if defined(vtkGradientOpacityOn)\n return clamp(normalMag * goscale + goshift, gomin, gomax);\n#else\n return 1.0;\n#endif\n}\n\n//=======================================================================\n// compute the normal and gradient magnitude for a position, uses forward difference\n#if (vtkLightComplexity > 0) || (defined vtkGradientOpacityOn)\n#ifdef vtkClippingPlanesOn\n void adjustClippedVoxelValues(vec3 pos, vec3 texPos[3], inout vec3 g1)\n {\n vec3 g1VC[3];\n for (int i = 0; i < 3; ++i)\n {\n g1VC[i] = IStoVC(texPos[i]);\n }\n vec3 posVC = IStoVC(pos);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if(dot(vec3(vClipPlaneOrigins[i] - g1VC[j].xyz), vClipPlaneNormals[i]) > 0.0)\n {\n g1[j] = 0.0;\n }\n }\n }\n }\n#endif\n\n #ifdef vtkComputeNormalFromOpacity\n #ifdef vtkGradientOpacityOn\n vec4 computeDensityNormal(float gradientMag, vec3 scalarInterp[2])\n {\n #else\n //if gradient opacity not on but using density gradient\n vec4 computeDensityNormal(vec3 scalarInterp[2])\n {\n #endif\n vec3 opacityG1, opacityG2;\n opacityG1.x = texture2D(otexture, vec2(scalarInterp[0].x * oscale0 + oshift0, 0.5)).r;\n opacityG1.y = texture2D(otexture, vec2(scalarInterp[0].y * oscale0 + oshift0, 0.5)).r;\n opacityG1.z = texture2D(otexture, vec2(scalarInterp[0].z * oscale0 + oshift0, 0.5)).r;\n opacityG2.x = texture2D(otexture, vec2(scalarInterp[1].x * oscale0 + oshift0, 0.5)).r;\n opacityG2.y = texture2D(otexture, vec2(scalarInterp[1].y * oscale0 + oshift0, 0.5)).r;\n opacityG2.z = texture2D(otexture, vec2(scalarInterp[1].z * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n float gradOpacityFactor = 1.0f;\n if (gradientMag >= 0.0){\n gradOpacityFactor = computeGradientOpacityFactor(gradientMag, goscale0, goshift0, gomin0, gomax0);\n }\n opacityG1.xyz *= gradOpacityFactor;\n opacityG2.xyz *= gradOpacityFactor;\n #endif\n\n vec4 opacityG = vec4(opacityG1 - opacityG2, 1.0f);\n // divide by spacing\n opacityG.xyz /= vSpacing;\n opacityG.w = length(opacityG.xyz);\n // rotate to View Coords\n rotateToViewCoord(opacityG.xyz);\n if (length(opacityG.xyz) > 0.0) {\n return vec4(normalize(opacityG.xyz),opacityG.w);\n } else {\n return vec4(0.0);\n }\n }\n\n vec4 computeNormalForDensity(vec3 pos, vec3 tstep, out vec3 scalarInterp[2])\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n\n scalarInterp[0].x = getTextureValue(texPosPVec[0]).a;\n scalarInterp[0].y = getTextureValue(texPosPVec[1]).a;\n scalarInterp[0].z = getTextureValue(texPosPVec[2]).a;\n scalarInterp[1].x = getTextureValue(texPosNVec[0]).a;\n scalarInterp[1].y = getTextureValue(texPosNVec[1]).a;\n scalarInterp[1].z = getTextureValue(texPosNVec[2]).a;\n\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, scalarInterp[0]);\n adjustClippedVoxelValues(pos, texPosNVec, scalarInterp[1]);\n #endif\n vec4 result;\n result.x = scalarInterp[0].x - scalarInterp[1].x;\n result.y = scalarInterp[0].y - scalarInterp[1].y;\n result.z = scalarInterp[0].z - scalarInterp[1].z;\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n if (length(result.xyz) > 0.0) {\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n #endif\n\n vec4 computeNormal(vec3 pos, vec3 tstep)\n {\n vec3 xvec = vec3(tstep.x, 0.0, 0.0);\n vec3 yvec = vec3(0.0, tstep.y, 0.0);\n vec3 zvec = vec3(0.0, 0.0, tstep.z);\n vec3 texPosPVec[3];\n texPosPVec[0] = pos + xvec;\n texPosPVec[1] = pos + yvec;\n texPosPVec[2] = pos + zvec;\n vec3 texPosNVec[3];\n texPosNVec[0] = pos - xvec;\n texPosNVec[1] = pos - yvec;\n texPosNVec[2] = pos - zvec;\n vec3 g1, g2;\n g1.x = getTextureValue(texPosPVec[0]).a;\n g1.y = getTextureValue(texPosPVec[1]).a;\n g1.z = getTextureValue(texPosPVec[2]).a;\n g2.x = getTextureValue(texPosNVec[0]).a;\n g2.y = getTextureValue(texPosNVec[1]).a;\n g2.z = getTextureValue(texPosNVec[2]).a;\n #ifdef vtkClippingPlanesOn\n adjustClippedVoxelValues(pos, texPosPVec, g1);\n adjustClippedVoxelValues(pos, texPosNVec, g2);\n #endif\n vec4 result;\n result = vec4(g1 - g2, -1.0);\n // divide by spacing\n result.xyz /= vSpacing;\n result.w = length(result.xyz);\n if (result.w > 0.0){\n // rotate to View Coords\n rotateToViewCoord(result.xyz);\n return vec4(normalize(result.xyz),result.w);\n } else {\n return vec4(0.0);\n }\n }\n#endif\n\n#ifdef vtkImageLabelOutlineOn\nvec3 fragCoordToIndexSpace(vec4 fragCoord) {\n vec4 pcPos = vec4(\n (fragCoord.x / vpWidth - vpOffsetX - 0.5) * 2.0,\n (fragCoord.y / vpHeight - vpOffsetY - 0.5) * 2.0,\n (fragCoord.z - 0.5) * 2.0,\n 1.0);\n\n vec4 worldCoord = PCWCMatrix * pcPos;\n vec4 vertex = (worldCoord/worldCoord.w);\n\n vec3 index = (vWCtoIDX * vertex).xyz;\n\n // half voxel fix for labelmapOutline\n return (index + vec3(0.5)) / vec3(volumeDimensions);\n}\n#endif\n\n//=======================================================================\n// compute the normals and gradient magnitudes for a position\n// for independent components\nmat4 computeMat4Normal(vec3 pos, vec4 tValue, vec3 tstep)\n{\n mat4 result;\n vec4 distX = getTextureValue(pos + vec3(tstep.x, 0.0, 0.0)) - tValue;\n vec4 distY = getTextureValue(pos + vec3(0.0, tstep.y, 0.0)) - tValue;\n vec4 distZ = getTextureValue(pos + vec3(0.0, 0.0, tstep.z)) - tValue;\n\n // divide by spacing\n distX /= vSpacing.x;\n distY /= vSpacing.y;\n distZ /= vSpacing.z;\n\n mat3 rot;\n rot[0] = vPlaneNormal0;\n rot[1] = vPlaneNormal2;\n rot[2] = vPlaneNormal4;\n\n#if !defined(vtkComponent0Proportional)\n result[0].xyz = vec3(distX.r, distY.r, distZ.r);\n result[0].a = length(result[0].xyz);\n result[0].xyz *= rot;\n if (result[0].w > 0.0)\n {\n result[0].xyz /= result[0].w;\n }\n#endif\n\n// optionally compute the 2nd component\n#if vtkNumComponents >= 2 && !defined(vtkComponent1Proportional)\n result[1].xyz = vec3(distX.g, distY.g, distZ.g);\n result[1].a = length(result[1].xyz);\n result[1].xyz *= rot;\n if (result[1].w > 0.0)\n {\n result[1].xyz /= result[1].w;\n }\n#endif\n\n// optionally compute the 3rd component\n#if vtkNumComponents >= 3 && !defined(vtkComponent2Proportional)\n result[2].xyz = vec3(distX.b, distY.b, distZ.b);\n result[2].a = length(result[2].xyz);\n result[2].xyz *= rot;\n if (result[2].w > 0.0)\n {\n result[2].xyz /= result[2].w;\n }\n#endif\n\n// optionally compute the 4th component\n#if vtkNumComponents >= 4 && !defined(vtkComponent3Proportional)\n result[3].xyz = vec3(distX.a, distY.a, distZ.a);\n result[3].a = length(result[3].xyz);\n result[3].xyz *= rot;\n if (result[3].w > 0.0)\n {\n result[3].xyz /= result[3].w;\n }\n#endif\n\n return result;\n}\n\n//=======================================================================\n// global shadow - secondary ray\n#if defined(VolumeShadowOn) || defined(localAmbientOcclusionOn)\nfloat random()\n{\n float rand = fract(sin(dot(gl_FragCoord.xy,vec2(12.9898,78.233)))*43758.5453123);\n float jitter=texture2D(jtexture,gl_FragCoord.xy/32.).r;\n uint pcg_state = floatBitsToUint(jitter);\n uint state = pcg_state;\n pcg_state = pcg_state * uint(747796405) + uint(2891336453);\n uint word = ((state >> ((state >> uint(28)) + uint(4))) ^ state) * uint(277803737);\n return (float((((word >> uint(22)) ^ word) >> 1 ))/float(2147483647) + rand)/2.0;\n}\n#endif\n\n#ifdef VolumeShadowOn\n// henyey greenstein phase function\nfloat phase_function(float cos_angle)\n{\n // divide by 2.0 instead of 4pi to increase intensity\n return ((1.0-anisotropy2)/pow(1.0+anisotropy2-2.0*anisotropy*cos_angle, 1.5))/2.0;\n}\n\n// Computes the intersection between a ray and a box\nstruct Hit\n{\n float tmin;\n float tmax;\n};\n\nstruct Ray\n{\n vec3 origin;\n vec3 dir;\n vec3 invDir;\n};\n\nbool BBoxIntersect(vec3 boundMin, vec3 boundMax, const Ray r, out Hit hit)\n{\n vec3 tbot = r.invDir * (boundMin - r.origin);\n vec3 ttop = r.invDir * (boundMax - r.origin);\n vec3 tmin = min(ttop, tbot);\n vec3 tmax = max(ttop, tbot);\n vec2 t = max(tmin.xx, tmin.yz);\n float t0 = max(t.x, t.y);\n t = min(tmax.xx, tmax.yz);\n float t1 = min(t.x, t.y);\n hit.tmin = t0;\n hit.tmax = t1;\n return t1 > max(t0,0.0);\n}\n\n// As BBoxIntersect requires the inverse of the ray coords,\n// this function is used to avoid numerical issues\nvoid safe_0_vector(inout Ray ray)\n{\n if(abs(ray.dir.x) < EPSILON) ray.dir.x = sign(ray.dir.x) * EPSILON;\n if(abs(ray.dir.y) < EPSILON) ray.dir.y = sign(ray.dir.y) * EPSILON;\n if(abs(ray.dir.z) < EPSILON) ray.dir.z = sign(ray.dir.z) * EPSILON;\n}\n\nfloat volume_shadow(vec3 posIS, vec3 lightDirNormIS)\n{\n float shadow = 1.0;\n float opacity = 0.0;\n\n // modify sample distance with a random number between 1.5 and 3.0\n float sampleDistanceISVS_jitter = sampleDistanceISVS * mix(1.5, 3.0, random());\n float opacityPrev = texture2D(otexture, vec2(getTextureValue(posIS).r * oscale0 + oshift0, 0.5)).r;\n\n // in case the first sample near surface has a very tiled light ray, we need to offset start position\n posIS += sampleDistanceISVS_jitter * lightDirNormIS;\n\n // compute the start and end points for the ray\n Ray ray;\n Hit hit;\n ray.origin = posIS;\n ray.dir = lightDirNormIS;\n safe_0_vector(ray);\n ray.invDir = 1.0/ray.dir;\n\n if(!BBoxIntersect(vec3(0.0),vec3(1.0), ray, hit))\n {\n return 1.0;\n }\n float maxdist = hit.tmax;\n\n // interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach\n float maxgi = mix(sampleDistanceISVS_jitter,SQRT3,giReach);\n maxdist = min(maxdist,maxgi);\n if(maxdist < EPSILON) {\n return 1.0;\n }\n\n // support gradient opacity\n #ifdef vtkGradientOpacityOn\n vec4 normal;\n #endif\n\n float current_dist = 0.0;\n float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);\n float clamped_step = 0.0;\n\n vec4 scalar = vec4(0.0);\n while(current_dist < maxdist)\n {\n#ifdef vtkClippingPlanesOn\n vec3 posVC = IStoVC(posIS);\n for (int i = 0; i < clip_numPlanes; ++i)\n {\n if (dot(vec3(vClipPlaneOrigins[i] - posVC), vClipPlaneNormals[i]) > 0.0)\n {\n current_dist = maxdist;\n }\n }\n#endif\n scalar = getTextureValue(posIS);\n opacity = texture2D(otexture, vec2(scalar.r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n normal = computeNormal(posIS, vec3(1.0/vec3(volumeDimensions)));\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n shadow *= 1.0 - opacity;\n\n // optimization: early termination\n if (shadow < EPSILON){\n return 0.0;\n }\n\n clamped_step = min(maxdist - current_dist, current_step);\n posIS += clamped_step * lightDirNormIS;\n current_dist += current_step;\n }\n\n return shadow;\n}\n\nvec3 applyShadowRay(vec3 tColor, vec3 posIS, vec3 viewDirectionVC)\n{\n vec3 vertLight = vec3(0.0);\n vec3 secondary_contrib = vec3(0.0);\n // here we assume only positional light, no effect of cones\n for (int i = 0; i < lightNum; i++)\n {\n #if(vtkLightComplexity==3)\n if (lightPositional[i] == 1){\n vertLight = lightPositionVC[i] - IStoVC(posIS);\n }else{\n vertLight = - lightDirectionVC[i];\n }\n #else\n vertLight = - lightDirectionVC[i];\n #endif\n // here we assume achromatic light, only intensity\n float dDotL = dot(viewDirectionVC, normalize(vertLight));\n // isotropic scatter returns 0.5 instead of 1/4pi to increase intensity\n float phase_attenuation = 0.5;\n if (abs(anisotropy) > EPSILON){\n phase_attenuation = phase_function(dDotL);\n }\n float vol_shadow = volume_shadow(posIS, normalize(rotateToIDX(vertLight)));\n secondary_contrib += tColor * vDiffuse * lightColor[i] * vol_shadow * phase_attenuation;\n secondary_contrib += tColor * vAmbient;\n }\n return secondary_contrib;\n}\n#endif\n\n//=======================================================================\n// local ambient occlusion\n#ifdef localAmbientOcclusionOn\nvec3 sample_direction_uniform(int i)\n{\n float rand = random() * 0.5;\n float theta = PI2 * (kernelSample[i][0] + rand);\n float phi = acos(2.0 * (kernelSample[i][1] + rand) -1.0) / 2.5;\n return normalize(vec3(cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)));\n}\n\n// return a matrix that transform startDir into z axis; startDir should be normalized\nmat3 zBaseRotationalMatrix(vec3 startDir){\n vec3 axis = cross(startDir, vec3(0.0,0.0,1.0));\n float cosA = startDir.z;\n float k = 1.0 / (1.0 + cosA);\n mat3 matrix = mat3((axis.x * axis.x * k) + cosA, (axis.y * axis.x * k) - axis.z, (axis.z * axis.x * k) + axis.y,\n (axis.x * axis.y * k) + axis.z, (axis.y * axis.y * k) + cosA, (axis.z * axis.y * k) - axis.x,\n (axis.x * axis.z * k) - axis.y, (axis.y * axis.z * k) + axis.x, (axis.z * axis.z * k) + cosA);\n return matrix;\n}\n\nfloat computeLAO(vec3 posIS, float op, vec3 lightDir, vec4 normal){\n // apply LAO only at selected locations, otherwise return full brightness\n if (normal.w > 0.0 && op > 0.05){\n float total_transmittance = 0.0;\n mat3 inverseRotateBasis = inverse(zBaseRotationalMatrix(normalize(-normal.xyz)));\n vec3 currPos, randomDirStep;\n float weight, transmittance, opacity;\n for (int i = 0; i < kernelSize; i++)\n {\n randomDirStep = inverseRotateBasis * sample_direction_uniform(i) * sampleDistanceIS;\n weight = 1.0 - dot(normalize(lightDir), normalize(randomDirStep));\n currPos = posIS;\n transmittance = 1.0;\n for (int j = 0; j < kernelRadius ; j++){\n currPos += randomDirStep;\n // check if it's at clipping plane, if so return full brightness\n if (all(greaterThan(currPos, vec3(EPSILON))) && all(lessThan(currPos,vec3(1.0-EPSILON)))){\n opacity = texture2D(otexture, vec2(getTextureValue(currPos).r * oscale0 + oshift0, 0.5)).r;\n #ifdef vtkGradientOpacityOn\n opacity *= computeGradientOpacityFactor(normal.w, goscale0, goshift0, gomin0, gomax0);\n #endif\n transmittance *= 1.0 - opacity;\n }\n else{\n break;\n }\n }\n total_transmittance += transmittance / float(kernelRadius) * weight;\n\n // early termination if fully translucent\n if (total_transmittance > 1.0 - EPSILON){\n return 1.0;\n }\n }\n // average transmittance and reduce variance\n return clamp(total_transmittance / float(kernelSize), 0.3, 1.0);\n } else {\n return 1.0;\n }\n}\n#endif\n\n//=======================================================================\n// surface light contribution\n#if vtkLightComplexity > 0\n void applyLighting(inout vec3 tColor, vec4 normal)\n {\n vec3 diffuse = vec3(0.0, 0.0, 0.0);\n vec3 specular = vec3(0.0, 0.0, 0.0);\n float df, sf = 0.0;\n for (int i = 0; i < lightNum; i++){\n df = abs(dot(normal.rgb, -lightDirectionVC[i]));\n diffuse += df * lightColor[i];\n sf = pow( abs(dot(lightHalfAngleVC[i],normal.rgb)), vSpecularPower);\n specular += sf * lightColor[i];\n }\n tColor.rgb = tColor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;\n }\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 applyLightingDirectional(vec3 posIS, vec4 tColor, vec4 normal)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float ndotL,vdotR;\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #else\n vec3 applyLightingPositional(vec3 posIS, vec4 tColor, vec4 normal, vec3 posVC)\n {\n // everything in VC\n vec3 diffuse = vec3(0.0);\n vec3 specular = vec3(0.0);\n #ifdef localAmbientOcclusionOn\n vec3 ambient = vec3(0.0);\n #endif\n vec3 vertLightDirection;\n for (int i = 0; i < lightNum; i++){\n float distance,attenuation,ndotL,vdotR;\n vec3 lightDir;\n if (lightPositional[i] == 1){\n lightDir = lightDirectionVC[i];\n vertLightDirection = posVC - lightPositionVC[i];\n distance = length(vertLightDirection);\n vertLightDirection = normalize(vertLightDirection);\n attenuation = 1.0 / (lightAttenuation[i].x\n + lightAttenuation[i].y * distance\n + lightAttenuation[i].z * distance * distance);\n // per OpenGL standard cone angle is 90 or less for a spot light\n if (lightConeAngle[i] <= 90.0){\n float coneDot = dot(vertLightDirection, lightDir);\n if (coneDot >= cos(radians(lightConeAngle[i]))){ // if inside cone\n attenuation = attenuation * pow(coneDot, lightExponent[i]);\n }\n else {\n attenuation = 0.0;\n }\n }\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * attenuation * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * attenuation * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n } else {\n vertLightDirection = lightDirectionVC[i];\n ndotL = dot(normal.xyz, vertLightDirection);\n if (ndotL < 0.0 && twoSidedLighting)\n {\n ndotL = -ndotL;\n }\n if (ndotL > 0.0)\n {\n diffuse += ndotL * lightColor[i];\n //specular\n vdotR = dot(-rayDirVC, normalize(2.0 * ndotL * -normal.xyz + vertLightDirection));\n if (vdotR > 0.0)\n {\n specular += pow(vdotR, vSpecularPower) * lightColor[i];\n }\n }\n #ifdef localAmbientOcclusionOn\n ambient += computeLAO(posIS, tColor.a, vertLightDirection, normal);\n #endif\n }\n }\n #ifdef localAmbientOcclusionOn\n return tColor.rgb * (diffuse * vDiffuse + vAmbient * ambient) + specular*vSpecular;\n #else\n return tColor.rgb * (diffuse * vDiffuse + vAmbient) + specular*vSpecular;\n #endif\n }\n #endif\n #endif\n#endif\n\n//=======================================================================\n// Given a texture value compute the color and opacity\n//\nvec4 getColorForValue(vec4 tValue, vec3 posIS, vec3 tstep)\n{\n#ifdef vtkImageLabelOutlineOn\n vec3 centerPosIS = fragCoordToIndexSpace(gl_FragCoord); // pos in texture space\n vec4 centerValue = getTextureValue(centerPosIS);\n bool pixelOnBorder = false;\n vec4 tColor = texture2D(ctexture, vec2(centerValue.r * cscale0 + cshift0, 0.5));\n\n // Get alpha of segment from opacity function.\n tColor.a = texture2D(otexture, vec2(centerValue.r * oscale0 + oshift0, 0.5)).r;\n\n int segmentIndex = int(centerValue.r * 255.0);\n \n // Use texture sampling for outlineThickness\n float textureCoordinate = float(segmentIndex - 1) / 1024.0;\n float textureValue = texture2D(ttexture, vec2(textureCoordinate, 0.5)).r;\n\n int actualThickness = int(textureValue * 255.0);\n\n if (actualThickness == 0) {\n return vec4(0, 0, 1, 1);\n }\n\n // Only perform outline check on fragments rendering voxels that aren't invisible.\n // Saves a bunch of needless checks on the background.\n // TODO define epsilon when building shader?\n if (float(tColor.a) > 0.01) {\n for (int i = -actualThickness; i <= actualThickness; i++) {\n for (int j = -actualThickness; j <= actualThickness; j++) {\n if (i == 0 || j == 0) {\n continue;\n }\n\n vec4 neighborPixelCoord = vec4(gl_FragCoord.x + float(i),\n gl_FragCoord.y + float(j),\n gl_FragCoord.z, gl_FragCoord.w);\n\n vec3 neighborPosIS = fragCoordToIndexSpace(neighborPixelCoord);\n vec4 value = getTextureValue(neighborPosIS);\n\n // If any of my neighbours are not the same value as I\n // am, this means I am on the border of the segment.\n // We can break the loops\n if (any(notEqual(value, centerValue))) {\n pixelOnBorder = true;\n break;\n }\n }\n\n if (pixelOnBorder == true) {\n break;\n }\n }\n\n // If I am on the border, I am displayed at full opacity\n if (pixelOnBorder == true) {\n tColor.a = outlineOpacity;\n }\n }\n\n#else\n // compute the normal and gradient magnitude if needed\n // We compute it as a vec4 if possible otherwise a mat4\n //\n vec4 goFactor = vec4(1.0,1.0,1.0,1.0);\n\n // compute the normal vectors as needed\n #if (vtkLightComplexity > 0) || defined(vtkGradientOpacityOn)\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n mat4 normalMat = computeMat4Normal(posIS, tValue, tstep);\n #if !defined(vtkComponent0Proportional)\n vec4 normal0 = normalMat[0];\n #endif\n #if !defined(vtkComponent1Proportional)\n vec4 normal1 = normalMat[1];\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n vec4 normal2 = normalMat[2];\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n vec4 normal3 = normalMat[3];\n #endif\n #endif\n #endif\n #else\n vec4 normalLight;\n #ifdef vtkComputeNormalFromOpacity\n vec3 scalarInterp[2];\n vec4 normal0 = computeNormalForDensity(posIS, tstep, scalarInterp);\n if (length(normal0)>0.0){\n #ifdef vtkGradientOpacityOn\n normalLight = computeDensityNormal(normal0.w, scalarInterp);\n #else\n normalLight = computeDensityNormal(scalarInterp);\n #endif\n if (length(normalLight) == 0.0){\n normalLight = normal0;\n }\n }\n #else\n vec4 normal0 = computeNormal(posIS, tstep);\n normalLight = normal0;\n #endif\n #endif\n #endif\n\n // compute gradient opacity factors as needed\n #if defined(vtkGradientOpacityOn)\n #if !defined(vtkComponent0Proportional)\n goFactor.x =\n computeGradientOpacityFactor(normal0.a, goscale0, goshift0, gomin0, gomax0);\n #endif\n #if defined(vtkIndependentComponentsOn) && (vtkNumComponents > 1)\n #if !defined(vtkComponent1Proportional)\n goFactor.y =\n computeGradientOpacityFactor(normal1.a, goscale1, goshift1, gomin1, gomax1);\n #endif\n #if vtkNumComponents > 2\n #if !defined(vtkComponent2Proportional)\n goFactor.z =\n computeGradientOpacityFactor(normal2.a, goscale2, goshift2, gomin2, gomax2);\n #endif\n #if vtkNumComponents > 3\n #if !defined(vtkComponent3Proportional)\n goFactor.w =\n computeGradientOpacityFactor(normal3.a, goscale3, goshift3, gomin3, gomax3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n // single component is always independent\n #if vtkNumComponents == 1\n vec4 tColor = texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, 0.5));\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n if (tColor.a < EPSILON){\n return vec4(0.0);\n }\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n vec4 tColor = mix0*texture2D(ctexture, vec2(tValue.r * cscale0 + cshift0, height0));\n #if !defined(vtkComponent0Proportional)\n tColor.a = goFactor.x*mix0*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, height0)).r;\n tColor *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix0));\n #endif\n\n vec3 tColor1 = mix1*texture2D(ctexture, vec2(tValue.g * cscale1 + cshift1, height1)).rgb;\n #if !defined(vtkComponent1Proportional)\n tColor.a += goFactor.y*mix1*texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.g * oscale1 + oshift1, height1)).r;\n tColor1 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix1));\n #endif\n\n #if vtkNumComponents >= 3\n vec3 tColor2 = mix2*texture2D(ctexture, vec2(tValue.b * cscale2 + cshift2, height2)).rgb;\n #if !defined(vtkComponent2Proportional)\n tColor.a += goFactor.z*mix2*texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.b * oscale2 + oshift2, height2)).r;\n tColor2 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix2));\n #endif\n\n #if vtkNumComponents >= 4\n vec3 tColor3 = mix3*texture2D(ctexture, vec2(tValue.a * cscale3 + cshift3, height3)).rgb;\n #if !defined(vtkComponent3Proportional)\n tColor.a += goFactor.w*mix3*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n #else\n float pwfValue = texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, height3)).r;\n tColor3 *= pwfValue;\n tColor.a *= mix(pwfValue, 1.0, (1.0 - mix3));\n #endif\n #endif\n #endif\n #else // then not independent\n\n #if vtkNumComponents == 2\n float lum = tValue.r * cscale0 + cshift0;\n float alpha = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale1 + oshift1, 0.5)).r;\n vec4 tColor = vec4(lum, lum, lum, alpha);\n #endif\n #if vtkNumComponents == 3\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale0 + oshift0, 0.5)).r;\n #endif\n #if vtkNumComponents == 4\n vec4 tColor;\n tColor.r = tValue.r * cscale0 + cshift0;\n tColor.g = tValue.g * cscale1 + cshift1;\n tColor.b = tValue.b * cscale2 + cshift2;\n tColor.a = goFactor.x*texture2D(otexture, vec2(tValue.a * oscale3 + oshift3, 0.5)).r;\n #endif\n #endif // dependent\n\n // apply lighting if requested as appropriate\n #if vtkLightComplexity > 0\n #if !defined(vtkComponent0Proportional)\n #if vtkNumComponents == 1\n #ifdef SurfaceShadowOn\n #if vtkLightComplexity < 3\n vec3 tColorS = applyLightingDirectional(posIS, tColor, normalLight);\n #else\n vec3 tColorS = applyLightingPositional(posIS, tColor, normalLight, IStoVC(posIS));\n #endif\n #endif\n\n #ifdef VolumeShadowOn\n vec3 tColorVS = applyShadowRay(tColor.rgb, posIS, rayDirVC);\n #ifdef SurfaceShadowOn\n float vol_coef = volumetricScatteringBlending * (1.0 - tColor.a / 2.0) * (1.0 - atan(normalLight.w) * INV4PI);\n tColor.rgb = (1.0-vol_coef) * tColorS + vol_coef * tColorVS;\n #else\n tColor.rgb = tColorVS;\n #endif\n #else\n tColor.rgb = tColorS;\n #endif\n\n #else\n applyLighting(tColor.rgb, normal0);\n #endif\n #endif\n\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n #if !defined(vtkComponent1Proportional)\n applyLighting(tColor1, normal1);\n #endif\n #if vtkNumComponents >= 3\n #if !defined(vtkComponent2Proportional)\n applyLighting(tColor2, normal2);\n #endif\n #if vtkNumComponents >= 4\n #if !defined(vtkComponent3Proportional)\n applyLighting(tColor3, normal3);\n #endif\n #endif\n #endif\n #endif\n #endif\n\n// perform final independent blend as needed\n#if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 2\n tColor.rgb += tColor1;\n#if vtkNumComponents >= 3\n tColor.rgb += tColor2;\n#if vtkNumComponents >= 4\n tColor.rgb += tColor3;\n#endif\n#endif\n#endif\n\n#endif\nreturn tColor;\n}\n\nbool valueWithinScalarRange(vec4 val, vec4 min, vec4 max) {\n bool withinRange = false;\n #if vtkNumComponents == 1\n if (val.r >= min.r && val.r <= max.r) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents == 2\n if (val.r >= min.r && val.r <= max.r &&\n val.g >= min.g && val.g <= max.g) {\n withinRange = true;\n }\n #endif\n #if defined(vtkIndependentComponentsOn) && vtkNumComponents >= 3\n if (all(greaterThanEqual(val, ipScalarRangeMin)) &&\n all(lessThanEqual(val, ipScalarRangeMax))) {\n withinRange = true;\n }\n #endif\n return withinRange;\n}\n\n//=======================================================================\n// Apply the specified blend mode operation along the ray's path.\n//\nvoid applyBlend(vec3 posIS, vec3 endIS, vec3 tdims)\n{\n vec3 tstep = 1.0/tdims;\n\n // start slightly inside and apply some jitter\n vec3 delta = endIS - posIS;\n vec3 stepIS = normalize(delta)*sampleDistanceIS;\n float raySteps = length(delta)/sampleDistanceIS;\n\n // avoid 0.0 jitter\n float jitter = 0.01 + 0.99*texture2D(jtexture, gl_FragCoord.xy/32.0).r;\n float stepsTraveled = jitter;\n\n // local vars for the loop\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 tValue;\n vec4 tColor;\n\n // if we have less than one step then pick the middle point\n // as our value\n // if (raySteps <= 1.0)\n // {\n // posIS = (posIS + endIS)*0.5;\n // }\n\n // Perform initial step at the volume boundary\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n #if vtkBlendMode == 0 // COMPOSITE_BLEND\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps);\n gl_FragData[0] = tColor;\n return;\n }\n\n tColor.a = 1.0 - pow(1.0 - tColor.a, jitter);\n color = vec4(tColor.rgb*tColor.a, tColor.a);\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n\n float mix = (1.0 - color.a);\n\n // this line should not be needed but nvidia seems to not handle\n // the break correctly on windows/chrome 58 angle\n //mix = mix * sign(max(raySteps - stepsTraveled - 1.0, 0.0));\n\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n stepsTraveled++;\n posIS += stepIS;\n if (color.a > 0.99) { color.a = 1.0; break; }\n }\n\n if (color.a < 0.99 && (raySteps - stepsTraveled) > 0.0)\n {\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // now map through opacity and color\n tColor = getColorForValue(tValue, posIS, tstep);\n tColor.a = 1.0 - pow(1.0 - tColor.a, raySteps - stepsTraveled);\n\n float mix = (1.0 - color.a);\n color = color + vec4(tColor.rgb*tColor.a, tColor.a)*mix;\n }\n\n gl_FragData[0] = vec4(color.rgb/color.a, color.a);\n #endif\n #if vtkBlendMode == 1 || vtkBlendMode == 2\n // MAXIMUM_INTENSITY_BLEND || MINIMUM_INTENSITY_BLEND\n // Find maximum/minimum intensity along the ray.\n\n // Define the operation we will use (min or max)\n #if vtkBlendMode == 1\n #define OP max\n #else\n #define OP min\n #endif\n\n // If the clipping range is shorter than the sample distance\n // we can skip the sampling loop along the ray.\n if (raySteps <= 1.0)\n {\n gl_FragData[0] = getColorForValue(tValue, posIS, tstep);\n return;\n }\n\n vec4 value = tValue;\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // Update the maximum value if necessary\n value = OP(tValue, value);\n\n // Otherwise, continue along the ray\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n tValue = getTextureValue(posIS);\n value = OP(tValue, value);\n\n // Now map through opacity and color\n gl_FragData[0] = getColorForValue(value, posIS, tstep);\n #endif\n #if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND\n vec4 sum = vec4(0.);\n\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n }\n\n if (raySteps <= 1.0) {\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n return;\n }\n\n posIS += (jitter*stepIS);\n\n // Sample along the ray until MaximumSamplesValue,\n // ending slightly inside the total distance\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n // If we have reached the last step, break\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the AverageIPScalarRange to disregard scalar values, not in the range of interest, from the average computation.\n // Notes:\n // - We are comparing all values in the texture to see if any of them\n // are outside of the scalar range. In the future we might want to allow\n // scalar ranges for each component.\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n // Sum the values across each step in the path\n sum += tValue;\n }\n stepsTraveled++;\n posIS += stepIS;\n }\n\n // Perform the last step along the ray using the\n // residual distance\n posIS = endIS;\n\n // compute the scalar\n tValue = getTextureValue(posIS);\n\n // One can control the scalar range by setting the IPScalarRange to disregard scalar values, not in the range of interest, from the average computation\n if (valueWithinScalarRange(tValue, ipScalarRangeMin, ipScalarRangeMax)) {\n sum += tValue;\n\n stepsTraveled++;\n }\n\n #if vtkBlendMode == 3 // Average\n sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);\n #endif\n\n gl_FragData[0] = getColorForValue(sum, posIS, tstep);\n #endif\n #if vtkBlendMode == 5 // RADON\n float normalizedRayIntensity = 1.0;\n\n // handle very thin volumes\n if (raySteps <= 1.0)\n {\n tValue = getTextureValue(posIS);\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity, 0.5));\n return;\n }\n\n posIS += (jitter*stepIS);\n\n for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)\n {\n if (stepsTraveled + 1.0 >= raySteps) { break; }\n\n // compute the scalar value\n tValue = getTextureValue(posIS);\n\n // Convert scalar value to normalizedRayIntensity coefficient and accumulate normalizedRayIntensity\n normalizedRayIntensity = normalizedRayIntensity - sampleDistance*texture2D(otexture, vec2(tValue.r * oscale0 + oshift0, 0.5)).r;\n\n posIS += stepIS;\n stepsTraveled++;\n }\n\n // map normalizedRayIntensity to color\n gl_FragData[0] = texture2D(ctexture, vec2(normalizedRayIntensity , 0.5));\n\n #endif\n}\n\n//=======================================================================\n// Compute a new start and end point for a given ray based\n// on the provided bounded clipping plane (aka a rectangle)\nvoid getRayPointIntersectionBounds(\n vec3 rayPos, vec3 rayDir,\n vec3 planeDir, float planeDist,\n inout vec2 tbounds, vec3 vPlaneX, vec3 vPlaneY,\n float vSize1, float vSize2)\n{\n float result = dot(rayDir, planeDir);\n if (abs(result) < 1e-6)\n {\n return;\n }\n result = -1.0 * (dot(rayPos, planeDir) + planeDist) / result;\n vec3 xposVC = rayPos + rayDir*result;\n vec3 vxpos = xposVC - vOriginVC;\n vec2 vpos = vec2(\n dot(vxpos, vPlaneX),\n dot(vxpos, vPlaneY));\n\n // on some apple nvidia systems this does not work\n // if (vpos.x < 0.0 || vpos.x > vSize1 ||\n // vpos.y < 0.0 || vpos.y > vSize2)\n // even just\n // if (vpos.x < 0.0 || vpos.y < 0.0)\n // fails\n // so instead we compute a value that represents in and out\n //and then compute the return using this value\n float xcheck = max(0.0, vpos.x * (vpos.x - vSize1)); // 0 means in bounds\n float check = sign(max(xcheck, vpos.y * (vpos.y - vSize2))); // 0 means in bounds, 1 = out\n\n tbounds = mix(\n vec2(min(tbounds.x, result), max(tbounds.y, result)), // in value\n tbounds, // out value\n check); // 0 in 1 out\n}\n\n//=======================================================================\n// given a\n// - ray direction (rayDir)\n// - starting point (vertexVCVSOutput)\n// - bounding planes of the volume\n// - optionally depth buffer values\n// - far clipping plane\n// compute the start/end distances of the ray we need to cast\nvec2 computeRayDistances(vec3 rayDir, vec3 tdims)\n{\n vec2 dists = vec2(100.0*camFar, -1.0);\n\n vec3 vSize = vSpacing*tdims;\n\n // all this is in View Coordinates\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal0, vPlaneDistance0, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal1, vPlaneDistance1, dists, vPlaneNormal2, vPlaneNormal4,\n vSize.y, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal2, vPlaneDistance2, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal3, vPlaneDistance3, dists, vPlaneNormal0, vPlaneNormal4,\n vSize.x, vSize.z);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal4, vPlaneDistance4, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n getRayPointIntersectionBounds(vertexVCVSOutput, rayDir,\n vPlaneNormal5, vPlaneDistance5, dists, vPlaneNormal0, vPlaneNormal2,\n vSize.x, vSize.y);\n\n //VTK::ClipPlane::Impl\n\n // do not go behind front clipping plane\n dists.x = max(0.0,dists.x);\n\n // do not go PAST far clipping plane\n float farDist = -camThick/rayDir.z;\n dists.y = min(farDist,dists.y);\n\n // Do not go past the zbuffer value if set\n // This is used for intermixing opaque geometry\n //VTK::ZBuffer::Impl\n\n return dists;\n}\n\n//=======================================================================\n// Compute the index space starting position (pos) and end\n// position\n//\nvoid computeIndexSpaceValues(out vec3 pos, out vec3 endPos, vec3 rayDir, vec2 dists)\n{\n // compute starting and ending values in volume space\n pos = vertexVCVSOutput + dists.x*rayDir;\n pos = pos - vOriginVC;\n // convert to volume basis and origin\n pos = vec3(\n dot(pos, vPlaneNormal0),\n dot(pos, vPlaneNormal2),\n dot(pos, vPlaneNormal4));\n\n endPos = vertexVCVSOutput + dists.y*rayDir;\n endPos = endPos - vOriginVC;\n endPos = vec3(\n dot(endPos, vPlaneNormal0),\n dot(endPos, vPlaneNormal2),\n dot(endPos, vPlaneNormal4));\n\n float delta = length(endPos - pos);\n\n pos *= vVCToIJK;\n endPos *= vVCToIJK;\n\n float delta2 = length(endPos - pos);\n sampleDistanceIS = sampleDistance*delta2/delta;\n #ifdef VolumeShadowOn\n sampleDistanceISVS = sampleDistanceIS * volumeShadowSamplingDistFactor;\n #endif\n}\n\nvoid main()\n{\n\n if (cameraParallel == 1)\n {\n // Camera is parallel, so the rayDir is just the direction of the camera.\n rayDirVC = vec3(0.0, 0.0, -1.0);\n } else {\n // camera is at 0,0,0 so rayDir for perspective is just the vc coord\n rayDirVC = normalize(vertexVCVSOutput);\n }\n\n vec3 tdims = vec3(volumeDimensions);\n\n // compute the start and end points for the ray\n vec2 rayStartEndDistancesVC = computeRayDistances(rayDirVC, tdims);\n\n // do we need to composite? aka does the ray have any length\n // If not, bail out early\n if (rayStartEndDistancesVC.y <= rayStartEndDistancesVC.x)\n {\n discard;\n }\n\n // IS = Index Space\n vec3 posIS;\n vec3 endIS;\n computeIndexSpaceValues(posIS, endIS, rayDirVC, rayStartEndDistancesVC);\n\n // Perform the blending operation along the ray\n applyBlend(posIS, endIS, tdims);\n}\n",e.Geometry=""},e.replaceShaderValues=(n,r,o)=>{let i=n.Fragment;o.getProperty().getInterpolationType()===el.LINEAR&&(i=Ca.substitute(i,"//VTK::TrilinearOn","#define vtkTrilinearOn").result),!0===o.getProperty().getUseLabelOutline()&&(i=Ca.substitute(i,"//VTK::ImageLabelOutlineOn","#define vtkImageLabelOutlineOn").result);const a=t.scalarTexture.getComponents();i=Ca.substitute(i,"//VTK::NumComponents",`#define vtkNumComponents ${a}`).result;const s=o.getProperty().getIndependentComponents();if(s){i=Ca.substitute(i,"//VTK::IndependentComponentsOn","#define vtkIndependentComponentsOn").result;const e=[];for(let t=0;t0&&(i=Ca.substitute(i,"//VTK::vtkProportionalComponents",e.join("\n")).result)}const l=t.currentInput.getSpatialExtent(),u=t.currentInput.getSpacing(),c=new Float64Array(3);jt(c,(l[1]-l[0])*u[0],(l[3]-l[2])*u[1],(l[5]-l[4])*u[2]);const d=Gt(c)/e.getCurrentSampleDistance(r);i=Ca.substitute(i,"//VTK::MaximumSamplesValue",`${Math.ceil(d)}`).result,i=Ca.substitute(i,"//VTK::LightComplexity",`#define vtkLightComplexity ${t.lastLightComplexity}`).result,t.lastLightComplexity>0&&(t.renderable.getVolumetricScatteringBlending()>0&&(i=Ca.substitute(i,"//VTK::VolumeShadowOn","#define VolumeShadowOn").result),t.renderable.getVolumetricScatteringBlending()<1&&(i=Ca.substitute(i,"//VTK::SurfaceShadowOn","#define SurfaceShadowOn").result),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0&&(i=Ca.substitute(i,"//VTK::localAmbientOcclusionOn","#define localAmbientOcclusionOn").result)),t.gopacity=o.getProperty().getUseGradientOpacity(0);for(let e=1;s&&!t.gopacity&&e{if(0===t.lastLightComplexity)return;let o=e.Fragment,i=0;n.getLights().forEach((e=>{e.getSwitch()&&(i+=1)})),o=Ca.substitute(o,"//VTK::Light::Dec",["uniform int lightNum;","uniform bool twoSidedLighting;",`uniform vec3 lightColor[${i}];`,`uniform vec3 lightDirectionVC[${i}]; // normalized`,`uniform vec3 lightHalfAngleVC[${i}];`,"//VTK::Light::Dec"],!1).result,3===t.lastLightComplexity&&(o=Ca.substitute(o,"//VTK::Light::Dec",[`uniform vec3 lightPositionVC[${i}];`,`uniform vec3 lightAttenuation[${i}];`,`uniform float lightConeAngle[${i}];`,`uniform float lightExponent[${i}];`,`uniform int lightPositional[${i}];`],!1).result),t.renderable.getVolumetricScatteringBlending()>0&&(o=Ca.substitute(o,"//VTK::VolumeShadow::Dec",["uniform float volumetricScatteringBlending;","uniform float giReach;","uniform float volumeShadowSamplingDistFactor;","uniform float anisotropy;","uniform float anisotropy2;"],!1).result),t.renderable.getLocalAmbientOcclusion()&&r.getProperty().getAmbient()>0&&(o=Ca.substitute(o,"//VTK::LAO::Dec",["uniform int kernelRadius;",`uniform vec2 kernelSample[${t.renderable.getLAOKernelRadius()}];`,"uniform int kernelSize;"],!1).result),e.Fragment=o},e.replaceShaderClippingPlane=(e,n,r)=>{let o=e.Fragment;if(t.renderable.getClippingPlanes().length>0){const e=t.renderable.getClippingPlanes().length;o=Ca.substitute(o,"//VTK::ClipPlane::Dec",["uniform vec3 vClipPlaneNormals[6];","uniform float vClipPlaneDistances[6];","uniform vec3 vClipPlaneOrigins[6];","uniform int clip_numPlanes;","//VTK::ClipPlane::Dec","#define vtkClippingPlanesOn"],!1).result,o=Ca.substitute(o,"//VTK::ClipPlane::Impl",[`for(int i = 0; i < ${e}; i++) {`," float rayDirRatio = dot(rayDir, vClipPlaneNormals[i]);"," float equationResult = dot(vertexVCVSOutput, vClipPlaneNormals[i]) + vClipPlaneDistances[i];"," if (rayDirRatio == 0.0)"," {"," if (equationResult < 0.0) dists.x = dists.y;"," continue;"," }"," float result = -1.0 * equationResult / rayDirRatio;"," if (rayDirRatio < 0.0) dists.y = min(dists.y, result);"," else dists.x = max(dists.x, result);","}","//VTK::ClipPlane::Impl"],!1).result}e.Fragment=o},e.getNeedToRebuildShaders=(n,r,o)=>{let i=0;o.getProperty().getShade()&&t.renderable.getBlendMode()===rl.COMPOSITE_BLEND&&(i=0,t.numberOfLights=0,r.getLights().forEach((e=>{e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)})));let a=!1;t.lastLightComplexity!==i&&(t.lastLightComplexity=i,a=!0);const s=t.scalarTexture.getComponents(),l=o.getProperty().getIndependentComponents();let u=!1;const c=[];if(l){for(let e=0;e0&&(u=!0)}const d=t.currentInput.getSpatialExtent(),p=t.currentInput.getSpacing(),f=new Float64Array(3);jt(f,(d[1]-d[0])*p[0],(d[3]-d[2])*p[1],(d[5]-d[4])*p[2]);const h=Gt(f)/e.getCurrentSampleDistance(r),m={interpolationType:o.getProperty().getInterpolationType(),useLabelOutline:o.getProperty().getUseLabelOutline(),numComp:s,usesProportionalComponents:u,iComps:l,maxSamples:h,useGradientOpacity:o.getProperty().getUseGradientOpacity(0),blendMode:t.renderable.getBlendMode(),proportionalComponents:c};return t.previousState&&t.previousState.interpolationType===m.interpolationType&&t.previousState.useLabelOutline===m.useLabelOutline&&t.previousState.numComp===m.numComp&&t.previousState.usesProportionalComponents===m.usesProportionalComponents&&t.previousState.iComps===m.iComps&&t.previousState.maxSamples===m.maxSamples&&t.previousState.useGradientOpacity===m.useGradientOpacity&&t.previousState.blendMode===m.blendMode&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,o)){const i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,o);const a=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==n.getProgram()&&(n.setProgram(a),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,o),e.setCameraShaderParameters(n,r,o),e.setPropertyShaderParameters(n,r,o),e.getClippingPlaneShaderParameters(n,r,o)},e.setMapperShaderParameters=(n,r,o)=>{const i=n.getProgram();n.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",e.getCurrentSampleDistance(r));const a=t.scalarTexture.getVolumeInfo(),s=t.renderable.getIpScalarRange(),l=[],u=[];for(let e=0;e<4;e++)l[e]=s[0]*a.dataComputedScale[e]+a.dataComputedOffset[e],u[e]=s[1]*a.dataComputedScale[e]+a.dataComputedOffset[e],l[e]=(l[e]-a.offset[e])/a.scale[e],u[e]=(u[e]-a.offset[e])/a.scale[e];if(i.setUniform4f("ipScalarRangeMin",l[0],l[1],l[2],l[3]),i.setUniform4f("ipScalarRangeMax",u[0],u[1],u[2],u[3]),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());const e=t._useSmallViewport?[t._smallViewportWidth,t._smallViewportHeight]:t._openGLRenderWindow.getFramebufferSize();i.setUniformf("vpZWidth",e[0]),i.setUniformf("vpZHeight",e[1])}},e.setCameraShaderParameters=(n,r,o)=>{const i=t.openGLCamera.getKeyMatrices(r),a=t.openGLVolume.getKeyMatrices();y(t.modelToView,i.wcvc,a.mcwc);const s=n.getProgram(),l=t.openGLCamera.getRenderable(),u=l.getClippingRange();s.setUniformf("camThick",u[1]-u[0]),s.setUniformf("camNear",u[0]),s.setUniformf("camFar",u[1]);const c=t.currentInput.getBounds(),d=t.currentInput.getDimensions(),p=new Float64Array(3),f=new Float64Array(3);let h=1,g=-1,v=1,b=-1;for(let e=0;e<8;++e)jt(p,c[e%2],c[2+Math.floor(e/2)%2],c[4+Math.floor(e/4)]),Yt(p,p,t.modelToView),l.getParallelProjection()||(Kt(f,p),Ht(p,f,-u[0]/p[2])),Yt(p,p,i.vcpc),h=Math.min(p[0],h),g=Math.max(p[0],g),v=Math.min(p[1],v),b=Math.max(p[1],b);s.setUniformf("dcxmin",h),s.setUniformf("dcxmax",g),s.setUniformf("dcymin",v),s.setUniformf("dcymax",b),s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",l.getParallelProjection());const x=t.currentInput.getSpatialExtent(),_=t.currentInput.getSpacing(),T=new Float64Array(3);jt(T,(x[1]-x[0])*_[0],(x[3]-x[2])*_[1],(x[5]-x[4])*_[2]),s.setUniform3f("vSpacing",_[0],_[1],_[2]),jt(p,x[0],x[2],x[4]),t.currentInput.indexToWorldVec3(p,p),Yt(p,p,t.modelToView),s.setUniform3f("vOriginVC",p[0],p[1],p[2]);const S=t.currentInput.getIndexToWorld();y(t.idxToView,t.modelToView,S),le(t.idxNormalMatrix,i.normalMatrix,a.normalMatrix),le(t.idxNormalMatrix,t.idxNormalMatrix,t.currentInput.getDirectionByReference());const w=Gt(T)/e.getCurrentSampleDistance(r);w>t.renderable.getMaximumSamplesPerRay()&&il(`The number of steps required ${Math.ceil(w)} is larger than the\n specified maximum number of steps ${t.renderable.getMaximumSamplesPerRay()}.\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples.`);const C=new Float64Array(3);if(jt(C,1,1,1),function(e,t,n){e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2]}(C,C,T),s.setUniform3f("vVCToIJK",C[0],C[1],C[2]),s.setUniform3i("volumeDimensions",d[0],d[1],d[2]),!t._openGLRenderWindow.getWebgl2()){const e=t.scalarTexture.getVolumeInfo();s.setUniformf("texWidth",t.scalarTexture.getWidth()),s.setUniformf("texHeight",t.scalarTexture.getHeight()),s.setUniformi("xreps",e.xreps),s.setUniformi("xstride",e.xstride),s.setUniformi("ystride",e.ystride)}const A=new Float64Array(3),E=new Float64Array(3);for(let e=0;e<6;++e){switch(e){case 1:jt(A,-1,0,0),jt(E,x[0],x[2],x[4]);break;case 2:jt(A,0,1,0),jt(E,x[1],x[3],x[5]);break;case 3:jt(A,0,-1,0),jt(E,x[0],x[2],x[4]);break;case 4:jt(A,0,0,1),jt(E,x[1],x[3],x[5]);break;case 5:jt(A,0,0,-1),jt(E,x[0],x[2],x[4]);break;default:jt(A,1,0,0),jt(E,x[1],x[3],x[5])}Jt(A,A,t.idxNormalMatrix),Yt(E,E,t.idxToView);const n=-1*qt(E,A);s.setUniform3f(`vPlaneNormal${e}`,A[0],A[1],A[2]),s.setUniformf(`vPlaneDistance${e}`,n)}if(o.getProperty().getUseLabelOutline()){const n=t.currentInput.getWorldToIndex();s.setUniformMatrix("vWCtoIDX",n);const o=r.getActiveCamera(),[i,a]=o.getClippingRange(),l=o.getDistance();o.setClippingRange(l,l+.1);const u=t.openGLCamera.getKeyMatrices(r);m(t.projectionToWorld,u.wcpc),o.setClippingRange(i,a),t.openGLCamera.getKeyMatrices(r),s.setUniformMatrix("PCWCMatrix",t.projectionToWorld);const c=e.getRenderTargetSize();s.setUniformf("vpWidth",c[0]),s.setUniformf("vpHeight",c[1]);const d=e.getRenderTargetOffset();s.setUniformf("vpOffsetX",d[0]/c[0]),s.setUniformf("vpOffsetY",d[1]/c[1])}if(m(t.projectionToView,i.vcpc),s.setUniformMatrix("PCVCMatrix",t.projectionToView),0===t.lastLightComplexity)return;let D=0;const I=[],P=[],O=[];if(r.getLights().forEach((e=>{if(e.getSwitch()>0){const t=e.getColor(),n=e.getIntensity();I[0+3*D]=t[0]*n,I[1+3*D]=t[1]*n,I[2+3*D]=t[2]*n;const r=e.getDirection();jt(A,r[0],r[1],r[2]),Jt(A,A,i.normalMatrix),Kt(A,A),P[0+3*D]=A[0],P[1+3*D]=A[1],P[2+3*D]=A[2],O[0+3*D]=-.5*A[0],O[1+3*D]=-.5*A[1],O[2+3*D]=-.5*(A[2]-1),D++}})),s.setUniformi("twoSidedLighting",r.getTwoSidedLighting()),s.setUniformi("lightNum",D),s.setUniform3fv("lightColor",I),s.setUniform3fv("lightDirectionVC",P),s.setUniform3fv("lightHalfAngleVC",O),3===t.lastLightComplexity){D=0;const e=[],n=[],o=[],i=[],a=[];r.getLights().forEach((r=>{if(r.getSwitch()>0){const s=r.getAttenuationValues();n[0+3*D]=s[0],n[1+3*D]=s[1],n[2+3*D]=s[2],i[D]=r.getExponent(),o[D]=r.getConeAngle(),a[D]=r.getPositional();const l=r.getTransformedPosition();Yt(l,l,t.modelToView),e[0+3*D]=l[0],e[1+3*D]=l[1],e[2+3*D]=l[2],D+=1}})),s.setUniform3fv("lightPositionVC",e),s.setUniform3fv("lightAttenuation",n),s.setUniformfv("lightConeAngle",o),s.setUniformfv("lightExponent",i),s.setUniformiv("lightPositional",a)}if(t.renderable.getVolumetricScatteringBlending()>0&&(s.setUniformf("giReach",t.renderable.getGlobalIlluminationReach()),s.setUniformf("volumetricScatteringBlending",t.renderable.getVolumetricScatteringBlending()),s.setUniformf("volumeShadowSamplingDistFactor",t.renderable.getVolumeShadowSamplingDistFactor()),s.setUniformf("anisotropy",t.renderable.getAnisotropy()),s.setUniformf("anisotropy2",t.renderable.getAnisotropy()**2)),t.renderable.getLocalAmbientOcclusion()&&o.getProperty().getAmbient()>0){const e=t.renderable.getLAOKernelSize();s.setUniformi("kernelSize",e);const n=[];for(let t=0;t{const o=e.getProgram();o.setUniformi("ctexture",t.colorTexture.getTextureUnit()),o.setUniformi("otexture",t.opacityTexture.getTextureUnit()),o.setUniformi("jtexture",t.jitterTexture.getTextureUnit()),o.setUniformi("ttexture",t.labelOutlineThicknessTexture.getTextureUnit());const i=t.scalarTexture.getVolumeInfo(),a=r.getProperty(),s=t.scalarTexture.getComponents(),l=r.getProperty().getIndependentComponents();if(l&&s>=2)for(let e=0;e0&&(o.setUniformf("vAmbient",a.getAmbient()),o.setUniformf("vDiffuse",a.getDiffuse()),o.setUniformf("vSpecular",a.getSpecular()),o.setUniformf("vSpecularPower",a.getSpecularPower()))},e.getClippingPlaneShaderParameters=(e,n,r)=>{if(t.renderable.getClippingPlanes().length>0){const r=t.openGLCamera.getKeyMatrices(n),o=[],i=[],a=[],s=t.renderable.getClippingPlanes(),l=s.length;for(let e=0;e{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.getRenderTargetSize=()=>{if(t._useSmallViewport)return[t._smallViewportWidth,t._smallViewportHeight];const{usize:e,vsize:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getRenderTargetOffset=()=>{const{lowerLeftU:e,lowerLeftV:n}=t._openGLRenderer.getTiledSizeAndOrigin();return[e,n]},e.getCurrentSampleDistance=e=>{const n=e.getVTKWindow().getInteractor(),r=t.renderable.getSampleDistance();return n.isAnimating()?r*t.renderable.getInteractionSampleDistanceFactor():r},e.renderPieceStart=(n,r)=>{const o=n.getVTKWindow().getInteractor();if(t._lastScale||(t._lastScale=t.renderable.getInitialInteractionScale()),t._useSmallViewport=!1,o.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._animationRateSubscription||(t._animationRateSubscription=o.onAnimationFrameRateUpdate((()=>{if(t.renderable.getAutoAdjustSampleDistances()){const e=o.getRecentAnimationFrameRate(),n=o.getDesiredUpdateRate()/e;(n>1.15||n<.85)&&(t._lastScale*=n),t._lastScale>400&&(t._lastScale=400),t._lastScale<1.5&&(t._lastScale=1.5)}else t._lastScale=t.renderable.getImageSampleDistance()*t.renderable.getImageSampleDistance()}))),t._useSmallViewport){const e=t._openGLRenderWindow.getFramebufferSize(),n=1/Math.sqrt(t._lastScale);if(t._smallViewportWidth=Math.ceil(n*e[0]),t._smallViewportHeight=Math.ceil(n*e[1]),t._smallViewportHeight>e[1]&&(t._smallViewportHeight=e[1]),t._smallViewportWidth>e[0]&&(t._smallViewportWidth=e[0]),t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer();else{const n=t.framebuffer.getSize();n[0]===e[0]&&n[1]===e[1]||(t.framebuffer.create(e[0],e[1]),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();const r=t.context;r.clearColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clear(r.COLOR_BUFFER_BIT),r.viewport(0,0,t._smallViewportWidth,t._smallViewportHeight),t.fvp=[t._smallViewportWidth/e[0],t._smallViewportHeight/e[1]]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===el.NEAREST?(t.scalarTexture.setMinificationFilter(Qa.NEAREST),t.scalarTexture.setMagnificationFilter(Qa.NEAREST)):(t.scalarTexture.setMinificationFilter(Qa.LINEAR),t.scalarTexture.setMagnificationFilter(Qa.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()},e.renderPieceDraw=(n,r)=>{const o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.labelOutlineThicknessTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),e.updateShaders(t.tris,n,r),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.labelOutlineThicknessTexture.deactivate(),t.jitterTexture.deactivate()},e.renderPieceFinish=(e,n)=>{if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t._useSmallViewport){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t._openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");const e=t.copyShader;t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(t._openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(e,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||al("Error setting vertexDC in copy shader VAO.")}else t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);const e=t._openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,e[0],e[1]);const n=t.framebuffer.getColorTexture();n.activate(),t.copyShader.setUniformi("texture",n.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);const r=t.context;r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),n.deactivate(),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=(n,r)=>{e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):al("No input!")},e.computeBounds=(n,r)=>{e.getInput()?t.bounds=e.getInput().getBounds():yr(t.Bounds)},e.updateBufferObjects=(t,n)=>{e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=(n,r)=>t.VBOBuildTime.getMTime(){const o=t.currentInput;if(!o)return;const i=o.getPointData()&&o.getPointData().getScalars();if(!i)return;t._scalars!==i&&(t._openGLRenderWindow.releaseGraphicsResourcesForObject(t._scalars),t._scalars=i);const a=r.getProperty();if(!t.jitterTexture.getHandle()){const e=new Uint8Array(1024);for(let t=0;t<1024;++t)e[t]=255*Math.random();t.jitterTexture.setMinificationFilter(Qa.LINEAR),t.jitterTexture.setMagnificationFilter(Qa.LINEAR),t.jitterTexture.create2DFromRaw(32,32,1,on.UNSIGNED_CHAR,e)}const s=i.getNumberOfComponents(),l=a.getIndependentComponents()?s:1,u=a.getScalarOpacity(),c=t._openGLRenderWindow.getGraphicsResourceForObject(u);let d=sl(a,u,l);if(c.vtkObj&&c.hash===d&&t.opacityTextureString===d)t.opacityTexture=c.vtkObj,t.opacityTextureString=c.hash;else{const r=1024,o=2*r*l,i=new Float32Array(o),s=new Float32Array(r);for(let t=0;t1?1:-1,e[3*t+2]=-1;const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const r=Wr.newInstance({numberOfComponents:3,values:e});r.setName("points");const o=Wr.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",ua.SURFACE,{points:r,cellOffset:0})}t.VBOBuildTime.modified()},e.updateLabelOutlineThicknessTexture=e=>{const n=e.getProperty().getLabelOutlineThickness(),r=t._openGLRenderWindow.getGraphicsResourceForObject(n),o=`${n.join("-")}`;if(r?.vtkObj&&r?.hash===o&&t.labelOutlineThicknessTextureString===o)t.labelOutlineThicknessTexture=r.vtkObj,t.labelOutlineThicknessTextureString=r.hash;else{const e=1024,r=1,i=new Uint8Array(e*r);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ul,n),Tt.extend(e,t,n),t.VBOBuildTime={},je(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),t.scalarTexture=hs.newInstance(),t.opacityTexture=hs.newInstance(),t.colorTexture=hs.newInstance(),t.jitterTexture=hs.newInstance(),t.jitterTexture.setWrapS(Ja.REPEAT),t.jitterTexture.setWrapT(Ja.REPEAT),t.labelOutlineThicknessTexture=hs.newInstance(),t.framebuffer=Zs.newInstance(),t.idxToView=f(new Float64Array(16)),t.idxNormalMatrix=ae(new Float64Array(9)),t.modelToView=f(new Float64Array(16)),t.projectionToView=f(new Float64Array(16)),t.projectionToWorld=f(new Float64Array(16)),$e(e,t,["context"]),ll(e,t)}),"vtkOpenGLVolumeMapper");Dt("vtkVolumeMapper",cl);const{vtkDebugMacro:dl}=vt;function pl(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent();const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=r.getZBufferTexture(),n=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=r.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():dl("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(n*o*4),i.viewport(0,0,n,o),i.readPixels(0,0,n,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,n)=>{e&&t.renderable.getUseZValues()&&n.requestDepth()}}const fl={};const hl=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fl,n),Tt.extend(e,t,n),pl(e,t)}),"vtkOpenGLPixelSpaceCallbackMapper");Dt("vtkPixelSpaceCallbackMapper",hl);const ml=Object.create(null);function gl(e,t){ml[e]=t}function vl(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}const yl={};function bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yl,n),t.overrides=ml,At.extend(e,t,n),vl(0,t)}var xl={newInstance:gt.newInstance(bl,"vtkWebGPUViewNodeFactory"),extend:bl};function _l(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,n,r,o)=>{if(f(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*n,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(r[1]-r[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=r[1]/(r[1]-r[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=r[0]*i,s=r[0]*i/n):(a=r[0]*i*n,s=r[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*r[0]/(u-l),e[5]=2*r[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=r[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const n=t.renderable.getClippingRangeByReference();let r=-n[0]/e;return r=(n[0]+n[1])/(n[1]-n[0])+2*n[0]*n[1]/(r*(n[1]-n[0])),.5*r+.5},e.getKeyMatrices=n=>{const r=n.getRenderable(),o=n.getParent();if(Math.max(o.getMTime(),e.getMTime(),r.getMTime(),t.renderable.getMTime(),n.getStabilizedTime())>t.keyMatrixTime.getMTime()){const r=t.renderable.getViewMatrix();c(t.keyMatrices.normalMatrix,r),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.wcvc,r);const o=n.getStabilizedCenterByReference();b(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=n.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),y(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),m(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}const Tl={keyMatrixTime:null,keyMatrices:null};const Sl=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tl,n),Tt.extend(e,t,n),t.keyMatrixTime={},gt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},gt.setGet(e,t,["keyMatrixTime"]),_l(e,t)}));function wl(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=n=>{if(t.bindables.length===n.length){let e=!0;for(let r=0;r{const n=[];for(let e=0;e{let r=e.getMTime();for(let e=0;er?n:r}if(r{const n=[],r=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cl,n),gt.obj(e,t),t.bindables=[],t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),gt.setGet(e,t,["label","device","arrayInformation"]),wl(e,t)}var El={newInstance:gt.newInstance(Al),extend:Al};function Dl(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,n)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:n.getCode()})}}const Il={device:null,handle:null};function Pl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Il,n),gt.obj(e,t),gt.get(e,t,["lastCameraMTime"]),gt.setGet(e,t,["device","handle"]),Dl(e,t)}var Ol={newInstance:gt.newInstance(Pl,"vtkWebGPUShaderModule"),extend:Pl};function Nl(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const n=e.getType(),r=e.getHash(),o=t._shaderModules.keys();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ml,n),t._shaderModules=new Map,gt.obj(e,t),gt.setGet(e,t,["device","window"]),Nl(e,t)}var Fl={newInstance:gt.newInstance(Rl,"vtkWebGPUShaderCache"),extend:Rl,substitute:function(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(n)?n.join("\n"):n;let i=!1;-1!==e.search(t)&&(i=!0);let a="";r&&(a="g");const s=new RegExp(t,a),l=e.replace(s,o);return{replace:i,result:l}}};function kl(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,n)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=n;const r=[];for(let e=0;e{for(let n=0;n{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let n=0;n{t.bindBuffers(e)}}const Ll={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ll,n),je(e,t),t.layouts=[],t.shaderDescriptions=[],He(e,t,["handle","pipelineDescription"]),$e(e,t,["device","renderEncoder","topology","vertexState"]),kl(e,t)}var Vl={newInstance:rt(Bl,"vtkWebGPUPipeline"),extend:Bl};function Ul(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(n),t.outputInterpolations.push(r)},e.addBuiltinOutput=(e,n)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(n)},e.addBuiltinInput=(e,n)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(n)},e.replaceShaderCode=(e,n)=>{const r=[];let o=[];if(n&&r.push(n.getShaderCode()),e||t.builtinInputNames.length){const n=[];if(n.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),r=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(n.push("};"),o=n,r[r.length-1]+=",",r.push(`input: ${t.type}Input`))}if(r.length&&(t.code=Fl.substitute(t.code,"//VTK::IOStructs::Input",r).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let n=0;n ${t.type}Output`]).result}t.code=Fl.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}const Gl={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gl,n),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],gt.obj(e,t),gt.setGet(e,t,["type","hash","code"]),gt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),Ul(e,t)}var jl={newInstance:gt.newInstance(zl,"vtkWebGPUShaderDescription"),extend:zl};const Wl={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Hl=function(e){return!e||e.length<6?0:e in Wl==1?Wl[e]:(Ce(`unknown format ${e}`),null)},Xl=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const n=1===t?e.length-1:e.length-3,r=Number(e[n]);return Number.isNaN(r)?(Ce(`unknown format ${e}`),0):t*(5-r/2)},Kl=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ce(`unknown format ${e}`);t="Uint"}const n=e.split("x")[0],r=Number(n[n.length-1]);if(!Number.isNaN(r))return t+=8*(5-r/2),t+="Array",t;Ce(`unknown format ${e}`)},ql=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ce(`unknown format ${e}`);t="u32"}let n=1;return"x"===e[e.length-2]&&(n=Number(e[e.length-1])),4===n?`vec4<${t}>`:3===n?`vec3<${t}>`:2===n?`vec2<${t}>`:t},$l=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Yl=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ce(`unknown format ${e}`)};function Jl(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:"vertex",o=n;Array.isArray(o)||(o=[o]);for(let n=0;ne.names[0]t.names[0]?1:0))},e.removeBufferIfPresent=e=>{for(let n=0;n{for(let n=0;n{for(let n=0;n{for(let n=0;n{let e="",n=0;for(let r=0;r0&&(e+=",\n"),e=`${e} @location(${n}) ${t.inputs[r].names[o]} : ${a}`,n++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const n=[];let r=0;for(let e=0;e{for(let n=0;n{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}const Zl={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function eu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zl,n),je(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],$e(e,t,["created","device","handle","indexBuffer"]),Ql(e,t)}var tu={newInstance:rt(eu,"vtkWebGPUVertexInput"),extend:eu};const nu="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",ru="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function ou(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(n,r,o)=>{const i=jl.newInstance({type:"vertex",hash:n,code:t.vertexShaderTemplate}),a=jl.newInstance({type:"fragment",hash:n,code:t.fragmentShaderTemplate}),s=r.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter(((e,t,n)=>n.indexOf(e)===t)),d=c.map((e=>`replaceShader${e.substring(7,e.length-2)}`));for(let e=0;e{const r=t.getShaderDescription("vertex");r.replaceShaderCode(null,n),t.getShaderDescription("fragment").replaceShaderCode(r)},e.replaceShaderRenderEncoder=(e,n,r)=>{t.renderEncoder.replaceShaderCode(n)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,n,r)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");a=s.getCode(),a=Fl.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,n,r)=>{const o=t.bindGroup.getShaderCode(n),i=n.getShaderDescription("vertex");let a=i.getCode();a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=n.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Fl.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,n)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=n=>{t.renderEncoder=n,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=n=>{n.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=n=>{e.prepareToDraw(n),n.setPipeline(t.pipeline),e.draw(n)},e.draw=e=>{const n=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),n.bindVertexInput(e,t.vertexInput);const r=t.vertexInput.getIndexBuffer();r?e.drawIndexed(r.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let n=0;n{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Vl.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}const iu={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function au(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,iu,n),Tt.extend(e,t,n),t.textureViews=[],t.vertexInput=tu.newInstance(),t.bindGroup=El.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||ru,t.vertexShaderTemplate=t.vertexShaderTemplate||nu,t.shaderReplacements=new Map,gt.get(e,t,["pipeline","vertexInput"]),gt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),ou(e,t)}var su={newInstance:gt.newInstance(au,"vtkWebGPUSimpleMapper"),extend:au};function lu(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position"),r.addOutput("vec4","vertexVC");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,r.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}const uu={};function cu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uu,n),su.extend(e,t,n),lu(e,t)}var du={newInstance:gt.newInstance(cu,"vtkWebGPUFullScreenQuad"),extend:cu},pu={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const fu=["getMappedRange","mapAsync","unmap"];function hu(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:n,label:t.label}),t.sizeInBytes=e,t.usage=n},e.write=e=>{!function(e,t,n,r){const o=r.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(r)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,n)=>{t.handle=t.device.getHandle().createBuffer({size:e.byteLength,usage:n,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=e.byteLength,t.usage=n,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mu,n),gt.obj(e,t),gt.get(e,t,["handle","sizeInBytes","usage"]),gt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),hu(e,t)}var vu={newInstance:gt.newInstance(gu),extend:gu,...pu};const{Representation:yu,Interpolation:bu}=ca;function xu(e){return()=>gt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}function _u(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(n,r,o)=>{Array.isArray(n)?t.color[0]===n[0]&&t.color[1]===n[1]&&t.color[2]===n[2]||(t.color[0]=n[0],t.color[1]=n[1],t.color[2]=n[2],e.modified()):t.color[0]===n&&t.color[1]===r&&t.color[2]===o||(t.color[0]=n,t.color[1]=r,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=xu("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.setSpecularPower=n=>{const r=1/Math.max(1,n);t.roughness===r&&t.specularPower===n||(t.specularPower=n,t.roughness=r,e.modified())},e.addShaderVariable=xu("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(bu.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(bu.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(bu.PHONG),e.getInterpolationAsString=()=>gt.enumToString(bu,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(yu.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(yu.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(yu.POINTS),e.getRepresentationAsString=()=>gt.enumToString(yu,t.representation)}const Tu={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:bu.GOURAUD,representation:yu.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function Su(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tu,n),gt.obj(e,t),gt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture"]),gt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),_u(e,t)}var wu={newInstance:gt.newInstance(Su,"vtkProperty"),extend:Su,...ca};const{Representation:Cu}=wu,{PrimitiveTypes:Au}=pu;class Eu{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(e){for(let t=0;t2)for(let i=0;i2){for(let i=0;i{const n=e.cells,r=e.primitiveType,o=e.representation,i=e.cellOffset,a=n.getData(),s=a.length,l=function(e){switch(e){case Au.Points:return"points";case Au.Lines:return"lines";case Au.Triangles:case Au.TriangleEdges:return"polys";case Au.TriangleStripEdges:case Au.TriangleStrips:return"strips";default:return""}}(r),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Eu};let d=null;d=o===Cu.POINTS||r===Au.Points?Fu.anythingToPoints:o===Cu.WIREFRAME||r===Au.Lines?Fu[`${l}ToWireframe`]:Fu[`${l}ToSurface`],Ou=Pu;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Lu,n),vu.extend(e,t,n),gt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),ku(e,t)}var Vu={newInstance:gt.newInstance(Bu),extend:Bu,...pu};const{BufferUsage:Uu}=pu,{vtkErrorMacro:Gu}=vt,{VtkDataTypes:zu}=Wr;function ju(e,t,n,r,o){const i={},a=e.getFlatSize();if(!a)return i;let s=[0,0,0,0];o.shift&&(o.shift.length?s=o.shift:s.fill(o.shift));let l=[1,1,1,1];o.scale&&(o.scale.length?l=o.scale:l.fill(o.scale));const u=!!Object.prototype.hasOwnProperty.call(o,"packExtra")&&o.packExtra;let c,d=0;const p=Pe(r,a*(n+(u?1:0)));let f=e.getFlatIdToPointId();o.cellData&&(f=e.getFlatIdToCellId()),1===n?c=function(e){p[d++]=l[0]*t[e]+s[0]}:2===n?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1]}:3!==n||u?3===n&&u?c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=1*l[3]+s[3]}:4===n&&(c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2],p[d++]=l[3]*t[e+3]+s[3]}):c=function(e){p[d++]=l[0]*t[e]+s[0],p[d++]=l[1]*t[e+1]+s[1],p[d++]=l[2]*t[e+2]+s[2]};for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getBufferForPointArray=(t,n)=>{const r=function(e){let t;switch(e.getDataType()){case zu.UNSIGNED_CHAR:t="uint8";break;case zu.FLOAT:t="float32";break;case zu.UNSIGNED_INT:t="uint32";break;case zu.INT:t="sint32";break;case zu.DOUBLE:t="float32";break;case zu.UNSIGNED_SHORT:t="uint16";break;case zu.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Gu(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${n.getMTime()}${r}`,usage:Uu.PointArray,format:r,dataArray:t,indexBuffer:n};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=vu.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}const Xu={device:null,fullScreenQuadBuffer:null};function Ku(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),je(e,t),$e(e,t,["device"]),Hu(e,t)}var qu={newInstance:rt(Ku),extend:Ku,...pu};const{BufferUsage:$u}=qu,{vtkErrorMacro:Yu}=gt;function Ju(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,n)=>{if(t._bufferEntryNames.has(e))return void Yu(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const r=$l(n);t.bufferEntries.push({name:e,type:n,sizeInBytes:r,offset:t.sizeInBytes,nativeType:Yl(n)}),t.sizeInBytes+=r},e.send=e=>{if(!t._buffer){const n={nativeArray:t.Float32Array,usage:$u.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(n,r,o)=>{const i=t._bufferEntryNames.get(n);if(void 0===i)return void Yu(`entry named ${n} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+r*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=r.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(n);if(void 0===o)return void Yu(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,n)=>{const r=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${n}) var ${t.label}: ${t.label}Struct;\n`),r.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}const Qu={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Zu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},gt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},gt.get(e,t,["bindGroupTime"]),gt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),Ju(e,t)}var ec={newInstance:gt.newInstance(Zu,"vtkWebGPUStorageBuffer"),extend:Zu};const{BufferUsage:tc}=qu,{vtkErrorMacro:nc}=gt;function rc(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,n)=>{t._bufferEntryNames.has(e)?nc(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:n,sizeInBytes:$l(n),offset:-1,nativeType:Yl(n),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const n=[];let r=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,n.push(o),e+=o.sizeInBytes)}for(let r=0;r{if(!t.UBO){const n={nativeArray:t.Float32Array,usage:tc.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(n),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=gt.newTypedArray(e,t.arrayBuffer))},e.setValue=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==r&&(a[i.offset/a.BYTES_PER_ELEMENT]=r,t.sendDirty=!0),i.lastValue=r},e.setArray=(n,r)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(n);if(void 0===o)return void nc(`entry named ${n} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(n,r)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}const oc={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ic(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oc,n),gt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},gt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,gt.get(e,t,["binding","bindGroupTime"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),rc(e,t)}var ac={newInstance:gt.newInstance(ic,"vtkWebGPUUniformBuffer"),extend:ic};const{vtkDebugMacro:sc}=vt,lc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",uc=new Float64Array(16),cc=new Float64Array(16);function dc(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=n=>{if(n){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),n=t.camera.getPositionByReference(),r=[],o=[];Ht(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),function(e,t,n){e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2]}(r,n,o),tn(o,r,t.stabilizedCenter),nn(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=r,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const n=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(sc("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const n=t.UBO.getSendTime();if(t._parent.getMTime()>n||e.getMTime()>n||t.camera.getMTime()>n||t.renderable.getMTime()>n){const n=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",n.wcvc),t.UBO.setArray("SCPCMatrix",n.scpc),t.UBO.setArray("PCSCMatrix",n.pcsc),t.UBO.setArray("SCVCMatrix",n.scvc),t.UBO.setArray("VCPCMatrix",n.vcpc),t.UBO.setArray("WCVCNormals",n.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const r=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[r.usize,r.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const n=t.renderable.getLights(),r=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e=90?0:2:1,s[l+1]=Math.cos(xn(n[t].getConeAngle())),s[l+2]=Math.cos(xn(n[t].getConeAngle()+n[t].getConeFalloff())),s[l+3]=0}t.SSBO.clearData(),t.SSBO.setNumberOfInstances(n.length),t.SSBO.addEntry("LightPos","vec4"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",a),t.SSBO.setAllInstancesFromArray("LightData",s);const l=t._parent.getDevice();t.SSBO.send(l)}var i;t.lightTimeString=o},e.scissorAndViewport=t=>{const n=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize,0,1),t.getHandle().setScissorRect(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=n=>{n?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const n=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const r=n.getTextureManager().getTextureForVTKTexture(t.backgroundTex);if(r.getReady()){const e=r.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(n,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=du.newInstance(),t.clearFSQ.setDevice(n),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(lc);const e=ac.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const r=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),h(cc,r.normalMatrix),re(uc,r.scvc,r.pcsc),re(uc,cc,uc),t.clearFSQ.getUBO().setArray("FSQMatrix",uc),t.clearFSQ.getUBO().sendIfNeeded(n),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=n=>{n?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const n=e.getTiledSizeAndOrigin(),r=t._parent.getSizeByReference();return n.lowerLeftV=r[1]-n.vsize-n.lowerLeftV,n},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=e[0]-n[0],o=e[1]-n[1],i=t._parent.normalizedDisplayToDisplay(r,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-n[0],u=e[3]-n[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let n=0;nt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}const pc={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const fc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pc,n),Tt.extend(e,t,n),t.UBO=ac.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=ec.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=El.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=f(new Float64Array(16)),t.stabilizedTime={},je(t.stabilizedTime,{mtime:0}),He(e,t,["bindGroup","stabilizedTime"]),Ye(e,t,["stabilizedCenter"]),$e(e,t,["renderEncoder","selector","suppressClear","UBO"]),dc(e,t)}),"vtkWebGPURenderer");function hc(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=n.addressModeU?n.addressModeU:"clamp-to-edge",t.options.addressModeV=n.addressModeV?n.addressModeV:"clamp-to-edge",t.options.addressModeW=n.addressModeW?n.addressModeW:"clamp-to-edge",t.options.magFilter=n.magFilter?n.magFilter:"nearest",t.options.minFilter=n.minFilter?n.minFilter:"nearest",t.options.mipmapFilter=n.mipmapFilter?n.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,n)=>`@binding(${e}) @group(${n}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}gl("vtkRenderer",fc);const mc={device:null,handle:null,label:null,options:null};function gc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),gt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","handle","options"]),gt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),hc(e,t)}var vc={newInstance:gt.newInstance(gc),extend:gc};const{SlicingMode:yc}=Is,bc="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4 = vec4(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n",xc=new Float64Array(16),_c=new Float64Array(16),Tc=new Float64Array(16),Sc=new Float64Array(4),wc=new Float64Array(4);function Cc(e,t){t.classHierarchy.push("vtkWebGPUImageMapper"),e.buildPass=n=>{if(n){t.WebGPUImageSlice=e.getFirstAncestorOfType("vtkWebGPUImageSlice"),t.WebGPURenderer=t.WebGPUImageSlice.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice();const n=t.WebGPURenderer.getRenderable();t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(n.getActiveCamera())}},e.translucentPass=t=>{t&&e.render()},e.opaquePass=t=>{t&&e.render()},e.render=()=>{t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw)},e.computePipelineHash=()=>{const e=t.currentInput.getExtent();e[0]===e[1]||e[2]===e[3]||e[4]===e[5]?(t.dimensions=2,t.pipelineHash="img2"):(t.dimensions=3,t.pipelineHash="img3")},e.updateUBO=()=>{const n=t.UBO.getSendTime(),r=t.WebGPUImageSlice.getRenderable(),o=r.getMapper();if(e.getMTime()>n||t.renderable.getMTime()>n||r.getProperty().getMTime()>n){const e=o.getInputData(),n=t.WebGPURenderer.getStabilizedCenterByReference();f(xc),b(xc,xc,n);const i=r.getMatrix();h(_c,i),m(_c,_c),y(xc,_c,xc);const a=e.getWorldToIndex();y(xc,a,xc),m(Tc,xc),C(_c,[.5,.5,.5]),y(xc,_c,xc);const s=e.getDimensions();f(_c),x(_c,_c,[1/s[0],1/s[1],1/s[2]]),y(xc,_c,xc),t.UBO.setArray("SCTCMatrix",xc);const l=t.currentInput.getExtent(),{ijkMode:u}=t.renderable.getClosestIJKAxis();let c=t.renderable.getSlice();u!==t.renderable.getSlicingMode()&&(c=t.renderable.getSliceAtPosition(c));let d=2,p=0,g=1;u===yc.I?(d=0,p=1,g=2):u===yc.J&&(d=1,p=2,g=0),Sc[d]=c,Sc[p]=l[2*p]-.5,Sc[g]=l[2*g]-.5,Sc[3]=1,Mo(Sc,Sc,Tc),t.UBO.setArray("Origin",Sc),wc[d]=c,wc[p]=l[2*p+1]+.5,wc[g]=l[2*g]-.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis1",wc),wc[d]=c,wc[p]=l[2*p]-.5,wc[g]=l[2*g+1]+.5,wc[3]=1,Mo(wc,wc,Tc),No(wc,wc,Sc),wc[3]=1,t.UBO.setArray("Axis2",wc);const v=[1,1,1,1],_=[0,0,0,0],T=t.textureViews[0],S=T.getTexture().getScale(),w=T.getTexture().getNumberOfComponents();for(let e=0;e{const n=t.WebGPUImageSlice.getRenderable().getProperty();e.getTextureViews()[0].getTexture().getNumberOfComponents();const r=function(e,t,n){if(t.apply(e)){const t=e.getIndependentComponents();return`${e.getMTime()}-${t}-1`}return"0"}(n,n.getRGBTransferFunction);if(t.colorTextureString!==r){t.numRows=1;const e=new Uint8Array(2*t.numRows*t.rowLength*4);let o=n.getRGBTransferFunction();if(o){const r=new Float32Array(3*t.rowLength);for(let i=0;i<1;i++){o=n.getRGBTransferFunction(i);const a=o.getRange();o.getTable(a[0],a[1],t.rowLength,r,1);for(let n=0;n{n();const r=t.device.getTextureManager().getTextureForImageData(t.currentInput),o=t.textureViews;if(!o[0]||o[0].getTexture()!==r){const e=r.createView("imgTexture");o[0]=e}e.updateLUTImage(),e.updateUBO();const i=t.WebGPUImageSlice.getRenderable().getProperty().getInterpolationType()===Ts?"nearest":"linear";t.clampSampler&&i===t.clampSampler.getOptions().minFilter||(t.clampSampler=vc.newInstance({label:"clampSampler"}),t.clampSampler.create(t.device,{minFilter:i,magFilter:i}),t.additionalBindables=[t.clampSampler])};const r=e.getShaderReplacements();e.replaceShaderPosition=(e,n,r)=>{const o=n.getShaderDescription("vertex");o.addBuiltinOutput("vec4","@builtin(position) Position");let i=o.getCode();const a=["var pos: vec4 = mapperUBO.Origin +"," (vertexBC.x * 0.5 + 0.5) * mapperUBO.Axis1 + (vertexBC.y * 0.5 + 0.5) * mapperUBO.Axis2;","pos.w = 1.0;"];2===t.dimensions?a.push("var tcoord : vec2 = (mapperUBO.SCTCMatrix * pos).xy;"):a.push("var tcoord : vec3 = (mapperUBO.SCTCMatrix * pos).xyz;"),a.push("output.tcoordVS = tcoord;","output.Position = rendererUBO.SCPCMatrix * pos;"),i=Fl.substitute(i,"//VTK::Position::Impl",a).result,o.setCode(i)},r.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,n,r)=>{const o=n.getShaderDescription("vertex");2===t.dimensions?o.addOutput("vec2","tcoordVS"):o.addOutput("vec3","tcoordVS")},r.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderImage=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();t.dimensions,i=Fl.substitute(i,"//VTK::Image::Sample",[" var computedColor: vec4 ="," textureSampleLevel(imgTexture, clampSampler, input.tcoordVS, 0.0);","//VTK::Image::Sample"]).result,i=Fl.substitute(i,"//VTK::Image::Sample",[" var coord: vec2 ="," vec2(computedColor.r * mapperUBO.cScale.r + mapperUBO.cShift.r, 0.5);"," computedColor = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);"]).result,o.setCode(i)},r.set("replaceShaderImage",e.replaceShaderImage)}const Ac={rowLength:1024};const Ec=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ac,n),du.extend(e,t,n),e.setFragmentShaderTemplate(bc),t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SCTCMatrix","mat4x4"),t.UBO.addEntry("Origin","vec4"),t.UBO.addEntry("Axis2","vec4"),t.UBO.addEntry("Axis1","vec4"),t.UBO.addEntry("cScale","vec4"),t.UBO.addEntry("cShift","vec4"),t.lutBuildTime={},je(t.lutBuildTime,{mtime:0}),t.imagemat=f(new Float64Array(16)),t.imagematinv=f(new Float64Array(16)),t.VBOBuildTime={},je(t.VBOBuildTime),Cc(e,t)}),"vtkWebGPUImageMapper");function Dc(e,t){t.classHierarchy.push("vtkWebGPUImageSlice"),e.buildPass=n=>{if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=n=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.traverseTranslucentPass=n=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(n,!0),t.children.forEach((e=>{e.traverse(n)})),e.apply(n,!1))},e.queryPass=(e,n)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.getBufferShift=n=>(e.getKeyMatrices(n),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();t.bufferShift[0]=n[3]-r[0],t.bufferShift[1]=n[7]-r[1],t.bufferShift[2]=n[11]-r[2],h(t.keyMatrices.bcwc,n),t.renderable.getIsIdentity()?f(t.keyMatrices.normalMatrix):(c(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),h(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),b(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageMapper",Ec);const Ic={bufferShift:void 0,keyMatrixTime:null,keyMatrices:null,propID:void 0};const Pc=rt((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ic,n),Tt.extend(e,t,n),t.keyMatricesTime={},je(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},t.keyMatrixTime={},je(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:f(new Float64Array(16))},t.bufferShift=[0,0,0,0],He(e,t,["propID","keyMatricesTime"]),Dc(e,t)}),"vtkWebGPUImageSlice");function Oc(e,t){t.classHierarchy.push("vtkWebGPUVolume"),e.buildPass=n=>{t.renderable&&t.renderable.getVisibility()&&n&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),t.renderable.getMapper().update())},e.queryPass=(n,r)=>{if(n){if(!t.renderable||!t.renderable.getVisibility())return;const n=t.renderable.getMapper().getBounds();if(!n||6!==n.length||n[0]>n[1])return;r.addVolume(e)}};const n=new Float64Array(3),r=new Float64Array(3);e.getBoundingCubePoints=(e,o)=>{const i=t.renderable.getMapper().getInputData();if(!i)return;const a=i.getExtent(),s=t.renderable.getMatrix();let l=0;for(let t=4;t<6;t++){n[2]=a[t];for(let t=2;t<4;t++){n[1]=a[t];for(let t=0;t<2;t++){n[0]=a[t],i.indexToWorld(n,r);let u=o+3*l;e[u++]=s[0]*r[0]+s[1]*r[1]+s[2]*r[2]+s[3],e[u++]=s[4]*r[0]+s[5]*r[1]+s[6]*r[2]+s[7],e[u++]=s[8]*r[0]+s[9]*r[1]+s[10]*r[2]+s[11],l++}}}},e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const n=t.renderable.getMatrix(),r=e.getStabilizedCenterByReference();h(t.keyMatrices.bcwc,n),b(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]),t.keyMatricesTime.modified()}return t.keyMatrices}}gl("vtkImageSlice",Pc);const Nc={propID:void 0,keyMatricesTime:null};const Mc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nc,n),Tt.extend(e,t,n),t.keyMatricesTime={},gt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={bcwc:new Float64Array(16),bcsc:new Float64Array(16)},gt.get(e,t,["propID","keyMatricesTime"]),Oc(e,t)}),"vtkWebGPUVolume");function Rc(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(n,r)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}gl("vtkVolume",Mc);const Fc={};const kc=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),Tt.extend(e,t,n),Rc(e,t)}),"vtkWebGPUPixelSpaceCallbackMapper");gl("vtkPixelSpaceCallbackMapper",kc);var Lc=Uint8Array,Bc=Uint16Array,Vc=Uint32Array,Uc=new Lc([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,0,0,0]),Gc=new Lc([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,0,0]),zc=new Lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(e,t){for(var n=new Bc(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&Yc)<<1;Jc=(61680&(Jc=(52428&Jc)>>>2|(13107&Jc)<<2))>>>4|(3855&Jc)<<4,$c[Yc]=((65280&Jc)>>>8|(255&Jc)<<8)>>>1}var Qc=function(e,t,n){for(var r=e.length,o=0,i=new Bc(t);o>>l]=u}else for(a=new Bc(r),o=0;o>>15-e[o]);return a},Zc=new Lc(288);for(Yc=0;Yc<144;++Yc)Zc[Yc]=8;for(Yc=144;Yc<256;++Yc)Zc[Yc]=9;for(Yc=256;Yc<280;++Yc)Zc[Yc]=7;for(Yc=280;Yc<288;++Yc)Zc[Yc]=8;var ed=new Lc(32);for(Yc=0;Yc<32;++Yc)ed[Yc]=5;var td=Qc(Zc,9,1),nd=Qc(ed,5,1),rd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},od=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},id=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ad=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(2==e.BYTES_PER_ELEMENT?Bc:4==e.BYTES_PER_ELEMENT?Vc:Lc)(n-t);return r.set(e.subarray(t,n)),r},sd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ld=function(e,t,n){var r=new Error(t||sd[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ld),!n)throw r;return r},ud=function(e,t,n){var r=e.length;if(!r||n&&n.f&&!n.l)return t||new Lc(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new Lc(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new Lc(Math.max(2*n,e));r.set(t),t=r}},l=n.f||0,u=n.p||0,c=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){l=od(e,u,1);var g=od(e,u+1,3);if(u+=3,!g){var v=e[(a=u,(D=4+((a+7)/8|0))-4)]|e[D-3]<<8,y=D+v;if(y>r){i&&ld(0);break}o&&s(c+v),t.set(e.subarray(D,y),c),n.b=c+=v,n.p=u=8*y,n.f=l;continue}if(1==g)d=td,p=nd,f=9,h=5;else if(2==g){var b=od(e,u,31)+257,x=od(e,u+10,15)+4,_=b+od(e,u+5,31)+1;u+=14;for(var T=new Lc(_),S=new Lc(19),w=0;w>>4)<16)T[w++]=D;else{var P=0,O=0;for(16==D?(O=3+od(e,u,3),u+=2,P=T[w-1]):17==D?(O=3+od(e,u,7),u+=3):18==D&&(O=11+od(e,u,127),u+=7);O--;)T[w++]=P}}var N=T.subarray(0,b),M=T.subarray(b);f=rd(N),h=rd(M),d=Qc(N,f,1),p=Qc(M,h,1)}else ld(1);if(u>m){i&&ld(0);break}}o&&s(c+131072);for(var R=(1<>>4;if((u+=15&P)>m){i&&ld(0);break}if(P||ld(2),L<256)t[c++]=L;else{if(256==L){k=u,d=null;break}var B=L-254;if(L>264){var V=Uc[w=L-257];B=od(e,u,(1<>>4;if(U||ld(3),u+=15&U,M=qc[G],G>3&&(V=Gc[G],M+=id(e,u)&(1<m){i&&ld(0);break}o&&s(c+131072);for(var z=c+B;c>>0},fd=function(e,t){return pd(e,t)+4294967296*pd(e,t+4)};function hd(e,t){return ud(e,t)}function md(e,t){return ud(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||ld(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)}(e),-8),t||new Lc((r=(n=e).length,(n[r-4]|n[r-3]<<8|n[r-2]<<16|n[r-1]<<24)>>>0)));var n,r}function gd(e,t){return ud(((8!=(15&(n=e)[0])||n[0]>>>4>7||(n[0]<<8|n[1])%31)&&ld(6,"invalid zlib data"),32&n[1]&&ld(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var n}function vd(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?md(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?hd(e,t):gd(e,t)}var yd="undefined"!=typeof TextEncoder&&new TextEncoder,bd="undefined"!=typeof TextDecoder&&new TextDecoder;try{bd.decode(cd,{stream:!0})}catch(e){}function xd(e,t){if(t){for(var n="",r=0;r127)+(r>223)+(r>239);if(n+o>e.length)return[t,ad(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];return o[1].length&&ld(8),i}var _d=function(e,t){return t+30+dd(e,t+26)+dd(e,t+28)},Td=function(e,t,n){var r=dd(e,t+28),o=xd(e.subarray(t+46,t+46+r),!(2048&dd(e,t+8))),i=t+46+r,a=pd(e,t+20),s=n&&4294967295==a?Sd(e,i):[a,pd(e,t+24),pd(e,t+42)],l=s[0],u=s[1],c=s[2];return[dd(e,t+10),l,u,o,i+dd(e,t+30)+dd(e,t+32),c]},Sd=function(e,t){for(;1!=dd(e,t);t+=4+dd(e,t+2));return[fd(e,t+12),fd(e,t+4),fd(e,t+20)]};function wd(e,t){for(var n={},r=e.length-22;101010256!=pd(e,r);--r)(!r||e.length-r>65558)&&ld(13);var o=dd(e,r+8);if(!o)return{};var i=pd(e,r+16),a=4294967295==i;a&&(r=pd(e,r-12),101075792!=pd(e,r)&&ld(13),o=pd(e,r+32),i=pd(e,r+48));for(var s=t&&t.filter,l=0;l>16&255,r[c++]=u>>8&255,r[c++]=255&u}switch(a){case 3:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<10;!Ed(e[l]);)l++;for(u|=Cd[e.charCodeAt(l++)]<<4;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>2,r[c++]=u>>8&255,r[c++]=255&u;break;case 2:for(;!Ed(e[l]);)l++;for(u=Cd[e.charCodeAt(l++)]<<2;!Ed(e[l]);)l++;u|=Cd[e.charCodeAt(l++)]>>4,r[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}function Id(e,t,n){const r=(e<<16)+(t<<8)+n;return Ad[r>>18]+Ad[r>>12&63]+Ad[r>>6&63]+Ad[63&r]}function Pd(e){const t=new Uint8Array(e),n=e.byteLength%3,r=e.byteLength-n,o=Array(r/3);for(let e=0;e0){const e=Id(t[r],t[r+1]||0,t[r+2]||0);1===n?o.push(`${e.substr(0,2)}==`):2===n&&o.push(`${e.substr(0,3)}=`)}return o.join("")}var Od=function(e){const t=function(e){const t=e.length,n=[];let r=null;for(let o=0;o0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Fd[e](t)};const{vtkErrorMacro:Vd,vtkDebugMacro:Ud}=gt;let Gd=0;function zd(e){const t=document.querySelector(`.webResource[data-url="${e}"]`);return t?t.innerHTML:null}function jd(e){return"/"===e[0]?e.substr(1):e}const Wd={fetchJSON:function(e,t){return new Promise(((e,n)=>{const r=zd(jd(t));null===r?n(new Error(`No such JSON ${t}`)):e(JSON.parse(r))}))},fetchText:function(e,t){return new Promise(((e,n)=>{const r=zd(t);null===r?n(new Error(`No such text ${t}`)):e(r)}))},fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((o,i)=>{const a=jd([t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/")),s=zd(a);if(null===s)i(new Error(`No such array ${a}`));else{if("string"===n.dataType){let e=atob(s);r.compression&&(e=xd(vd(e))),n.values=JSON.parse(e)}else{const e=new Uint8Array(Od(s));n.buffer=new ArrayBuffer(e.length),new Uint8Array(n.buffer).set(e),r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Ud(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Vd(`Error in FetchArray: ${n.name} does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`)}delete n.ref,0==--Gd&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)}}))},fetchImage:function(e,t){return new Promise(((e,n)=>{const r=function(e){return document.querySelector(`.webResource[data-url="${e}"]`)}(t);r?e(r):n(new Error(`No such image ${t}`))}))}};Ld("html",(e=>Wd));const{vtkErrorMacro:Hd,vtkDebugMacro:Xd}=gt;function Kd(e){return function(e){return"/"===e[0]?e.substr(1):e}(function(e){return new URL(e,"http://any").pathname}(e))}const qd=function(e){let t=!1,n=0,r=null,o="";var i;return(i=e.zipContent,new Promise(((e,t)=>{"string"==typeof i?e(function(e,t){if(t){for(var n=new Lc(e.length),r=0;r>1)),a=0,s=function(e){i[a++]=e};for(r=0;ri.length){var l=new Lc(a+8+(o-r<<1));l.set(i),i=l}var u=e.charCodeAt(r);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|63&u)):u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|63&u)):(s(224|u>>12),s(128|u>>6&63),s(128|63&u))}return ad(i,0,a)}(i)):i instanceof Blob?e(i.arrayBuffer().then((e=>new Uint8Array(e)))):i instanceof ArrayBuffer?e(new Uint8Array(i)):i?.buffer instanceof ArrayBuffer?e(new Uint8Array(i.buffer)):t(new Error("Invalid datatype to unpack."))}))).then((n=>{r=wd(n),t=!0;const i=[];Object.keys(r).forEach((e=>{e.endsWith("index.json")&&i.push(e)})),i.sort(((e,t)=>e.length-t.length)),o=i[0].replace(/index\.json$/,""),e.callback&&e.callback(r)})),{fetchArray(e,i,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((l,u)=>{t||Hd("ERROR!!! zip not ready...");const c=Kd([i,a.ref.basepath,s.compression?`${a.ref.id}.gz`:a.ref.id].join("/"));function d(){delete a.ref,0==--n&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),l(a)}1==++n&&e?.invokeBusy&&e.invokeBusy(!0);const p=r[`${o}${c}`];if("string"!==a.dataType||s.compression){const e=function(e,t,n){return r=>{e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=xd(vd(new Uint8Array(e.buffer))):e.buffer=vd(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(Md!==e.ref.encode&&Md&&(Xd(`Swap bytes of ${e.name}`),Rd(e.buffer,rn[e.dataType])),e.values=gt.newTypedArray(e.dataType,e.buffer)),e.values.length!==e.size&&Hd(`Error in FetchArray: ${e.name} does not have the proper array size. Got ${e.values.length}, instead of ${e.size}`),n()}}(a,s.compression,d);e(p)}else{const e=function(e,t,n){return r=>{e.values=t?JSON.parse(xd(vd(r))):JSON.parse(r),n()}}(a,s.compression,d);e(xd(p))}}))},fetchJSON(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];if(i.compression){if("gz"===i.compression){const e=xd(vd(s));return Promise.resolve(JSON.parse(e))}return Promise.reject(new Error("Invalid compression"))}return Promise.resolve(JSON.parse(xd(s)))},fetchText(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(xd(wd(s))):Promise.reject(new Error("Invalid compression")):Promise.resolve(xd(s))},fetchImage(e,n){const i=Kd(n);t||Hd("ERROR!!! zip not ready...");const a=r[`${o}${i}`];return new Promise(((e,t)=>{const n=new Image;n.onload=()=>e(n),n.onerror=t;const r=Pd(a.buffer);n.src=`data:image/${function(e){const t=e.split(".").pop().toLowerCase();return"jpg"===t?"jpeg":t}(i)};base64,${r}`}))},fetchBinary(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=Kd(n);t||Hd("ERROR!!! zip not ready...");const s=r[`${o}${a}`];return i.compression?"gz"===i.compression?Promise.resolve(vd(s).buffer):Promise.reject(new Error("Invalid compression")):Promise.resolve(s.buffer)}}};Ld("zip",(e=>qd(e)));const $d={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Yd={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:$d},Jd={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Qd,VectorMode:Zd}=Yd,{VtkDataTypes:ep}=Wr,{ColorMode:tp}=Jd,{vtkErrorMacro:np}=gt;function rp(e){return e}function op(e){return Math.floor(255*e+.5)}function ip(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(Zd.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(Zd.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(Zd.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r))if(n&&r&&n.length!==r.length)np("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n){const e=r.length;for(let o=0;o{let o=e.checkForAnnotatedValue(n),i=!1;return o>=0?t.annotationArray[o].annotation!==r&&(t.annotationArray[o].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=n=>t.annotationArray.length?e.checkForAnnotatedValue(n):-1,e.removeAnnotation=n=>{const r=e.checkForAnnotatedValue(n),o=r>=0;return o&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(n,r)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(n);e.getIndexedColor(t,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let n=0;n{const o=t.getNumberOfComponents();let i=null;if(n===tp.DEFAULT&&t.getDataType()===ep.UNSIGNED_CHAR||n===tp.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const n={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:ep.UNSIGNED_CHAR},a=gt.newTypedArray(n.dataType,4*t.getNumberOfTuples());n.values=a,n.size=a.length,i=Wr.newInstance(n);let s=r;s<0&&o>1?e.mapVectorsThroughTable(t,i,Qd.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Qd.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,n)=>{const r=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===Zd.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==Zd.MAGNITUDE||1!==u&&1!==s||(a=Zd.COMPONENT));let c=0;switch(l>0&&(c=l),a){case Zd.COMPONENT:e.mapScalarsThroughTable(t,n,r,c);break;case Zd.RGBCOLORS:break;case Zd.MAGNITUDE:default:{const o=Wr.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,n,r,0);break}}},e.luminanceToRGBA=(e,t,n,r)=>{const o=r(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=op(n),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===r&&i>=1&&n.getDataType()===ep.UNSIGNED_CHAR)return n;const a=Wr.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:ep.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=rp;switch(n.getDataType()!==ep.FLOAT&&n.getDataType()!==ep.DOUBLE||(s=op),r){case 1:e.luminanceToRGBA(a,n,i,s);break;case 2:e.luminanceAlphaToRGBA(a,n,s);break;case 3:e.rGBToRGBA(a,n,i,s);break;case 4:e.rGBAToRGBA(a,n,i,s);break;default:return np("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,n)=>e.setMappingRange(t,n),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(n,r,o)=>{if(!n)return e.isOpaque();const i=n.getNumberOfComponents();return(r!==tp.DEFAULT||n.getDataType()!==ep.UNSIGNED_CHAR)&&r!==tp.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===n.getRange(i-1)[0])}}const ap={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:Zd.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ap,n),gt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],gt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),gt.setArray(e,t,["mappingRange"],2),gt.getArray(e,t,["mappingRange"]),ip(e,t)}var lp={newInstance:gt.newInstance(sp,"vtkScalarsToColors"),extend:sp,...Yd},up={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}};const{ColorSpace:cp,Scale:dp}=up,{ScalarMappingTarget:pp}=lp,{vtkDebugMacro:fp,vtkErrorMacro:hp,vtkWarningMacro:mp}=gt;function gp(e,t){const n=e[0],r=e[1],o=e[2],i=Math.sqrt(n*n+r*r+o*o),a=i>.001?Math.acos(n/i):0,s=a>.001?Math.atan2(o,r):0;t[0]=i,t[1]=a,t[2]=s}function vp(e,t){if(e[0]>=t-.1)return e[2];const n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function yp(e,t,n,r){const o=[],i=[];gr(t,o),gr(n,i);const a=[],s=[];gp(o,a),gp(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=vp(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=vp(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const n=e[0],r=e[1],o=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(o),t[2]=n*Math.sin(r)*Math.sin(o)}(u,c),vr(c,r)}function bp(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,n,r,o)=>e.addRGBPointLong(t,n,r,o,.5,0),e.addRGBPointLong=function(n,r,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return hp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return hp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const l={x:n,r:r,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,n,r,o,.5,0),e.addHSVPointLong=function(t,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[],l=[n,r,o];return dr(l,s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=n=>{if(t.nodes!==n){const r=JSON.stringify(t.nodes);t.nodes=n;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||r!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const n=JSON.stringify(t.nodes);t.nodes.sort(((e,t)=>e.x-t.x));const r=JSON.stringify(t.nodes),o=e.updateRange();return o||n===r?o:(e.modified(),!0)},e.updateRange=()=>{const n=[2];n[0]=t.mappingRange[0],n[1]=t.mappingRange[1];const r=t.nodes.length;return r?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[r-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(n[0]!==t.mappingRange[0]||n[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=n=>{let r=0;for(;r=t.nodes.length)return-1;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(n,r)=>{if(n!==r){e.removePoint(r);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(n,r,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(n,r,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,n,r,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];dr([n,r,o],c),dr(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=(n,r)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(n);if(o<0||0===t){const t=e.getNanColorByReference();r[0]=t[0],r[1]=t[1],r[2]=t[2]}else{const n=[];e.getNodeValue(o%t,n),r[0]=n[1],r[1]=n[2],r[2]=n[3]}}else e.getTable(n,n,1,r)},e.getRedValue=t=>{const n=[];return e.getColor(t,n),n[0]},e.getGreenValue=t=>{const n=[];return e.getColor(t,n),n[1]},e.getBlueValue=t=>{const n=[];return e.getColor(t,n),n[2]},e.getTable=(n,r,o,i)=>{const a=Number(n),s=Number(r);if(Er(a)||Er(s)){for(let e=0;e0);let T=0,S=0,w=0;_&&(T=Math.log10(a),S=Math.log10(s));for(let n=0;n1?_?(w=T+n/(o-1)*(S-T),f=10**w):f=a+n/(o-1)*(s-a):_?(w=.5*(T+S),f=10**w):f=.5*(a+s),t.discretize){const e=t.mappingRange;if(f>=e[0]&&f<=e[1]){const n=t.numberOfValues,r=e[1]-e[0];if(n<=1)f=e[0]+r/2;else{const t=(f-e[0])/r,o=Sn(n*t);f=e[0]+o/(n-1)*r}}}for(;lt.nodes[l].x;)l++,l.99999&&(y=.99999));if(f>t.mappingRange[1])i[r]=0,i[r+1]=0,i[r+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[r]=t.aboveRangeColor[0],i[r+1]=t.aboveRangeColor[1],i[r+2]=t.aboveRangeColor[2]):(i[r]=c,i[r+1]=d,i[r+2]=p));else if(f0&&(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b));else if(0===l&&(Math.abs(f-a)<1e-6||t.discretize))u>0?(i[r]=t.nodes[0].r,i[r+1]=t.nodes[0].g,i[r+2]=t.nodes[0].b):(i[r]=0,i[r+1]=0,i[r+2]=0);else{let e=0;if(e=_?(w-h)/(m-h):(f-h)/(m-h),e=e.99){if(e<.5){i[r]=g[0],i[r+1]=g[1],i[r+2]=g[2];continue}i[r]=v[0],i[r+1]=v[1],i[r+2]=v[2];continue}if(b<.01){if(t.colorSpace===cp.RGB)i[r]=(1-e)*g[0]+e*v[0],i[r+1]=(1-e)*g[1]+e*v[1],i[r+2]=(1-e)*g[2]+e*v[2];else if(t.colorSpace===cp.HSV){const n=[],o=[];cr(g,n),cr(v,o),t.hSVWrap&&(n[0]-o[0]>.5||o[0]-n[0]>.5)&&(n[0]>o[0]?n[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*n[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*n[1]+e*o[1],a[2]=(1-e)*n[2]+e*o[2],dr(a,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const t=[],n=[];gr(g,t),gr(v,n);const o=[];o[0]=(1-e)*t[0]+e*n[0],o[1]=(1-e)*t[1]+e*n[1],o[2]=(1-e)*t[2]+e*n[2],vr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*b):e>.5&&(e=1-.5*(2*(1-e))**(1+10*b));const n=e*e,o=n*e,a=2*o-3*n+1,s=-2*o+3*n,l=o-2*n+e,u=o-n;let c,d;if(t.colorSpace===cp.RGB)for(let e=0;e<3;e++)c=v[e]-g[e],d=(1-b)*c,i[r+e]=a*g[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===cp.HSV){const e=[],n=[];cr(g,e),cr(v,n),t.hSVWrap&&(e[0]-n[0]>.5||n[0]-e[0]>.5)&&(e[0]>n[0]?e[0]-=1:n[0]-=1);const o=[];for(let t=0;t<3;t++)c=n[t]-e[t],d=(1-b)*c,o[t]=a*e[t]+s*n[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);dr(o,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else if(t.colorSpace===cp.LAB){const e=[],t=[];gr(g,e),gr(v,t);const n=[];for(let r=0;r<3;r++)c=t[r]-e[r],d=(1-b)*c,n[r]=a*e[r]+s*t[r]+l*d+u*d;vr(n,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]}else t.colorSpace===cp.DIVERGING?(yp(e,g,v,x),i[r]=x[0],i[r+1]=x[1],i[r+2]=x[2]):hp("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[r+e]=i[r+e]<0?0:i[r+e],i[r+e]=i[r+e]>1?1:i[r+e]}}},e.getUint8Table=function(n,r,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return hp("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(n,r,o,s);for(let e=0;e{e.removeAllPoints();const r=n.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(r-n)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(hp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1),e.setNodeValue=(n,r)=>{if(n<0||n>=t.nodes.length)return hp("Index out of range!"),-1;const o=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],o!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216,e.getIndexedColor=(t,n)=>{const r=e.getSize();if(r>0&&t>=0){const o=[];e.getNodeValue(t%r,o);for(let e=0;e<3;++e)n[e]=o[e+1];return void(n[3]=1)}const o=e.getNanColorByReference();n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=1},e.fillFromDataPointer=(t,n)=>{if(!(t<=0)&&n){e.removeAllPoints();for(let r=0;r{const o=[n,r],i=e.getRange();if(i[1]===o[1]&&i[0]===o[0])return;if(o[1]===o[0])return void hp("attempt to set zero width color range");const a=(o[1]-o[0])/(i[1]-i[0]),s=o[0]-i[0]*a;for(let e=0;e{const r=e.getRange(),o=[];r[0]n[1]?(e.getColor(n[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])):(e.getColor(r[1],o),e.addRGBPoint(n[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let n=0;n{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(n,r,o,i):e.mapData(n,r,o,i):fp("Transfer Function Has No Points!")},e.mapData=(t,n,r,o)=>{if(0===e.getSize())return void mp("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=n.getData(),u=t.getData(),c=[];if(r===pp.RGBA)for(let t=0;t{const r=JSON.stringify(t.colorSpace);n.ColorSpace&&(t.colorSpace=cp[n.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(hp(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),t.colorSpace=cp.RGB));let o=r!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(n.NanColor)for(t.nanColor=[].concat(n.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(n.RGBPoints){const e=n.RGBPoints.length;t.nodes=[];const r=.5,o=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xp,n),lp.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},gt.obj(t.buildTime),gt.get(e,t,["buildTime","mappingRange"]),gt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace","discretize","numberOfValues"]),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),bp(e,t)}var Tp={newInstance:gt.newInstance(_p,"vtkColorTransferFunction"),extend:_p,...up};const{vtkDebugMacro:Sp}=gt;function wp(e,t){t.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=f(new Float64Array(16)),a=f(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),d=f(new Float64Array(16)),p=f(new Float64Array(16)),g=new Float64Array(3),v=new Float64Array(3);function T(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=(n,r,o)=>{n===t.position[0]&&r===t.position[1]&&o===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(n,r,o)=>{n===t.focalPoint[0]&&r===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=n=>{if(t.distance===n)return;t.distance=n,t.distance<1e-20&&(t.distance=1e-20,Sp("Distance is set to minimum."));const r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],n=t.focalPoint[1]-t.position[1],r=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+n*n+r*r),t.distance<1e-20){t.distance=1e-20,Sp("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=n/t.distance,t.directionOfProjection[2]=r/t.distance,T()},e.dolly=n=>{if(n<=0)return;const r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])},e.roll=n=>{const r=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);f(d);const s=new Float64Array([o[0]-r[0],o[1]-r[1],o[2]-r[2]]);_(d,d,xn(n),s),Mo(a,a,d),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=n=>{const r=t.focalPoint;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.yaw=n=>{const r=t.position;f(p),b(p,p,r),_(p,p,xn(n),t.viewUp),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(v[0],v[1],v[2])},e.elevation=n=>{const r=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(g,t.position,p),e.setPosition(g[0],g[1],g[2])},e.pitch=n=>{const r=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];f(p),b(p,p,r),_(p,p,xn(n),i),b(p,p,[-r[0],-r[1],-r[2]]),Yt(v,t.focalPoint,p),e.setFocalPoint(...v)},e.zoom=n=>{n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.translate=(n,r,o)=>{const i=[n,r,o];Nn(t.position,i,t.position),Nn(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=n=>{const r=[...t.viewUp,1],o=[],i=[],a=[];r[0]+=t.position[0],r[1]+=t.position[1],r[2]+=t.position[2],Mo(o,[...t.position,1],n),Mo(i,[...t.focalPoint,1],n),Mo(a,r,n),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+r)},e.setThicknessFromFocalPoint=n=>{let r=n;r<1e-20&&(r=1e-20,Sp("Thickness is set to minimum.")),e.setClippingRange(t.distance-r/2,t.distance+r/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=e=>{},e.getCameraLightTransformMatrix=e=>(c(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{c(i,e.getViewMatrix()),m(i,i),A(a,[t.distance,t.distance,t.distance]),y(i,i,a),f(t.cameraLightTransform),b(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=Bo(e[0],e[1],e[2],e[3]),n=Ro(),r=Bo(0,0,1,0);return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(n,t),ko(r,t,r),ko(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),m(t,t)},e.getWorldToPhysicalMatrix=e=>{f(e);const n=[3];Bn(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],h(e,e),jt(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),x(e,e,s),b(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{m(i,a),Yt(s,n,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Yt(l,r,i),Wt(l,l,s),Kt(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Yt(u,o,i),Wt(u,u,s),Kt(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),y(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=n=>{t.viewMatrix=n,t.viewMatrix&&(c(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),h(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.viewMatrix;K(i,t.position,t.focalPoint,t.viewUp),h(i,i);const e=new Float64Array(16);return c(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,n,r)=>{const o=new Float64Array(16);if(f(o),t.projectionMatrix){const e=1/t.physicalScale;return jt(s,e,e,e),c(o,t.projectionMatrix),x(o,o,s),h(o,o),o}f(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(n+1)*a/2,t.clippingRange[0]+(r+1)*a/2];if(t.parallelProjection){const n=t.parallelScale*e,r=t.parallelScale,o=(t.windowCenter[0]-1)*n,a=(t.windowCenter[0]+1)*n,s=(t.windowCenter[1]-1)*r,u=(t.windowCenter[1]+1)*r;H(i,o,a,s,u,l[0],l[1]),h(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const n=Math.tan(xn(t.viewAngle)/2);let r,o;!0===t.useHorizontalViewAngle?(r=t.clippingRange[0]*n,o=t.clippingRange[0]*n/e):(r=t.clippingRange[0]*n*e,o=t.clippingRange[0]*n);const a=(t.windowCenter[0]-1)*r,s=(t.windowCenter[0]+1)*r,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return c(o,i),o},e.getCompositeProjectionMatrix=(t,n,r)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r);return y(i,o,i),i},e.setDirectionOfProjection=(e,n,r)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===n&&t.directionOfProjection[2]===r)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=n,t.directionOfProjection[2]=r;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,T()},e.setDeviceAngles=(n,r,o,i)=>{const a=[3];Bn(t.physicalViewNorth,t.physicalViewUp,a);const s=f(new Float64Array(16));_(s,s,xn(n),t.physicalViewUp),_(s,s,xn(r),a),_(s,s,xn(o),t.physicalViewNorth),_(s,s,xn(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Yt(l,l,s),Yt(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,n,r,o)=>{const i=f(new Float64Array(16));if(0!==t&&(0!==n||0!==r||0!==o)){const e=xn(t),a=Ro();Fo(a,[n,r,o],e),B(i,a)}const a=new Float64Array(3);Yt(a,[0,0,-1],i);const s=new Float64Array(3);Yt(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let n=null,r=null;n=t.viewPlaneNormal,r=t.position;const o=-n[0],i=-n[1],a=-n[2],s=-(o*r[0]+i*r[1]+a*r[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let n=0;n<2;n++)for(let r=0;r<2;r++){const u=o*e[r]+i*e[2+n]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}const Cp={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,cameraLightTransform:l(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Ap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cp,n),gt.obj(e,t),gt.get(e,t,["distance"]),gt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),gt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),gt.setGetArray(e,t,["clippingRange","windowCenter"],2),gt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),wp(e,t)}var Ep={newInstance:gt.newInstance(Ap,"vtkCamera"),extend:Ap};function Dp(e,t){t.classHierarchy.push("vtkLight");const n=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Yt(n,t.position,t.transformMatrix):jt(n,t.position[0],t.position[1],t.position[2]),n),e.getTransformedFocalPoint=()=>(t.transformMatrix?Yt(n,t.focalPoint,t.transformMatrix):jt(n,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),n),e.getDirection=()=>(t.directionMTime{const n=new Float64Array(3);tn(n,t.position,e),t.focalPoint=n},e.setDirectionAngle=(t,n)=>{const r=xn(t),o=xn(n);e.setPosition(Math.cos(r)*Math.sin(o),Math.sin(r),Math.cos(r)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}const Ip={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Pp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,n),gt.obj(e,t),gt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),gt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),Dp(e,t)}var Op={newInstance:gt.newInstance(Pp,"vtkLight"),extend:Pp,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Np}=gt;function Mp(e,t){function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const r=e.getNestedProps();if(r&&r.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=n=>{n&&!e.hasViewProp(n)&&t.props.push(n)},e.removeViewProp=e=>{const n=t.props.filter((t=>t!==e));t.props.length!==n.length&&(t.props=n)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{const e=[];for(let r=0;r{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach((e=>{t.actors2D=t.actors2D.concat(e.getActors2D())})),t.actors2D),e.displayToView=()=>Np("call displayToView on your view instead"),e.viewToDisplay=()=>Np("callviewtodisplay on your view instead"),e.getSize=()=>Np("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,n,r)=>{const o=e.normalizedDisplayToNormalizedViewport(t,n,r);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(n-t.viewport[1])/o[1],r]},e.normalizedViewportToProjection=(e,t,n)=>[2*e-1,2*t-1,2*n-1],e.projectionToNormalizedDisplay=(t,n,r)=>{const o=e.projectionToNormalizedViewport(t,n,r);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,n,r)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],n*o[1]+t.viewport[1],r]},e.projectionToNormalizedViewport=(e,t,n)=>[.5*(e+1),.5*(t+1),.5*(n+1)],e.PickPropFrom=("PickPropFrom",()=>Np("vtkViewport::PickPropFrom - NOT IMPLEMENTED"))}const Rp={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Fp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),gt.obj(e,t),gt.event(e,t,"event"),gt.setGetArray(e,t,["viewport"],4),gt.setGetArray(e,t,["background","background2"],3),Mp(e,t)}var kp={newInstance:gt.newInstance(Fp,"vtkViewport"),extend:Fp};const Lp=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function Bp(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Vp(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function Up(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Gp(e){return Up(e,Lp)}function zp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=an?s:n,e[4]=lr?u:r,e}function jp(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let n=0;ni?t:i,e[2]=n,e[3]=n>s?n:s,e[4]=r,e[5]=r>u?r:u,o!==t||a!==n||l!==r}function Xp(e,t,n,r){const[o,i,a,s,l,u]=e;return e[0]=t=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),n>=0?(e[2]*=n,e[3]*=n):(e[2]=n*e[3],e[3]=n*e[2]),r>=0?(e[4]*=r,e[5]*=r):(e[4]=r*e[5],e[5]=r*e[4]),!0)}function $p(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function Yp(e,t){return e[2*t+1]-e[2*t]}function Jp(e){return[Yp(e,0),Yp(e,1),Yp(e,2)]}function Qp(e){return e.slice(0,2)}function Zp(e){return e.slice(2,4)}function ef(e){return e.slice(4,6)}function tf(e){const t=Jp(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function nf(e){if(Vp(e)){const t=Jp(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function rf(e){return[e[0],e[2],e[4]]}function of(e){return[e[1],e[3],e[5]]}function af(e,t){return e<=0&&t>=0||e>=0&&t<=0}function sf(e,t){let n=0;for(let r=0;r<2;r++)for(let o=2;o<4;o++)for(let i=4;i<6;i++)t[n++]=[e[r],e[o],e[i]];return t}function lf(e,t,n){return t[0]=e[0],t[1]=e[2],t[2]=e[4],n[0]=e[1],n[1]=e[3],n[2]=e[5],t}function uf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=sf(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function df(e,t,n,r){const o=[].concat(Lp),i=e.getData();for(let e=0;ee[2*n+1]?(a[n]=0,u[n]=e[2*n+1],i=!1):a[n]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==n[e]?l[e]=(u[e]-t[e])/n[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(r[o]=t[o]+l[s]*n[o],r[o]e[2*o+1])return 0}else r[o]=u[o];return 1}function ff(e,t,n){const r=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){r[2]=e[s];for(let s=2;s<=3;++s){r[1]=e[s];for(let s=0;s<=1;++s)if(r[0]=e[s],o=Ii.evaluate(n,t,r),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function hf(e,t){if(!Vp(e)||!Vp(t))return!1;const n=[0,0,0,0,0,0];let r;for(let o=0;o<3;o++)if(r=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(r=!0,n[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(r=!0,n[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(r=!0,n[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(r=!0,n[2*o+1]=e[2*o+1]),!r)return!1;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],!0}function mf(e,t){if(!Vp(e)||!Vp(t))return!1;for(let n=0;n<3;n++)if(!(t[2*n]>=e[2*n]&&t[2*n]<=e[2*n+1]||e[2*n]>=t[2*n]&&e[2*n]<=t[2*n+1]||t[2*n+1]>=e[2*n]&&t[2*n+1]<=e[2*n+1]||e[2*n+1]>=t[2*n]&&e[2*n+1]<=t[2*n+1]))return!1;return!0}function gf(e,t,n,r){return!(te[1]||ne[3]||re[5])}function vf(e,t,n){const r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let r=0;r<2;r++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[r],e[a],e[s]];o[i++]=Ii.evaluate(n,t,l)}let a=2;for(;a--&&!(af(o[r[a][0]],o[r[a][4]])&&af(o[r[a][1]],o[r[a][5]])&&af(o[r[a][2]],o[r[a][6]])&&af(o[r[a][3]],o[r[a][7]])););if(a<0)return!1;const s=Math.sign(n[a]),l=Math.abs((e[2*a+1]-e[2*a])*n[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[r[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}class yf{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(Lp))}getBounds(){return this.bounds}equals(e){return Bp(this.bounds,e)}isValid(){return Vp(this.bounds)}setBounds(e){return Up(this.bounds,e)}reset(){return Gp(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return uf(this.bounds,e,t)}computeScale3(e){return cf(this.bounds,e)}cutWithPlane(e,t){return vf(this.bounds,e,t)}intersectBox(e,t,n,r){return pf(this.bounds,e,t,n,r)}intersectPlane(e,t){return ff(this.bounds,e,t)}intersect(e){return hf(this.bounds,e)}intersects(e){return mf(this.bounds,e)}containsPoint(e,t,n){return gf(this.bounds,e,t,n)}contains(e){return mf(this.bounds,e)}}var bf={newInstance:function(e){const t=e&&e.bounds;return new yf(t)},equals:Bp,isValid:Vp,setBounds:Up,reset:Gp,addPoint:zp,addPoints:jp,addBounds:Wp,setMinPoint:Hp,setMaxPoint:Xp,inflate:Kp,scale:qp,scaleAboutCenter:function(e,t,n,r){if(!Vp(e))return!1;const o=$p(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],qp(e,t,n,r),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:$p,getLength:Yp,getLengths:Jp,getMaxLength:tf,getDiagonalLength:nf,getMinPoint:rf,getMaxPoint:of,getXRange:Qp,getYRange:Zp,getZRange:ef,getCorners:sf,computeCornerPoints:lf,computeLocalBounds:df,transformBounds:uf,computeScale3:cf,cutWithPlane:vf,intersectBox:pf,intersectPlane:ff,intersect:hf,intersects:mf,containsPoint:gf,contains:function(e,t){return!!mf(e,t)&&!!gf(e,...rf(t))&&!!gf(e,...of(t))},INIT_BOUNDS:Lp};const{vtkDebugMacro:xf,vtkErrorMacro:_f,vtkWarningMacro:Tf}=vt;function Sf(e){return()=>_f(`vtkRenderer::${e} - NOT IMPLEMENTED`)}function wf(e,t){t.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(xf("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const n=e.getActiveCameraAndResetIfCreated();t.lights.forEach((e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(n.getCameraLightTransformMatrix(l())):_f("light has unknown light type",e.get()))}))},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=Sf("allocateTime"),e.updateGeometry=Sf("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=n=>{xf(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=n=>t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0),e.makeCamera=()=>{const t=Ep.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach((e=>{t.actors=t.actors.concat(e.getActors())})),t.actors),e.addActor=e.addViewProp,e.removeActor=n=>{t.actors=t.actors.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllActors=()=>{e.getActors().forEach((t=>{e.removeViewProp(t)})),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach((e=>{t.volumes=t.volumes.concat(e.getVolumes())})),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=n=>{t.volumes=t.volumes.filter((e=>e!==n)),e.removeViewProp(n),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach((t=>{e.removeViewProp(t)})),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=n=>{n&&!e.hasLight(n)&&(t.lights.push(n),e.modified())},e.removeLight=n=>{t.lights=t.lights.filter((e=>e!==n)),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=n=>{t.lights=n,e.modified()},e.makeLight=Op.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,n,r,o)=>{let i=e.normalizedDisplayToProjection(t,n,r);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,n,r,o)=>{let i=e.worldToView(t,n,r);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,n,r)=>{if(null===t.activeCamera)return _f("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o),h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.projectionToView=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i),h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.worldToView=(e,n,r)=>{if(null===t.activeCamera)return _f("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();h(o,o);const i=new Float64Array([e,n,r]);return Yt(i,i,o),i},e.viewToProjection=(e,n,r,o)=>{if(null===t.activeCamera)return _f("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);h(i,i);const a=new Float64Array([e,n,r]);return Yt(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=bf.INIT_BOUNDS[0],t.allBounds[1]=bf.INIT_BOUNDS[1],t.allBounds[2]=bf.INIT_BOUNDS[2],t.allBounds[3]=bf.INIT_BOUNDS[3],t.allBounds[4]=bf.INIT_BOUNDS[4],t.allBounds[5]=bf.INIT_BOUNDS[5];let r=!0;e.invokeEvent(n);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return r&&(yr(t.allBounds),xf("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const r=n||e.computeVisiblePropBounds(),i=[0,0,0];if(!br(r))return xf("Cannot reset camera!"),!1;let a=null;if(!e.getActiveCamera())return _f("Trying to reset non-existent camera"),!1;a=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),i[0]=(r[0]+r[1])/2,i[1]=(r[2]+r[3])/2,i[2]=(r[4]+r[5])/2;let s=r[1]-r[0],l=r[3]-r[2],u=r[5]-r[4];s*=s,l*=l,u*=u;let c=s+l+u;c=0===c?1:c,c=.5*Math.sqrt(c);const d=xn(t.activeCamera.getViewAngle()),p=c,f=c/Math.sin(.5*d),h=t.activeCamera.getViewUp();return Math.abs(Ln(h,a))>.999&&(Tf("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-h[2],h[0],h[1])),t.activeCamera.setFocalPoint(i[0],i[1],i[2]),t.activeCamera.setPosition(i[0]+f*a[0],i[1]+f*a[1],i[2]+f*a[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(p),t.activeCamera.setPhysicalScale(c),t.activeCamera.setPhysicalTranslation(-i[0],-i[1],-i[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const o=n||e.computeVisiblePropBounds();if(!br(o))return xf("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return _f("Trying to reset clipping range of non-existent camera"),!1;const i=t.activeCamera.computeClippingRange(o);let a=0;if(t.activeCamera.getParallelProjection())a=.2*t.activeCamera.getParallelScale();else{const e=xn(t.activeCamera.getViewAngle());a=.2*Math.tan(e/2)*i[1]}return i[1]-i[0]=i[1]?.01*i[1]:i[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),i[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter((e=>e.getVisibility())).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const n=t.activeCamera?t.activeCamera.getMTime():0;n>e&&(e=n);const r=t._createdLight?t._createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}const Cf={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Dr(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Af(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,Cf,n),kp.extend(e,t,n),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),He(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),$e(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),Ye(e,t,["actors","volumes","lights"]),Qe(e,t,["background"],4,1),Ze(0,t,["renderWindow"]),wf(e,t)}var Ef={newInstance:rt(Af,"vtkRenderer"),extend:Af};const Df=Object.create(null);function If(e,t){Df[e]=t}function Pf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Df[e]&&Df[e](t)}function Of(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=n=>{e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=n=>{t.renderers=t.renderers.filter((e=>e!==n)),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Pf(e||t.defaultViewAPI,n)},e.addView=n=>{e.hasView(n)||(n.setRenderable(e),t._views.push(n),e.modified())},e.removeView=n=>{t._views=t._views.filter((e=>e!==n)),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach((e=>{e.isActiveCameraCreated()||e.resetCamera()}))},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach((e=>e.traverseAllPasses()))},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach((t=>{e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6})),t.renderers.forEach((n=>{const r=n.getViewProps(),o=t._views[0].getViewNodeFor(n);r.forEach((t=>{if(t.getVisibility()){e.propCount+=1;const n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){const t=o.getViewNodeFor(n);if(t){e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6;const r=n.getPrimitiveCount();Object.keys(r).forEach((t=>{e[t]||(e[t]=0),e[t]+=r[t]}))}}}else e.invisiblePropCount+=1}))})),e.str=Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("\n"),e},e.captureImages=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gt.setImmediate(e.render),t._views.map((e=>e.captureNextImage?e.captureNextImage(n,r):void 0)).filter((e=>!!e))}}const Nf={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1};function Mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nf,n),gt.obj(e,t),gt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),gt.get(e,t,["neverRendered"]),gt.getArray(e,t,["renderers"]),gt.moveToProtected(e,t,["views"]),gt.event(e,t,"completion"),Of(e,t)}var Rf={newInstance:gt.newInstance(Mf,"vtkRenderWindow"),extend:Mf,registerViewConstructor:If,listViewAPIs:function(){return Object.keys(Df)},newAPISpecificView:Pf};const Ff={Unknown:0,LeftController:1,RightController:2},kf={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var Lf={Device:Ff,Input:kf,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4}};const{Device:Bf,Input:Vf}=Lf,{vtkWarningMacro:Uf,vtkErrorMacro:Gf,normalizeWheel:zf,vtkOnceErrorMacro:jf}=gt,Wf={ctrlKey:!1,altKey:!1,shiftKey:!1},Hf={"xr-standard":[Vf.Trigger,Vf.Grip,Vf.TrackPad,Vf.Thumbstick,Vf.A,Vf.B]},Xf=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function Kf(e){e.cancelable&&e.preventDefault()}function qf(e){const t=Object.create(null);return e.forEach((e=>{let{pointerId:n,position:r}=e;t[n]=r})),t}function $f(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const n=new Set,r=new Map;let o=1;function i(n,r){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(n,r))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{Gf("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=n=>{t.interactorStyle!==n&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=n,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>Uf("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||i(0,0),t.currentRenderer);const a=t._getScreenEventPositionFor||function(e){const n=t._view.getCanvas(),o=n.getBoundingClientRect(),a=n.width/o.width,s=n.height/o.height,l={x:a*(e.clientX-o.left),y:s*(o.height-e.clientY+o.top),z:0};return(r.size<=1||!t.currentRenderer)&&i(l.x,l.y),l};function s(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(e){const t=s(e);return{key:e.key,keyCode:e.charCode,...t}}function u(e){return e.pointerType||""}function c(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.bindEvents=n=>{t.container=n,n.addEventListener("contextmenu",Kf),n.addEventListener("wheel",e.handleWheel),n.addEventListener("DOMMouseScroll",e.handleWheel),n.addEventListener("pointerenter",e.handlePointerEnter),n.addEventListener("pointerleave",e.handlePointerLeave),n.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.addEventListener("pointerup",e.handlePointerUp),n.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),n.style.touchAction="none",n.style.userSelect="none",n.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=()=>{const{container:n}=t;n.removeEventListener("contextmenu",Kf),n.removeEventListener("wheel",e.handleWheel),n.removeEventListener("DOMMouseScroll",e.handleWheel),n.removeEventListener("pointerenter",e.handlePointerEnter),n.removeEventListener("pointerleave",e.handlePointerLeave),n.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),n.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),n.removeEventListener("pointerup",e.handlePointerUp),n.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,r.clear()},e.handleKeyPress=t=>{const n=l(t);e.keyPressEvent(n)},e.handleKeyDown=t=>{const n=l(t);e.keyDownEvent(n)},e.handleKeyUp=t=>{const n=l(t);e.keyUpEvent(n)},e.handlePointerEnter=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerEnterEvent(n),"mouse"===n.deviceType&&e.mouseEnterEvent(n)},e.handlePointerLeave=t=>{const n={...s(t),position:a(t),deviceType:u(t)};e.pointerLeaveEvent(n),"mouse"===n.deviceType&&e.mouseLeaveEvent(n)},e.handlePointerDown=n=>{if(!(n.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&Kf(n),n.target.hasPointerCapture(n.pointerId)&&n.target.releasePointerCapture(n.pointerId),t.container.setPointerCapture(n.pointerId),r.has(n.pointerId)&&Uf("[RenderWindowInteractor] duplicate pointerId detected"),r.set(n.pointerId,{pointerId:n.pointerId,position:a(n)}),n.pointerType){case"pen":case"touch":e.handleTouchStart(n);break;default:e.handleMouseDown(n)}},e.handlePointerUp=n=>{if(r.has(n.pointerId))switch(t.preventDefaultOnPointerUp&&Kf(n),r.delete(n.pointerId),t.container.releasePointerCapture(n.pointerId),n.pointerType){case"pen":case"touch":e.handleTouchEnd(n);break;default:e.handleMouseUp(n)}},e.handlePointerCancel=t=>{if(r.has(t.pointerId))switch(r.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(r.has(t.pointerId)&&(r.get(t.pointerId).position=a(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonPressEvent(n);break;case 1:e.middleButtonPressEvent(n);break;case 2:e.rightButtonPressEvent(n);break;default:Gf(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?Uf("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):Gf("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;Uf(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(n,r,o)=>{n.inputSources.forEach((n=>{const i=null==n.gripSpace?null:r.getPose(n.gripSpace,o),a=n.gamepad,s=n.handedness;if(a){a.index in t.lastGamepadValues||(t.lastGamepadValues[a.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let r=0;r{const r={...s(n),position:a(n),deviceType:u(n)};0===t.moveTimeoutID?e.startMouseMoveEvent(r):(e.mouseMoveEvent(r),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout((()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0}),200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),c(),n.size>0||Date.now(){Kf(n);const r={...zf(n),...s(n),position:a(n),deviceType:u(n)};0===t.wheelTimeoutID&&(o=Math.abs(r.spinY)>=.3?Math.abs(r.spinY):1),r.spinY/=o,0===t.wheelTimeoutID?(e.startMouseWheelEvent(r),e.mouseWheelEvent(r)):(e.mouseWheelEvent(r),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout((()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0}),200)},e.handleMouseUp=t=>{const n={...s(t),position:a(t),deviceType:u(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(n);break;case 1:e.middleButtonReleaseEvent(n);break;case 2:e.rightButtonReleaseEvent(n);break;default:Gf(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);if(2===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonPressEvent(t)}},e.handleTouchMove=n=>{const o=[...r.values()];if(t.recognizeGestures&&o.length>1){const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.mouseMoveEvent(t)}},e.handleTouchEnd=n=>{const o=[...r.values()];if(t.recognizeGestures)if(0===o.length){const t={...s(Wf),position:a(n),deviceType:u(n)};e.leftButtonReleaseEvent(t)}else if(1===o.length){const t=qf(r);e.recognizeGesture("TouchEnd",t);const i={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonPressEvent(i)}else{const t=qf(r);e.recognizeGesture("TouchMove",t)}else if(1===o.length){const t={...s(Wf),position:o[0].position,deviceType:u(n)};e.leftButtonReleaseEvent(t)}},e.setView=n=>{t._view!==n&&(t._view=n,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const r=t._view?.getRenderable()?.getRenderers();if(!r||0===r.length)return null;r.sort(((e,t)=>e.getLayer()-t.getLayer()));let o=null,i=null,a=null,s=r.length;for(;s--;){const l=r[s];if(t._view.isInViewport(e,n,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,n,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=r[0]),a},e.render=()=>{e.isAnimating()||t.inRender||c()},Xf.forEach((n=>{const r=n.charAt(0).toLowerCase()+n.slice(1);e[`${r}Event`]=r=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void jf("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:n,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...r};e[`invoke${n}`](o)}})),e.recognizeGesture=(n,r)=>{if(Object.keys(r).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach((e=>{t.startingEventPositions[e]=r[e]})),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(r).forEach((e=>{i[o]=r[e],a[o]=t.startingEventPositions[e],o++}));const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=_n(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=_n(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)n&&o>i&&o>a){t.currentGesture="Pinch";const n={scale:1,touches:r};e.startPinchEvent(n)}else if(i>n&&i>a){t.currentGesture="Rotate";const n={rotation:0,touches:r};e.startRotateEvent(n)}else if(a>n){t.currentGesture="Pan";const n={translation:[0,0],touches:r};e.startPanEvent(n)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:r};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:r};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:r};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e};const d=e.delete;e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),d()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}const Yf={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function Jf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yf,n),gt.obj(e,t),t._animationExtendedEnd=0,gt.event(e,t,"RenderEvent"),Xf.forEach((n=>gt.event(e,t,n))),gt.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),gt.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),gt.moveToProtected(e,t,["view"]),$f(e,t)}var Qf={newInstance:gt.newInstance(Jf,"vtkRenderWindowInteractor"),extend:Jf,handledEvents:Xf,...Lf};const{vtkErrorMacro:Zf,VOID:eh}=gt;function th(e,t){t.classHierarchy.push("vtkInteractorObserver");const n={...e};function r(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){Qf.handledEvents.forEach((n=>{e[`handle${n}`]&&t.subscribedEvents.push(t._interactor[`on${n}`]((r=>t.processEvents?e[`handle${n}`](r):eh),t.priority))}))}e.setInteractor=n=>{n!==t._interactor&&(r(),t._interactor=n,n&&t.enabled&&o(),e.modified())},e.setEnabled=n=>{n!==t.enabled&&(r(),n&&(t._interactor?o():Zf("\n The interactor must be set before subscribing to events\n ")),t.enabled=n,e.modified())},e.computeDisplayToWorld=(e,n,r,o)=>e?t._interactor.getView().displayToWorld(n,r,o,e):null,e.computeWorldToDisplay=(e,n,r,o)=>e?t._interactor.getView().worldToDisplay(n,r,o,e):null,e.setPriority=e=>{n.setPriority(e)&&t._interactor&&(r(),o())}}const nh={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,n),gt.obj(e,t),gt.event(e,t,"InteractionEvent"),gt.event(e,t,"StartInteractionEvent"),gt.event(e,t,"EndInteractionEvent"),gt.get(e,t,["_interactor","enabled"]),gt.setGet(e,t,["priority","processEvents"]),gt.moveToProtected(e,t,["interactor"]),th(e,t)}var oh={newInstance:gt.newInstance(rh,"vtkInteractorObserver"),extend:rh,computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}},ih={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:ah}=ih,sh={Rotate:ah.IS_ROTATE,Pan:ah.IS_PAN,Spin:ah.IS_SPIN,Dolly:ah.IS_DOLLY,CameraPose:ah.IS_CAMERA_POSE,WindowLevel:ah.IS_WINDOW_LEVEL,Slice:ah.IS_SLICE};function lh(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(sh).forEach((n=>{gt.event(e,t,`Start${n}Event`),e[`start${n}`]=()=>{t.state===ah.IS_NONE&&(t.state=sh[n],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${n}Event`]({type:`Start${n}Event`}))},gt.event(e,t,`End${n}Event`),e[`end${n}`]=()=>{t.state===sh[n]&&(t.state=ah.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${n}Event`]({type:`End${n}Event`}),t._interactor.render())}})),e.handleKeyPress=e=>{const n=t._interactor;let r=null;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()})),n.render();break;case"s":case"S":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()})),n.render();break;case"v":case"V":r=e.pokedRenderer.getActors(),r.forEach((e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()})),n.render()}}}const uh={state:ah.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uh,n),oh.extend(e,t,n),lh(e,t)}var dh={newInstance:gt.newInstance(ch,"vtkInteractorStyle"),extend:ch,...ih};const{States:ph}=ih;function fh(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=n=>{const r=n.position,o=n.pokedRenderer;switch(t.state){case ph.IS_ROTATE:e.handleMouseRotate(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_PAN:e.handleMousePan(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_DOLLY:e.handleMouseDolly(o,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case ph.IS_SPIN:e.handleMouseSpin(o,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=n=>{!n||!n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad?!n||n.pressed||n.device!==Ff.RightController||n.input!==kf.Trigger&&n.input!==kf.TrackPad||t.state!==ph.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=n=>{t.state===ph.IS_CAMERA_POSE&&e.updateCameraPose(n)},e.updateCameraPose=e=>{const t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.025*t.getPhysicalScale(),o=t.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);t.setPhysicalTranslation(n[0]+o[0]*r,n[1]+o[1]*r,n[2]+o[2]*r)},e.handleLeftButtonPress=n=>{const r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case ph.IS_DOLLY:e.endDolly();break;case ph.IS_PAN:e.endPan();break;case ph.IS_SPIN:e.endSpin();break;case ph.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=n=>{t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=n=>{t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=n=>{t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=n=>{e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=n=>{const r=n.pokedRenderer.getActiveCamera();let o=r.getFocalPoint();o=e.computeWorldToDisplay(n.pokedRenderer,o[0],o[1],o[2]);const i=o[2],a=n.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(n.pokedRenderer,o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(n.pokedRenderer,o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=r.getFocalPoint();const d=r.getPosition();r.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=e=>{const n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,a=r.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,n)=>{if(!t.previousPosition)return;const r=t._interactor,o=e.getActiveCamera(),i=r.getView().getViewportCenter(e),a=_n(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=_n(Math.atan2(n.y-i[1],n.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(n,r)=>{if(!t.previousPosition)return;const o=n.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(n,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(n,r.x,r.y,a),l=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(n,r)=>{if(!t.previousPosition)return;const o=r.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(n),a=t.motionFactor*o/i[1];e.dollyByFactor(n,1.1**a)},e.handleMouseWheel=n=>{const r=1-n.spinY/t.zoomFactor;e.dollyByFactor(n.pokedRenderer,r)},e.dollyByFactor=(e,n)=>{if(Number.isNaN(n))return;const r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}const hh={motionFactor:10,zoomFactor:10};function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hh,n),dh.extend(e,t,n),gt.setGet(e,t,["motionFactor","zoomFactor"]),fh(e,t)}var gh={newInstance:gt.newInstance(mh,"vtkInteractorStyleTrackballCamera"),extend:mh};function vh(e){return e}function yh(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map((e=>yh(e.trim()))):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var bh=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const n={},r=e?yh:vh,o=(t||"").replace(/#.*/,"").replace("?","").split("&");return o.forEach((e=>{const[t,o]=e.split("=").map((e=>decodeURIComponent(e)));t&&(n[t]=!o||r(o))})),n},xh={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:_h}=xh;function Th(e){return()=>gt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}function Sh(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let n=0;ne&&(e=r)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=Th("pick"),e.hasKey=Th("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=n=>{n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=n=>{const r=t.textures.filter((e=>e!==n));t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(_h.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(_h.DISPLAY)}const wh={allocatedRenderTime:10,coordinateSystem:_h.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),gt.obj(e,t),gt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),gt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),gt.moveToProtected(e,t,["parentProp"]),Sh(e,t)}var Ah={newInstance:gt.newInstance(Ch,"vtkProp"),extend:Ch,...xh};function Eh(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=n=>{t.position=t.position.map(((e,t)=>e+n[t])),e.modified()},e.getOrientationWXYZ=()=>{const e=Ro();F(e,t.rotation);const n=new Float64Array(3),r=function(e,t){var n=2*Math.acos(t[3]),r=Math.sin(n/2);return r>o?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}(n,e);return[_n(r),n[0],n[1],n[2]]},e.rotateX=n=>{0!==n&&(T(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateY=n=>{0!==n&&(S(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateZ=n=>{0!==n&&(w(t.rotation,t.rotation,xn(n)),e.modified())},e.rotateWXYZ=(n,r,o,i)=>{if(0===n||0===r&&0===o&&0===i)return;const a=xn(n),s=Ro();Fo(s,[r,o,i],a);const l=new Float64Array(16);B(l,s),y(t.rotation,t.rotation,l),e.modified()},e.setOrientation=(n,r,o)=>(n!==t.orientation[0]||r!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[n,r,o],f(t.rotation),e.rotateZ(o),e.rotateX(n),e.rotateY(r),e.modified(),!0),e.setUserMatrix=n=>!$n(t.userMatrix,n)&&(c(t.userMatrix,n),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){f(t.matrix),t.userMatrix&&y(t.matrix,t.matrix,t.userMatrix),b(t.matrix,t.matrix,t.origin),b(t.matrix,t.matrix,t.position),y(t.matrix,t.matrix,t.rotation),x(t.matrix,t.matrix,t.scale),b(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),h(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let n=0;n<4;++n)(e===n?1:0)!==t.matrix[e+4*n]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=()=>bf.getCenter(t.bounds),e.getLength=()=>bf.getLength(t.bounds),e.getXRange=()=>bf.getXRange(t.bounds),e.getYRange=()=>bf.getYRange(t.bounds),e.getZRange=()=>bf.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified((function(){e.computeMatrix()}))}const Dh={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function Ih(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dh,n),Ah.extend(e,t,n),t.matrixMTime={},gt.obj(t.matrixMTime),gt.get(e,t,["bounds","isIdentity"]),gt.getArray(e,t,["orientation"]),gt.setGetArray(e,t,["origin","position","scale"],3),t.matrix=f(new Float64Array(16)),t.rotation=f(new Float64Array(16)),t.userMatrix=f(new Float64Array(16)),t.transform=null,Eh(e,t)}var Ph={newInstance:gt.newInstance(Ih,"vtkProp3D"),extend:Ih};const{vtkDebugMacro:Oh}=gt;function Nh(e,t){t.classHierarchy.push("vtkActor");const n={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();let n=t.property.getOpacity()>=1;return n=n&&(!t.texture||!t.texture.isTranslucent()),n=n&&(!t.mapper||t.mapper.getIsOpaque()),n},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque()),e.makeProperty=wu.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){Oh("Recomputing bounds..."),t.mapperBounds=n.concat();const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=n.getMTime();if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}if(null!==t.backfaceProperty){const n=t.backfaceProperty.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,n)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,n)}}const Mh={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function Rh(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=n=>!!n.isA("vtkPlane")&&!t.clippingPlanes.includes(n)&&(t.clippingPlanes.push(n),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=n=>{const r=t.clippingPlanes.indexOf(n);return-1!==r&&(t.clippingPlanes.splice(r,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const n=t.length;for(let r=0;r{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(n>=0&&n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mh,n),Ph.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Nh(e,t)}),"vtkActor");const Fh={clippingPlanes:[]};var kh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,n),gt.obj(e,t),gt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),Rh(e,t)};function Lh(e,t){e.getBounds=()=>(gt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Dr()),e.getCenter=()=>{const n=e.getBounds();return t.center=bf.isValid(n)?bf.getCenter(n):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return bf.getDiagonalLength(t)}}const Bh=e=>({bounds:[...bf.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e});var Vh=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bh(n)),kh(e,t,n),gt.setGet(e,t,["viewSpecificProperties"]),Lh(e,t)};const Uh={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var Gh={StructuredType:Uh};const{StructuredType:zh}=Gh;var jh={getDataDescriptionFromExtent:function(e){let t=0;for(let n=0;n<3;++n)e[2*n]e[1]||e[2]>e[3]||e[4]>e[5]?zh.EMPTY:3===t?zh.XYZ_GRID:2===t?e[0]===e[1]?zh.YZ_PLANE:e[2]===e[3]?zh.XZ_PLANE:zh.XY_PLANE:1===t?e[0]e!==i[t]));return a&&(t.extent=i.slice(),t.dataDescription=jh.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let n,r,o;if(t.deleted)Wh("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];n=e[0],r=e[1],o=e[2]}else{if(3!==arguments.length)return void Wh("Bad dimension specification");n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,n-1,0,r-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let n=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(n*=t[e]-1)}return n},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=n=>{const r=e.getDimensions();if(0===r[0]||0===r[1]||0===r[2])return Wh("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case Uh.EMPTY:return null;case Uh.SINGLE_POINT:break;case Uh.X_LINE:o[0]=n;break;case Uh.Y_LINE:o[1]=n;break;case Uh.Z_LINE:o[2]=n;break;case Uh.XY_PLANE:o[0]=n%r[0],o[1]=n/r[0];break;case Uh.YZ_PLANE:o[1]=n%r[1],o[2]=n/r[1];break;case Uh.XZ_PLANE:o[0]=n%r[0],o[2]=n/r[0];break;case Uh.XYZ_GRID:o[0]=n%r[0],o[1]=n/r[0]%r[1],o[2]=n/(r[0]*r[1]);break;default:Wh("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>bf.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>bf.inflate([...t.extent],.5),e.computeTransforms=()=>{C(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],x(t.indexToWorld,t.indexToWorld,t.spacing),m(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.indexToWorld),n},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Yt(n,e,t.worldToIndex),n},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.indexToWorld,n)},e.worldToIndexBounds=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return bf.transformBounds(e,t.worldToIndex,n)},e.onModified(e.computeTransforms),e.computeTransforms(),e.getCenter=()=>bf.getCenter(e.getBounds()),e.computeHistogram=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=[0,0,0,0,0,0];e.worldToIndexBounds(t,r);const o=[0,0,0],i=[0,0,0];bf.computeCornerPoints(r,o,i),er(o,o),er(i,i);const a=e.getDimensions();_r(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),_r(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!n||n([s,t,e],r)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0,v=Math.sqrt(g);return{minimum:d,maximum:c,average:m,variance:g,sigma:v,count:h}},e.computeIncrements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=[];let r=t;for(let t=0;t<3;++t)n[t]=r,r*=e[2*t+1]-e[2*t]+1;return n},e.computeOffsetIndex=t=>{let[n,r,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(n)-i[0])*s[0]+(Math.round(r)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const n=e.getExtent(),r=e.worldToIndex(t);for(let e=0;e<3;++e)if(r[e]n[2*e+1])return Wh(`GetScalarPointer: Pixel ${r} is not in memory. Current extent = ${n}`),NaN;return e.computeOffsetIndex(r)},e.getScalarValueFromWorld=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=e.getPointData().getScalars().getNumberOfComponents();if(n<0||n>=r)return Wh(`GetScalarPointer: Scalar Component ${n} is not within bounds. Current Scalar numberOfComponents: ${r}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,n)}}const Xh={direction:null,indexToWorld:null,worldToIndex:null,spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:Uh.EMPTY};function Kh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xh,n),di.extend(e,t,n),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=ae(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),gt.get(e,t,["indexToWorld","worldToIndex"]),gt.setGetArray(e,t,["origin","spacing"],3),gt.setGetArray(e,t,["direction"],9),gt.getArray(e,t,["extent"],6),Hh(e,t)}var qh={newInstance:gt.newInstance(Kh,"vtkImageData"),extend:Kh};const{vtkErrorMacro:$h}=gt;function Yh(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4,e.linearIndexLookup=(e,t)=>{let n=0;const r=Number(e);return rt.range[1]?n=t.maxIndex+1+1.5:(n=(r+t.shift)*t.scale,n=n{let o=0;o=Er(t)?Math.floor(r.maxIndex+1.5+2):e.linearIndexLookup(t,r);const i=4*o;return n.slice(i,i+4)},e.indexedLookupFunction=(n,r,o)=>{let i=e.getAnnotatedValueIndexInternal(n);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[r[a],r[a+1],r[a+2],r[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(n,r,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=n.getNumberOfTuples(),d=n.getNumberOfComponents(),p=r.getData(),f=n.getData();if(u>=1){if(o===$d.RGBA)for(let e=0;e{let n=0,r=0,o=0,i=0;const a=t.numberOfColors-1;a&&(n=(t.hueRange[1]-t.hueRange[0])/a,r=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*n,s[1]=t.saturationRange[0]+e*r,s[2]=t.valueRange[0]+e*o,dr(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=n=>{if(Array.isArray(n)){const r=n[0].length;t.numberOfColors=n.length;const o=4-r;let i=0;for(let e=0;e{const{numberOfColors:e}=t,n=t.table;let r=4*(e+0);t.useBelowRangeColor||0===e?(n[r]=255*t.belowRangeColor[0]+.5,n[r+1]=255*t.belowRangeColor[1]+.5,n[r+2]=255*t.belowRangeColor[2]+.5,n[r+3]=255*t.belowRangeColor[3]+.5):(n[r]=n[0],n[r+1]=n[1],n[r+2]=n[2],n[r+3]=n[3]),r=4*(e+1),t.useAboveRangeColor||0===e?(n[r]=255*t.aboveRangeColor[0]+.5,n[r+1]=255*t.aboveRangeColor[1]+.5,n[r+2]=255*t.aboveRangeColor[2]+.5,n[r+3]=255*t.aboveRangeColor[3]+.5):(n[r]=n[4*(e-1)+0],n[r+1]=n[4*(e-1)+1],n[r+2]=n[4*(e-1)+2],n[r+3]=n[4*(e-1)+3]),r=4*(e+2),n[r]=255*t.nanColor[0]+.5,n[r+1]=255*t.nanColor[1]+.5,n[r+2]=255*t.nanColor[2]+.5,n[r+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}const Jh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Qh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jh,n),lp.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},gt.obj(t.buildTime),t.opaqueFlagBuildTime={},gt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},gt.obj(t.insertTime,{mtime:0}),gt.get(e,t,["buildTime"]),gt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),gt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),gt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),gt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),Yh(e,t)}var Zh={newInstance:gt.newInstance(Qh,"vtkLookupTable"),extend:Qh};let em=1,tm=0;const nm=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function rm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;tm=e}var om={getResolveCoincidentTopologyAsString:function(){return nm[tm]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return em},getResolveCoincidentTopology:function(){return tm},setResolveCoincidentTopology:rm,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){em=e},setResolveCoincidentTopologyToDefault:function(){rm(0)},setResolveCoincidentTopologyToOff:function(){rm(0)},setResolveCoincidentTopologyToPolygonOffset:function(){rm(1)}};function im(e,t,n){n.forEach((n=>{e[`get${n.method}`]=()=>t[n.key],e[`set${n.method}`]=(e,r)=>{t[n.key]={factor:e,offset:r}}}))}const am=["Polygon","Line","Point"],sm={};im(sm,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},am.map((e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`}))));var lm={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),gt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(om).forEach((t=>{e[t]=om[t]})),Object.keys(sm).forEach((t=>{e[t]=sm[t]})),im(e,t.topologyOffset,am.map((e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`})))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=sm.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=sm.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}}},staticOffsetAPI:sm,otherStaticMethods:om,CATEGORIES:am};const um={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var cm={PassTypes:um};const{FieldAssociations:dm}=di,{staticOffsetAPI:pm,otherStaticMethods:fm}=lm,{ColorMode:hm,ScalarMode:mm,GetArray:gm}=Jd,{VectorMode:vm}=Yd,{VtkDataTypes:ym}=Wr;function bm(e){return()=>gt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function xm(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=Zh.newInstance()},e.getColorModeAsString=()=>gt.enumToString(hm,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>gt.enumToString(mm,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,n,r,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};let a=null,s=!1;if(n===mm.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(n===mm.USE_POINT_DATA)a=e.getPointData().getScalars();else if(n===mm.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(n===mm.USE_POINT_FIELD_DATA){const t=e.getPointData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(n===mm.USE_FIELD_DATA){const t=e.getFieldData();a=r===gm.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(n,r)=>{const o=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const i=`${e.getMTime()}${o.getMTime()}${r}`;if(t.colorBuildString!==i){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(o,r);else{t.colorCoordinates=null,t.colorTextureMap=null;const n=e.getLookupTable();n&&(n.build(),t.colorMapColors=n.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${r}`}},e.scalarToTextureCoordinate=(e,t,n)=>{let r=.5,o=1;return Er(e)||(o=.49,r=(e-t)*n,r>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:o}},e.createColorTextureCoordinates=(t,n,r,o,i,a,s,l,u)=>{const c=(a[1]-a[0])/l,d=[];d[0]=a[0]-c,d[1]=a[1]+c;const p=1/(d[1]-d[0]),f=n.getData(),h=t.getData();let m=0,g=0;if(i<0||i>=o)for(let t=0;t{const o=t.lookupTable.getRange(),i=t.lookupTable.usingLogScale();i&&Zh.getLogRange(o,o);const a=t.lookupTable.getAlpha();if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();let e=t.lookupTable.getNumberOfAvailableColors();e>4094&&(e=4094),e<64&&(e=64),e+=2;const n=(o[1]-o[0])/(e-2),s=new Float64Array(2*e);for(let t=0;tt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;const r=n.getNumberOfComponents(),a=n.getNumberOfTuples();t.colorCoordinates=Wr.newInstance({numberOfComponents:2,values:new Float32Array(2*a)});let s=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===vm.MAGNITUDE&&n.getNumberOfComponents()>1&&(s=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,a,r,s,o,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,i)}},e.getIsOpaque=()=>{const n=e.getInputData(),r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==r)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(r,t.colorMode,-1))},e.canUseTextureMapForColoring=n=>{if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;const r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),o=r.scalars;return!(!o||r.cellFlag||t.colorMode===hm.DEFAULT&&o.getDataType()===ym.UNSIGNED_CHAR||t.colorMode===hm.DIRECT_SCALARS)},e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=bm("AcquireInvertibleLookupTable"),e.valueToColor=bm("ValueToColor"),e.colorToValue=bm("ColorToValue"),e.useInvertibleColorFor=bm("UseInvertibleColorFor"),e.clearInvertibleColor=bm("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,n)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const r=e.getRawPixelBuffer(um.ID_LOW24),o=e.getRawPixelBuffer(um.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===dm.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===dm.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&n.forEach((t=>{if(i===um.ID_LOW24){let n=0;o&&(n+=o[t],n*=256),n+=r[t+2],n*=256,n+=r[t+1],n*=256,n+=r[t];const i=s[n],a=e.getPixelBuffer(um.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===um.ID_HIGH24&&o){let n=0;n+=o[t],n*=256,n+=r[t],n*=256,n+=r[t+1],n*=256,n+=r[t+2];const i=s[n];e.getPixelBuffer(um.ID_HIGH24)[t]=(4278190080&i)>>24}}))}}const _m={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Tm(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${gt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=r,t.preDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})),t.delegates.forEach((t=>{t.traverse(n,e)})),t.postDelegateOperations.forEach((t=>{e.setCurrentOperation(t),n.traverse(e)})))}}gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_m,n),Vh(e,t,n),gt.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap","selectionWebGLIdsToVTKIds"]),gt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),gt.setGetArray(e,t,["scalarRange"],2),lm.implementCoincidentTopologyMethods(e,t),xm(e,t)}),"vtkMapper");const Sm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sm,n),gt.obj(e,t),gt.get(e,t,["currentOperation"]),gt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),gt.moveToProtected(e,t,["currentParent"]),Tm(e,t)}var Cm={newInstance:gt.newInstance(wm,"vtkRenderPass"),extend:wm};const{Representation:Am}=wu,{vtkErrorMacro:Em}=gt;function Dm(e){const t=Ca.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}function Im(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint16Array([4,0,1,3,2]),o=Wr.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=Wr.newInstance({numberOfComponents:2,values:n});i.setName("tcoords");const a=Wr.newInstance({numberOfComponents:1,values:r});t.tris.getCABO().createVBO(a,"polys",Am.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const n=e.getSize(),r=e.getContext();t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...n),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=hs.newInstance(),t.translucentRGBATexture.setInternalFormat(r.RGBA16F),t.translucentRGBATexture.setFormat(r.RGBA),t.translucentRGBATexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw(n[0],n[1],4,"Float32Array",null),t.translucentRTexture=hs.newInstance(),t.translucentRTexture.setInternalFormat(r.R16F),t.translucentRTexture.setFormat(r.RED),t.translucentRTexture.setOpenGLDataType(r.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw(n[0],n[1],1,"Float32Array",null),t.translucentZTexture=hs.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw(n[0],n[1],"Float32Array",null),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=n=>{const r=n.getContext();t.tris.setOpenGLRenderWindow(n),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Em("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Em("Error setting vertexDC in copy shader VAO.")},e.traverse=(n,r,o)=>{if(t.deleted)return;const i=n.getSize(),a=n.getContext();if(t._supported=!1,r.getSelector()||!a||!n.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void r.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(n);else{const r=t.framebuffer.getSize();null===r||r[0]!==i[0]||r[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRTexture.releaseGraphicsResources(n),t.translucentZTexture.releaseGraphicsResources(n),e.createFramebuffer(n)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),r.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),r.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(n):n.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=Ia.newInstance(),t.copyVAO.setOpenGLRenderWindow(n)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Dm:null,e.releaseGraphicsResources=n=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(n),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(n),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(n),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(n),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(n),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(n),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(n),t.tris=null),e.modified()}}const Pm={framebuffer:null,copyShader:null,tris:null};function Om(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pm,n),Cm.extend(e,t,n),t.VBOBuildTime={},gt.obj(t.VBOBuildTime,{mtime:0}),t.tris=Ra.newInstance(),gt.get(e,t,["framebuffer"]),Im(e,t)}var Nm={newInstance:gt.newInstance(Om,"vtkOpenGLOrderIndependentTranslucentPass"),extend:Om};function Mm(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const r=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zs.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===r[0]&&o[1]===r[1]||(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),a.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),a.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),a.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Nm.newInstance()),t.translucentPass.traverse(n,a,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),a.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),a.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}const Rm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Fm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rm,n),Cm.extend(e,t,n),gt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),Mm(e,t)}var km={newInstance:gt.newInstance(Fm,"vtkForwardPass"),extend:Fm};const{FieldAssociations:Lm}=di;function Bm(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,n,r,o)=>{},e.selectAsync=async(t,n,r,o,i)=>{const a=await e.getSourceDataAsync(t,n,r,o,i);return a?a.generateSelection(n,r,o,i):[]}}const Vm={fieldAssociation:Lm.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Um(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),gt.obj(e,t),gt.setGet(e,t,["fieldAssociation","captureZValues"]),Bm(e,t)}var Gm={newInstance:gt.newInstance(Um,"vtkHardwareSelector"),extend:Um};function zm(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}const jm={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Wm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),gt.obj(e,t),t.properties={},gt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),zm(e,t)}var Hm={newInstance:gt.newInstance(Wm,"vtkSelectionNode"),extend:Wm,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:Xm}=cm,{SelectionContent:Km,SelectionField:qm}=Hm,{FieldAssociations:$m}=di,{vtkErrorMacro:Ym}=gt;function Jm(e){return`${e.propID} ${e.compositeID}`}function Qm(e,t,n,r){return n?n[4*(t*(r[2]-r[0]+1)+e)+3]:0}function Zm(e,t,n,r){if(!n)return 0;const o=4*(t*(r[2]-r[0]+1)+e),i=n[o],a=n[o+1];return 256*(256*n[o+2]+a)+i}function eg(e,t){let n=t;return n<<=24,n|=e,n}function tg(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const n=[t[0]-e.area[0],t[1]-e.area[1]],o=Zm(n[0],n[1],e.pixBuffer[Xm.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=Zm(n[0],n[1],e.pixBuffer[Xm.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const r=4*(n[1]*(e.area[2]-e.area[0]+1)+n[0]);i.zValue=(256*e.zBuffer[r]+e.zBuffer[r+1])/65535,i.displayPosition=t}if(e.pixBuffer[Xm.ID_LOW24]&&0===Qm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area))return i;const s=Zm(n[0],n[1],e.pixBuffer[Xm.ID_LOW24],e.area),l=Zm(n[0],n[1],e.pixBuffer[Xm.ID_HIGH24],e.area);return i.attributeID=eg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=tg(e,t,0,r);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[0]=i[0]+t,s=tg(e,a,0,r),s&&s.valid)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=tg(e,a,0,r),s&&s.valid))return s;if(a[1]=i[1]+t,s=tg(e,a,0,r),s&&s.valid)return s}}return r[0]=t[0],r[1]=t[1],null}function ng(e,t,n,r,o){const i=[];let a=0;return t.forEach(((t,s)=>{const l=Hm.newInstance();switch(l.setContentType(Km.INDICES),e){case $m.FIELD_ASSOCIATION_CELLS:l.setFieldType(qm.CELL);break;case $m.FIELD_ASSOCIATION_POINTS:l.setFieldType(qm.POINT);break;default:Ym("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,n&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r)),l.setSelectionList(t.attributeIDs),i[a]=l,a++})),i}function rg(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=tg(e,[n,t],0,c);if(r&&r.valid){const t=Jm(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t.maxAttributeId=0;const n=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e[0]!==n[0]||e[1]!==n[1]?(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()):t.framebuffer.bind()}else t.framebuffer=Zs.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),n=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),n&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.getSourceDataAsync=async(n,r,o,i,a)=>{if(t._renderer=n,void 0===r){const n=t._openGLRenderWindow.getSize();e.setArea(0,0,n[0]-1,n[1]-1)}else e.setArea(r,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:n,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),n=0;n{if(!t._renderer||!t._openGLRenderWindow)return Ym("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const n=t._openGLRenderWindow.getRenderPasses();for(e.beginSelection(),t.currentPass=Xm.MIN_KNOWN_PASS;t.currentPass<=Xm.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===Xm.ACTOR_PASS&&"function"==typeof n[0].requestDepth&&"function"==typeof n[0].getFramebuffer?(n[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),e.processPixelBuffers());return e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach(((n,r)=>{e.isPropHit(r)&&n.processSelectorPixelBuffers(e,t.propPixels[r])}))},e.passRequired=e=>{if(e===Xm.ID_HIGH24){if(t.fieldAssociation===$m.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===$m.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=n=>{if(t.pixBuffer[n]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[n]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[n]=new Uint8Array(e),t.rawPixBuffer[n].set(t.pixBuffer[n])}if(n===Xm.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const n=e[0].getFramebuffer();n.saveCurrentBindingsAndBuffers(),n.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[n])}},e.buildPropHitList=e=>{let n=0;for(let r=0;r<=t.area[3]-t.area[1];r++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=Zm(o,r,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*n)),++n}},e.renderProp=n=>{t.currentPass===Xm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(n))},e.renderCompositeIndex=n=>{t.currentPass===Xm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>gt.enumToString(Xm,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(n,r,o)=>{const i=r<0?0:r;if(0===i){if(o[0]=n[0],o[1]=n[1],n[0]t.area[2]||n[1]t.area[3])return null;const e=[n[0]-t.area[0],n[1]-t.area[1]],r=Zm(e[0],e[1],t.pixBuffer[Xm.ACTOR_PASS],t.area);if(r<=0||r-1>=t.props.length)return null;const i={valid:!0};i.propID=r-1,i.prop=t.props[i.propID];let a=Zm(e[0],e[1],t.pixBuffer[Xm.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const r=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[r]+t.zBuffer[r+1])/65535,i.displayPosition=n}if(t.pixBuffer[Xm.ID_LOW24]&&0===Qm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area))return i;const s=Zm(e[0],e[1],t.pixBuffer[Xm.ID_LOW24],t.area),l=Zm(e[0],e[1],t.pixBuffer[Xm.ID_HIGH24],t.area);return i.attributeID=eg(s,l),i}const a=[n[0],n[1]],s=[0,0];let l=e.getPixelInformation(n,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;n<=a[1]+t;++n){if(s[1]=n,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let n=a[0]>=t?a[0]-(t-1):0;n<=a[0]+(t-1);++n){if(s[0]=n,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=n[0],o[1]=n[1],null},e.generateSelection=(n,r,o,i)=>{const a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let n=s;n<=u;n++)for(let r=a;r<=l;r++){const o=[r,n],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=Jm(i);if(c.has(e)){const n=c.get(e);n.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,n)=>{t._openGLRenderWindow=e,t._renderer=n};const n=e.setArea;e.setArea=function(){return!!n(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}const ig={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function ag(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),Gm.extend(e,t,n),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),gt.setGetArray(e,t,["area"],4),gt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),gt.setGetArray(e,t,["propColorValue"],3),gt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),gt.event(e,t,"event"),og(e,t)}var sg={newInstance:gt.newInstance(ag,"vtkOpenGLHardwareSelector"),extend:ag,...cm},lg=n(594),ug=n.n(lg);const cg=["lastShaderProgramBound","context","_openGLRenderWindow"];function dg(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,n,r)=>{let o=n;r.length>0&&(o=Ca.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=Ca.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=Ca.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=Ca.substitute(l,"varying","out").result,o=Ca.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=Ca.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=Ca.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:Ca.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,n,r)=>{const o=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,n,r)=>{const o=`${e}${n}${r}`,i=ug().hash(o);if(!(i in t.shaderPrograms)){const o=Ca.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=n=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map((e=>t.shaderPrograms[e])).forEach((e=>e.cleanup())),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}const pg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function fg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pg,n),t.shaderPrograms={},gt.obj(e,t),gt.setGet(e,t,cg),gt.moveToProtected(e,t,["openGLRenderWindow"]),dg(e,t)}var hg={newInstance:gt.newInstance(fg,"vtkShaderCache"),extend:fg};const{vtkErrorMacro:mg}=gt;function gg(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==n){if(0!==t.context&&e.deleteTable(),t.context=n,t.context){t.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let n=0;ne.isAllocated(n)?-1:(t.textureUnits[n]=!0,n),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,n),gt.obj(e,t),t.textureUnits=[],gt.get(e,t,["numberOfTextureUnits"]),gt.setGet(e,t,["context"]),gg(e,t)}var bg={newInstance:gt.newInstance(yg,"vtkOpenGLTextureUnitManager"),extend:yg};function xg(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const n=e.getViewportByReference();return t.size[0]*(n[2]-n[0])/((n[3]-n[1])*t.size[1])},e.isInViewport=(t,n,r)=>{const o=r.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=n&&o[3]*i[1]>=n},e.getViewportSize=t=>{const n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=t=>{const n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t/o[0],n/o[1],r]},e.normalizedDisplayToDisplay=(t,n,r)=>{const o=e.getFramebufferSize();return[t*o[0],n*o[1],r]},e.worldToView=(e,t,n,r)=>r.worldToView(e,t,n),e.viewToWorld=(e,t,n,r)=>r.viewToWorld(e,t,n),e.worldToDisplay=(t,n,r,o)=>{const i=o.worldToView(t,n,r),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,n,r,o)=>{const i=e.displayToNormalizedDisplay(t,n,r),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,n,r);return[a[0]-i[0]-.5,a[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=(t,n,r,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),n*(i[1]-1),r]},e.displayToLocalDisplay=(t,n,r)=>[t,e.getFramebufferSize()[1]-n-1,r],e.viewportToNormalizedDisplay=(t,n,r,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(a,s,r)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{gt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,n,r)=>{gt.vtkErrorMacro("not implemented")},e.createSelector=()=>{gt.vtkErrorMacro("not implemented")}}const _g={size:void 0,selector:void 0};function Tg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_g,n),t.size||(t.size=[300,300]),gt.getArray(e,t,["size"],2),gt.get(e,t,["selector"]),Tt.extend(e,t,n),xg(e,t)}var Sg={newInstance:gt.newInstance(Tg,"vtkRenderWindowViewNode"),extend:Tg};const{vtkDebugMacro:wg,vtkErrorMacro:Cg}=gt,Ag={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function Eg(e,t,n){const r=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,n,null),e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let Dg=0;const Ig=[];function Pg(){Dg++,Ig.forEach((e=>e(Dg)))}function Og(){Dg--,Ig.forEach((e=>e(Dg)))}function Ng(e){e.preventDefault()}function Mg(e,t){t.classHierarchy.push("vtkOpenGLRenderWindow");const n=function(){const e=new Map,t={apply:(t,n,r)=>e.has(r[0])?e.get(r[0]):t.apply(n,r)},n=Object.create(null);return n.getParameter=(e,n,r,o)=>new Proxy(o.bind(e),t),n.depthMask=(t,n,r,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,n,r)=>(e.set(i,r[0]),t.apply(n,r))}));var i},{get(e,t,r){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=n[t];return i?i(e,t,r,o):o}}}();e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Ng,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const r=[0,0];let o;e.onModified((function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach((t=>{t.setOpenGLRenderWindow(e)}))}},e.initialize=()=>{if(!t.initialized){t.context=e.get3DContext(),t.textureUnitManager=bg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const n=t.context;n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.depthFunc(n.LEQUAL),n.enable(n.BLEND),t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.activeFramebuffer?t.activeFramebuffer.getSize():t.size,e.getPixelData=(e,n,r,o)=>{const i=new Uint8Array((r-e+1)*(o-n+1)*4);return t.context.readPixels(e,n,r-e+1,o-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},r=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(r=t.canvas.getContext("webgl2",e),r&&(t.webgl2=!0,wg("using webgl2"))),r||(wg("using webgl1"),r=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),new Proxy(r,n)},e.restoreContext=()=>{const t=Cm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=n=>{const r=t._textureResourceIds.get(n);if(void 0!==r)return void t.context.activeTexture(t.context.TEXTURE0+r);const o=e.getTextureUnitManager().allocate();o<0?Cg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(n,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=n=>{const r=t._textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t._textureResourceIds.delete(n))},e.getTextureUnitForTexture=e=>{const n=t._textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureByteSize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case on.CHAR:case on.SIGNED_CHAR:case on.UNSIGNED_CHAR:return 1;case n:case r:case on.UNSIGNED_SHORT:case on.SHORT:case on.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case on.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case r&&!o&&on.UNSIGNED_SHORT:switch(n){case 1:return r.R16_EXT;case 2:return r.RG16_EXT;case 3:return r.RGB16_EXT;default:return r.RGBA16_EXT}case r&&!o&&on.SHORT:switch(n){case 1:return r.R16_SNORM_EXT;case 2:return r.RG16_SNORM_EXT;case 3:return r.RGB16_SNORM_EXT;default:return r.RGBA16_SNORM_EXT}default:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=Ag,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=n[1],n[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const n=e.get3DContext(),r=n.getExtension("OES_texture_float"),o=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),a=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Eg(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Eg(n,n.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Eg(n,n.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Eg(n,n.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Eg(n,n.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Eg(n,n.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Eg(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Eg(n,n.RGB,n.FLOAT)?"RGB":"",r&&Eg(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Eg(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Eg(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?n.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
    \t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,n]=l.pop();t&&(u[t]={label:e,value:n})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect(),a=t.renderable;a.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=sg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=gt.chain((function(){t.canvas.removeEventListener("webglcontextlost",Ng),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)}),e.delete,e.setViewStream,Og),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,n)=>{const r=i(t,n);return r&&e.invokeWindowResizeEvent({width:t,height:n}),r},e.getGraphicsResourceForObject=e=>e?{vtkObj:t._graphicsResources.get(e),hash:t._graphicsResourceHash.get(e)}:null,e.setGraphicsResourceForObject=(e,n,r)=>{e&&(t._graphicsResources.set(e,n),t._graphicsResourceHash.set(e,r))},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(((t,n)=>{e+=t.getAllocatedGPUMemoryInBytes()})),e},e.releaseGraphicsResourcesForObject=n=>!!n&&(t._graphicsResources.get(n)?.releaseGraphicsResources(e),t._graphicsResources.delete(n)&&t._graphicsResourceHash.delete(n)),e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(((t,n)=>{t.releaseGraphicsResources(e)})),t._graphicsResources.clear(),t._graphicsResourceHash.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach((t=>{e.getViewNodeFor(t)?.releaseGraphicsResources()}))}}const Rg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};const Fg=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rg,n),Sg.extend(e,t,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",Pg(),t.selector||(t.selector=sg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._graphicsResourceHash=new Map,t._glInformation=null,t.myFactory=Nt.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Fg),t.shaderCache=hg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=km.newInstance(),gt.event(e,t,"imageReady"),gt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer"]),gt.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),Mg(e,t)}),"vtkOpenGLRenderWindow");If("WebGL",Fg);const kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"];function Lg(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let n=0;n{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const n=e.getPipelineDescription();if(t.colorTextureViews.length!==n.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${n.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,n)=>{t.colorTextureViews[e]!==n&&(t.colorTextureViews[e]=n)},e.activateBindGroup=e=>{const n=t.boundPipeline.getDevice(),r=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(r,e.getBindGroup(n));const o=n.getBindGroupLayoutDescription(e.getBindGroupLayout(n)),i=n.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(r));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bg,n),je(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(n)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],He(e,t,["boundPipeline","colorTextureViews"]),$e(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),Lg(e,t)}var Ug={newInstance:rt(Vg,"vtkWebGPURenderEncoder"),extend:Vg};function Gg(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,n)=>{t.texture=e,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=r.sampleType},e.createFromTextureHandle=(e,n)=>{t.texture=null,t.options=n,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const r=Hl(n.format);t.bindGroupLayoutEntry.texture.sampleType=r.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,n)=>{let r="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?r="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(r="u32");let o=`@binding(${e}) @group(${n}) var ${t.label}: texture_${t.options.dimension}<${r}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${n}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(n,r)=>{const o=vc.newInstance({label:`${t.label}Sampler`});o.create(n,r),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}const zg={texture:null,handle:null,sampler:null,label:null};function jg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,n),gt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},gt.obj(t.bindGroupTime,{mtime:0}),gt.get(e,t,["bindGroupTime","texture"]),gt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),Gg(e,t)}var Wg={newInstance:gt.newInstance(jg),extend:jg};function Hg(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=n=>{t.jsImageData!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null),t.jsImageData=n,t.imageLoaded=!0,e.modified())},e.setCanvas=n=>{t.canvas!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.jsImageData=null),t.canvas=n,e.modified())},e.setImage=n=>{t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let n=0,r=0,o=1;if(e.getInputData()){const t=e.getInputData();n=t.getDimensions()[0],r=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(n=t.jsImageData.width,r=t.jsImageData.height),t.canvas&&(n=t.canvas.width,r=t.canvas.height),t.image&&(n=t.image.width,r=t.image.height),(n>1)+(r>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData();if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=document.createElement("canvas");e.width=t.image.width,e.height=t.image.height;const n=e.getContext("2d");return n.translate(0,e.height),n.scale(1,-1),n.drawImage(t.image,0,0,t.image.width,t.image.height),n.getImageData(0,0,e.width,e.height)}return null}}const Xg={image:null,canvas:null,jsImageData:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,n),gt.obj(e,t),gt.algo(e,t,6,0),gt.get(e,t,["canvas","image","jsImageData","imageLoaded","resizable"]),gt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),Hg(e,t)}const qg={generateMipmaps:(e,t,n,r)=>{const o=[1,2,1],i=e.length/(t*n);let a=t,s=n,l=e;const u=[l];for(let e=0;ei&&(c+=t),d<-i&&(c-=t),r[c]?u+=r[c]*o[l]:s-=o[l],a+=1}l[e+n]=u/s}r=[...l];for(let e=0;e{t.device=e,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1;const r=1===t.depth?"2d":"3d";t.format=n.format?n.format:"rgba8unorm",t.mipLevel=n.mipLevel?n.mipLevel:0,t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:r,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,n,r)=>{t.device=e,t.handle=n,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1,t.format=r.format?r.format:"rgba8unorm",t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=n=>{let r=[];if(n.canvas)return t.device.getHandle().queue.copyExternalImageToTexture({source:n.canvas,flipY:n.flip},{texture:t.handle,premultipliedAlpha:!0},[t.width,t.height,t.depth]),void(t.ready=!0);n.jsImageData&&!n.nativeArray&&(n.width=n.jsImageData.width,n.height=n.jsImageData.height,n.depth=1,n.format="rgba8unorm",n.flip=!0,n.nativeArray=n.jsImageData.data);const o=Hl(t.format);let i=t.width*o.stride;const a=(e,t,n)=>{const r=e.length/(t*n)*e.BYTES_PER_ELEMENT,i=2===o.elementSize&&"float"===o.sampleType;if(i||r%256){const a=e,s=r/a.BYTES_PER_ELEMENT,l=o.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=gt.newTypedArray(i?"Uint16Array":a.constructor.name,c*t*n);for(let e=0;e{const e=Hl(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Hl(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&n===t.height&&r===t.depth||(t.width=e,t.height=n,t.depth=r,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.dimension||(r.dimension=1===t.depth?"2d":"3d");const o=Wg.newInstance({label:n});return o.create(e,r),o}}const Qg={device:null,handle:null,buffer:null,ready:!1,label:null};function Zg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qg,n),gt.obj(e,t),gt.get(e,t,["handle","ready","width","height","depth","format","usage"]),gt.setGet(e,t,["device","label"]),Jg(e,t)}var ev={newInstance:gt.newInstance(Zg),extend:Zg};function tv(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.renderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resize(r.getCanvas().width,r.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,n),t.depthFormat="depth32float",t.depthTexture=ev.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),n.setRenderEncoder(t.renderEncoder),n.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=Ug.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}const nv={renderEncoder:null,colorTexture:null,depthTexture:null};function rv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),tv(e,t)}var ov={newInstance:gt.newInstance(rv,"vtkWebGPUOpaquePass"),extend:rv};function iv(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r;const o=r.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=ev.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,n),t.translucentAccumulateTexture=ev.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=du.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),n.setRenderEncoder(t.translucentRenderEncoder),n.traverse(e),e.finalPass(r,n)},e.finalPass=(e,n)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),n.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=Ug.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(n)})),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcfactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=Ug.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}const av={colorTextureView:null,depthTextureView:null};function sv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,av,n),Cm.extend(e,t,n),gt.setGet(e,t,["colorTextureView","depthTextureView"]),iv(e,t)}var lv={newInstance:gt.newInstance(sv,"vtkWebGPUOrderIndependentTranslucentPass"),extend:sv};const uv="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",cv=new Float64Array(16),dv=new Float64Array(16);function pv(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,n)=>{const r=t.getShaderDescription("vertex");r.addBuiltinOutput("vec4","@builtin(position) Position");let o=r.getCode();o=Fl.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,r.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,n,r)=>{const o=n.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Fl.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Fl.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Fl.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let r=e.getMTime();for(let e=0;e{let r=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(n),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),g=new Float64Array(t.numRows),v=new Float64Array(t.numRows),_=new Float64Array(t.numRows),T=new Float64Array(t.numRows),S=new Float64Array(t.numRows),w=new Float64Array(t.numRows);let C=0;for(let e=0;e{n();let r=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r{const e=r();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}const fv={volumes:null,rowLength:1024,lastVolumeLength:0};function hv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fv,n),du.extend(e,t,n),t.fragmentShaderTemplate=uv,t.UBO=ac.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=ec.newInstance({label:"volumeSSBO"}),t.componentSSBO=ec.newInstance({label:"componentSSBO"}),t.lutBuildTime={},gt.obj(t.lutBuildTime,{mtime:0}),pv(e,t)}var mv={newInstance:gt.newInstance(hv,"vtkWebGPUVolumePassFSQ"),extend:hv};const{Representation:gv}=wu,{BufferUsage:vv,PrimitiveTypes:yv}=qu,bv=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],xv="\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n";function _v(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=n=>{t._clearEncoder||e.createClearEncoder(n),t._mergeEncoder||e.createMergeEncoder(n),t._copyEncoder||e.createCopyEncoder(n),t._depthRangeEncoder||e.createDepthRangeEncoder(n),t.fullScreenQuad||(t.fullScreenQuad=mv.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=du.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(n.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=ac.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=r,e.initialize(r),e.computeTiming(r),e.renderDepthBounds(n,r),t._firstGroup=!0;const o=r.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=n.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]));let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(r,n,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(r,n,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(n),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),n=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/n])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=gt.chain((()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)}),e.delete),e.computeTiming=e=>{const n=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,n.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=n.onAnimationFrameRateUpdate((()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=n.getRecentAnimationFrameRate(),r=t._lastScale*n.getDesiredUpdateRate()/e;t._lastScale=r,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)})))},e.rayCastPass=(e,n,r)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const n=e.getCanvas(),r=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(r*n.width),t._smallViewportHeight=Math.ceil(r*n.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(n),t.fullScreenQuad.setVolumes(r),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(n,r)=>{e.updateDepthPolyData(n);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:vv.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:yv.Triangles,representation:gv.SURFACE};const l=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:vv.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=r.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(n,r)},e.updateDepthPolyData=e=>{let n=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),n.setRenderEncoder(t._depthRangeEncoder),n.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(n),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),n.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const n=e.getDevice();t._depthRangeEncoder=Ug.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(n)})),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcfactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcfactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=ev.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,r),t._depthRangeTexture2=ev.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(n,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=ev.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=Ug.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=Ug.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=Ug.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(n)})),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=n=>{if(!t.volumes||t.volumes.length!==n.length)return t.volumes=[...n],void e.modified();for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tv,n),Cm.extend(e,t,n),t._mapper=su.newInstance(),t._mapper.setFragmentShaderTemplate(xv),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",((e,t,n)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")})),t._boundsPoly=ji.newInstance(),t._lastMTimes=[],gt.setGet(e,t,["colorTextureView","depthTextureView"]),_v(e,t)}var wv={newInstance:gt.newInstance(Sv,"vtkWebGPUVolumePass"),extend:Sv};function Cv(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e),t.opaquePass||(t.opaquePass=ov.newInstance());const o=n.getRenderable().getNumberOfLayers(),i=n.getChildren();for(let r=0;r0&&(t.translucentPass||(t.translucentPass=lv.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,n)),t.volumes.length>0&&(t.volumePass||(t.volumePass=wv.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,n)),e.finalPass(n,a))}},e.finalPass=(n,r)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(n),t._finalBlitOutputTextureView.createFromTextureHandle(n.getCurrentTexture(),{depth:1,format:n.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=Ug.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcfactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=vc.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=du.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Wg.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}const Av={opaqueActorCount:0,translucentActorCount:0,volumes:null,opaqueRenderEncoder:null,translucentPass:null,volumePass:null};function Ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Cm.extend(e,t,n),gt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),Cv(e,t)}var Dv={newInstance:gt.newInstance(Ev,"vtkForwardPass"),extend:Ev};const{VtkDataTypes:Iv}=Wr;function Pv(e,t){function n(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Iv.UNSIGNED_CHAR:e.format+="8unorm";break;case Iv.FLOAT:case Iv.UNSIGNED_INT:case Iv.INT:case Iv.DOUBLE:case Iv.UNSIGNED_SHORT:case Iv.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm"),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT)}function r(e){const n=ev.newInstance();return n.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas)&&n.writeImageData(e),n}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getTextureForImageData=e=>{const r={time:e.getMTime()};return r.imageData=e,n(r),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)},e.getTextureForVTKTexture=e=>{const r={time:e.getMTime()};return e.getInputData()?r.imageData=e.getInputData():e.getImage()?r.image=e.getImage():e.getJsImageData()?r.jsImageData=e.getJsImageData():e.getCanvas()&&(r.canvas=e.getCanvas()),n(r),r.mipLevel=e.getMipLevel(),r.hash=r.time+r.format+r.mipLevel,t.device.getTextureManager().getTexture(r)}}const Ov={handle:null,device:null};function Nv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ov,n),gt.obj(e,t),gt.setGet(e,t,["device"]),Pv(e,t)}var Mv={newInstance:gt.newInstance(Nv),extend:Nv};class Rv extends Map{constructor(){super(),this.registry=new FinalizationRegistry((e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)}))}getValue(e){const t=super.get(e);if(t){const n=t.deref();if(void 0!==n)return n;super.delete(e)}}setValue(e,t){let n;return t&&"object"==typeof t&&(n=new WeakRef(t),this.registry.register(t,e),super.set(e,n)),n}}function Fv(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let n=0;ne in t.pipelines?t.pipelines[e]:null,e.createPipeline=(n,r)=>{r.initialize(e,n),t.pipelines[n]=r},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,n){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const r=t.objectCache.getValue(e);if(r)return r;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kv,n),je(e,t),$e(e,t,["handle"]),He(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Rv,t.shaderCache=Fl.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=qu.newInstance(),t.bufferManager.setDevice(e),t.textureManager=Mv.newInstance(),t.textureManager.setDevice(e),t.pipelines={},Fv(e,t)}var Bv={newInstance:rt(Lv,"vtkWebGPUDevice"),extend:Lv};function Vv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(n,r)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),n.traverse(e);const o=n.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=ev.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,r),t.depthTexture=ev.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),r.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),r.traverse(e),e.setCurrentOperation("opaquePass"),r.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=Ug.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction((e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let n=t.getCode();n=Fl.substitute(n,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(n)})),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}const Uv={selectionRenderEncoder:null,colorTexture:null,depthTexture:null};function Gv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),Cm.extend(e,t,n),gt.get(e,t,["colorTexture","depthTexture"]),Vv(e,t)}var zv={newInstance:gt.newInstance(Gv,"vtkWebGPUHardwareSelectionPass"),extend:Gv};const{SelectionContent:jv,SelectionField:Wv}=Hm,{FieldAssociations:Hv}=di,{vtkErrorMacro:Xv}=gt;function Kv(e){return`${e.propID} ${e.compositeID}`}function qv(e,t,n,r){const o=4*((n.height-t-1)*n.colorBufferWidth+e)+r;return n.colorValues[o]}function $v(e,t,n,r){const o=n<0?0:n;if(0===o){if(r[0]=t[0],r[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const n=qv(t[0],t[1],e,0);if(n<=0)return null;const o={};o.propID=n;let i=qv(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const n=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[n],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=$v(e,t,0,r);if(s)return s;for(let t=1;tt?i[1]-t:0;n<=i[1]+t;++n){if(a[1]=n,i[0]>=t&&(a[0]=i[0]-t,s=$v(e,a,0,r),s))return s;if(a[0]=i[0]+t,s=$v(e,a,0,r),s)return s}for(let n=i[0]>=t?i[0]-(t-1):0;n<=i[0]+(t-1);++n){if(a[0]=n,i[1]>=t&&(a[1]=i[1]-t,s=$v(e,a,0,r),s))return s;if(a[1]=i[1]+t,s=$v(e,a,0,r),s)return s}}return r[0]=t[0],r[1]=t[1],null}function Yv(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return Xv("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise((e=>{t._WebGPURenderWindow.onInitialized(e)})));const n=t._WebGPURenderWindow.getViewNodeFor(e);if(!n)return!1;const r=n.getSuppressClear();n.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,n),n.setSuppressClear(r);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:n,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=vu.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=vu.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,n,r)=>function(e,t,n,r,o){const i=Math.floor(t),a=Math.floor(n),s=Math.floor(r),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let n=i;n<=s;n++){const r=$v(e,[n,t],0,c);if(r){const t=Kv(r);if(u.has(t)){const n=u.get(t);n.pixelCount++,e.captureZValues&&r.zValue{const a=Hm.newInstance();switch(a.setContentType(jv.INDICES),e){case Hv.FIELD_ASSOCIATION_CELLS:a.setFieldType(Wv.CELL);break;case Hv.FIELD_ASSOCIATION_POINTS:a.setFieldType(Wv.POINT);break;default:Xv("Unknown field association")}a.getProperties().propID=t.info.propID;const s=n.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,n.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=n.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n.renderer)),a.setSelectionList(t.attributeIDs),r[o]=a,o++})),r}(e.fieldAssociation,u,e)}(s,e,t,n,r),s}}const Jv={};function Qv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jv,n),Gm.extend(e,t,n),t._selectionPass=zv.newInstance(),gt.setGet(e,t,["_WebGPURenderWindow"]),gt.moveToProtected(e,t,["WebGPURenderWindow"]),Yv(e,t)}var Zv={newInstance:gt.newInstance(Qv,"vtkWebGPUHardwareSelector"),extend:Qv};const{vtkErrorMacro:ey}=gt,ty={position:"absolute",top:0,left:0,width:"100%",height:"100%"};function ny(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const n=[0,0];e.onModified((function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null})),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=n=>{if(n){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void ey("WebGPU is not enabled.");e.create3DContextAsync().then((()=>{t.initialized=!0,t.deleted||e.invokeInitialized()}))}},e.setContainer=n=>{t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&ey("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:n}=t.el.getBoundingClientRect();t.containerSize=[e,n]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Bv.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const n=Cm.newInstance();n.setCurrentOperation("Release"),n.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:r=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=n;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map((e=>e*i)):null},new Promise(((n,o)=>{const i=e.onImageReady((o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach((e=>{let{restoreParamsFn:t,arg:n}=e;return t(n)})),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),n(o);else{const n=document.createElement("img");if(n.style=ty,n.src=o,t._screenshot.placeHolder=t.el.appendChild(n),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),r){const e=!0!==r;t._screenshot.cameras=t.renderable.getRenderers().map((t=>{const n=t.getActiveCamera(),o=n.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?r:t.resetCamera,restoreParamsFn:n.set,arg:JSON.parse(JSON.stringify(o))}})),t._screenshot.cameras.forEach((e=>{let{resetCameraFn:t,resetCameraArgs:n}=e;return t(n)}))}e.traverseAllPasses()}}))}))},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let n=0;n{!async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const r=document.createElement("canvas"),o=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect(),l=t.renderable;l.getRenderers().forEach((e=>{e.getViewProps().forEach((e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()}))}},e.setViewStream=n=>t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady((t=>e.setBackgroundImage(t.image))),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let n=0;n{const e=t.device,n=t.renderPasses[0].getOpaquePass().getColorTexture(),r={width:n.getWidth(),height:n.getHeight()};r.colorBufferWidth=32*Math.floor((r.width+31)/32),r.colorBufferSizeInBytes=r.colorBufferWidth*r.height*8;const o=vu.newInstance();o.setDevice(e),o.create(r.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:n.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*r.colorBufferWidth,rowsPerImage:r.height},{width:r.width,height:r.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,r.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(r.height*r.width*4);for(let e=0;e{const t=Zv.newInstance();return t.setWebGPURenderWindow(e),t};const r=e.setSize;e.setSize=(t,n)=>{const o=r(t,n);return o&&e.invokeWindowResizeEvent({width:t,height:n}),o},e.delete=gt.chain(e.delete,e.setViewStream)}const ry={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const oy=gt.newInstance((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ry,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Sg.extend(e,t,n),t.myFactory=xl.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",oy),t.renderPasses[0]=Dv.newInstance(),t.selector||(t.selector=Zv.newInstance(),t.selector.setWebGPURenderWindow(e)),gt.event(e,t,"imageReady"),gt.event(e,t,"initialized"),gt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),gt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),gt.setGetArray(e,t,["size"],2),gt.event(e,t,"windowResizeEvent"),ny(e,t)}),"vtkWebGPURenderWindow");If("WebGPU",oy);const iy=bh(),ay={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},sy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function ly(e,t){Object.keys(t).forEach((n=>{e.style[n]=t[n]}))}function uy(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const n=document.querySelector("body");t.rootContainer||(t.rootContainer=n),t.container||(t.container=document.createElement("div"),ly(t.container,t.containerStyle||ay),t.rootContainer.appendChild(t.container)),t.rootContainer===n&&(document.documentElement.style.height="100%",n.style.height="100%",n.style.padding="0",n.style.margin="0"),t.renderWindow=Rf.newInstance(),t.renderer=Ef.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(iy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=Qf.newInstance(),t.interactor.setInteractorStyle(gh.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=n=>{t.controlContainer=document.createElement("div"),ly(t.controlContainer,t.controlPanelStyle||sy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",(t=>{"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}))},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach((e=>{t.renderer.addActor(e)}))},e.removeRepresentation=e=>{e.getActors().forEach((e=>t.renderer.removeActor(e)))},e.delete=gt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=n=>{t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}const cy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function dy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cy,n),gt.obj(e,t),gt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),uy(e,t)}var py={newInstance:gt.newInstance(dy),extend:dy};const fy={HmdVR:0,MobileAR:1,LookingGlassVR:2,HmdAR:3};var hy={XrSessionTypes:fy};const{XrSessionTypes:my}=hy;function gy(e,t){t.classHierarchy.push("vtkWebXRRenderWindowHelper"),e.initialize=e=>{t.initialized||(t.renderWindow=e,t.initialized=!0)},e.getXrSupported=()=>void 0!==navigator.xr,e.startXR=n=>{if(void 0===navigator.xr)throw new Error("WebXR is not available");t.xrSessionType=void 0!==n?n:my.HmdVR;const r=[my.HmdAR,my.MobileAR].includes(t.xrSessionType),o=r?"immersive-ar":"immersive-vr";if(!navigator.xr.isSessionSupported(o))throw r?new Error("Device does not support AR session"):new Error("VR display is not available");if(null!==t.xrSession)throw new Error("XR Session already exists!");navigator.xr.requestSession(o).then(e.enterXR,(()=>{throw new Error("Failed to create XR session!")}))},e.enterXR=async n=>{if(t.xrSession=n,t.initCanvasSize=t.renderWindow.getSize(),null===t.xrSession)throw new Error("Failed to enter XR with a null xrSession.");{const n=t.renderWindow.get3DContext();await n.makeXRCompatible();const{XRWebGLLayer:r}=window,o=new r(t.xrSession,n.__getUnderlyingContext());if(t.renderWindow.setSize(o.framebufferWidth,o.framebufferHeight),t.xrSession.updateRenderState({baseLayer:o}),t.xrSession.requestReferenceSpace("local").then((e=>{t.xrReferenceSpace=e})),[my.HmdAR,my.MobileAR].includes(t.xrSessionType)){const e=t.renderWindow.getRenderable().getRenderers()[0];t.initBackground=e.getBackground(),e.setBackground([0,0,0,0])}e.resetXRScene(),t.renderWindow.getRenderable().getInteractor().switchToXRAnimation(),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender),e.modified()}},e.resetXRScene=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.25,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1.5;const r=t.renderWindow.getRenderable().getRenderers()[0];r.resetCamera();const o=r.getActiveCamera();let i=o.getPhysicalScale();const a=o.getPhysicalTranslation(),s=n*i;i/=e,a[2]+=s,o.setPhysicalScale(i),o.setPhysicalTranslation(a),o.setClippingRange(.1*i,100*i)},e.stopXR=async()=>{if(void 0===navigator.xr)return;if(null!==t.xrSession){t.xrSession.cancelAnimationFrame(t.xrSceneFrame),t.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();const e=t.renderWindow.get3DContext();e.bindFramebuffer(e.FRAMEBUFFER,null),await t.xrSession.end().catch((e=>{if(!(e instanceof DOMException))throw e})),t.xrSession=null}null!==t.initCanvasSize&&t.renderWindow.setSize(...t.initCanvasSize);const n=t.renderWindow.getRenderable().getRenderers()[0];null!=t.initBackground&&(n.setBackground(t.initBackground),t.initBackground=null),n.getActiveCamera().setProjectionMatrix(null),n.resetCamera(),n.setViewport(0,0,1,1),t.renderWindow.traverseAllPasses(),e.modified()},t.xrRender=async(e,n)=>{const r=n.session,o=[my.HmdVR,my.HmdAR].includes(t.xrSessionType);t.renderWindow.getRenderable().getInteractor().updateXRGamepads(r,n,t.xrReferenceSpace),t.xrSceneFrame=t.xrSession.requestAnimationFrame(t.xrRender);const i=n.getViewerPose(t.xrReferenceSpace);if(i){const e=t.renderWindow.get3DContext();t.xrSessionType===my.MobileAR&&null!==t.initCanvasSize&&(e.canvas.width=t.initCanvasSize[0],e.canvas.height=t.initCanvasSize[1]);const n=r.renderState.baseLayer;e.bindFramebuffer(e.FRAMEBUFFER,n.framebuffer),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.DEPTH_BUFFER_BIT),t.renderWindow.setSize(n.framebufferWidth,n.framebufferHeight);const a=t.renderWindow.getRenderable().getRenderers()[0];i.views.forEach(((e,r)=>{const i=n.getViewport(e);if(o)if("left"===e.eye)a.setViewport(0,0,.5,1);else{if("right"!==e.eye)return;a.setViewport(.5,0,1,1)}else if(t.xrSessionType===my.LookingGlassVR){const e=i.x/n.framebufferWidth,t=i.y/n.framebufferHeight,r=(i.x+i.width)/n.framebufferWidth,o=(i.y+i.height)/n.framebufferHeight;a.setViewport(e,t,r,o)}else a.setViewport(0,0,1,1);a.getActiveCamera().computeViewParametersFromPhysicalMatrix(e.transform.inverse.matrix),a.getActiveCamera().setProjectionMatrix(e.projectionMatrix),t.renderWindow.traverseAllPasses()})),e.scissor(0,0,n.framebufferWidth,n.framebufferHeight),e.disable(e.SCISSOR_TEST)}},e.delete=gt.chain(e.delete)}const vy={initialized:!1,initCanvasSize:null,initBackground:null,renderWindow:null,xrSession:null,xrSessionType:0,xrReferenceSpace:null};function yy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vy,n),gt.obj(e,t),gt.event(e,t,"event"),gt.get(e,t,["xrSession"]),gt.setGet(e,t,["renderWindow"]),gy(e,t)}var by={newInstance:gt.newInstance(yy,"vtkWebXRRenderWindowHelper"),extend:yy};const{vtkErrorMacro:xy,vtkDebugMacro:_y}=gt;let Ty=0;function Sy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const wy={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(((o,i)=>{let a=null;a=n.ref.url?n.ref.url:[t,n.ref.basepath,r.compression?`${n.ref.id}.gz`:n.ref.id].join("/");const s=Sy("GET",a,r);s.onreadystatechange=t=>{1===s.readyState&&(n.ref.pending=!0,1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0)),4===s.readyState&&(n.ref.pending=!1,200===s.status||0===s.status?(n.buffer=s.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=xd(vd(new Uint8Array(n.buffer))):n.buffer=vd(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(_y(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&xy(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:s,e:t}))},s.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",s.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(JSON.parse(xd(vd(new Uint8Array(i.response))))):r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${n.compression}`)),new Promise(((r,o)=>{const i=Sy("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++Ty&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--Ty&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n.compression?r(xd(vd(new Uint8Array(i.response)))):r(i.responseText):o({xhr:i,e:t}))},i.responseType=n.compression?"arraybuffer":"text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t&&t.compression&&"gz"!==t.compression&&(xy("Supported algorithms are: [gz]"),xy(`Unkown compression algorithm: ${t.compression}`)),new Promise(((n,r)=>{const o=Sy("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?t.compression?n(vd(new Uint8Array(o.response)).buffer):n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};Ld("http",(e=>wy));const Cy={CLAMP:0,REPEAT:1,MIRROR:2},Ay={NEAREST:0,LINEAR:1,CUBIC:2};var Ey={ImageBorderMode:Cy,InterpolationMode:Ay};const Dy={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:Cy.CLAMP,interpolationMode:Ay.LINEAR,extraInfo:null},Iy={...Dy,positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null};function Py(e){const t=Math.floor(e);return{floored:t,error:e-t}}function Oy(e){return Math.round(e)}function Ny(e,t,n){let r=e<=n?e:n;return r-=t,r=r>=0?r:0,r}function My(e,t,n){const r=n-t+1;let o=e-t;return o%=r,o=o>=0?o:o+r,o}function Ry(e,t,n){const r=n-t,o=2*r+(0===r?1:0);let i=e-t;return i=i>=0?i:-i,i%=o,i=i<=r?i:o-i,i}const{ImageBorderMode:Fy}=Ey;function ky(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=n=>{e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=()=>{t.scalars=null},e.update=()=>{if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();const n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),o=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2;for(let e=0;e<3;++e){const n=Math.max(.5*(t.extent[2*e]===t.extent[2*e+1]),t.tolerance);t.structuredBounds[2*e]=Math.max(t.extent[2*e]-n,o),t.structuredBounds[2*e+1]=Math.min(t.extent[2*e+1]+n,i)}const a=t.extent[1]-t.extent[0]+1,s=t.extent[3]-t.extent[2]+1,l=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=l,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*a,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*s;let u=t.componentOffset;u=u>0?u:0,u=u{},e.interpolateXYZ=(n,r,o,i)=>{let a=t.outValue;const s=[n,r,o],l=[(s[0]-t.origin[0])/t.spacing[0],(s[1]-t.origin[1])/t.spacing[1],(s[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(l)){const n={...t.interpolationInfo},r=n.increments[0]-t.componentOffset,o=1;let s=i>0?i:0;s=s{const o=[(n[0]-t.origin[0])/t.spacing[0],(n[1]-t.origin[1])/t.spacing[1],(n[2]-t.origin[2])/t.spacing[2]];if(e.checkBoundsIJK(o))return e.interpolatePoint(t.interpolationInfo,o,r),!0;for(let e=0;e{const n=Math.min(Math.max(t.componentOffset,0),e-1),r=t.componentCount0?r:e-n},e.getNumberOfComponents=()=>t.interpolationInfo.numberOfComponents,e.interpolateIJK=(n,r)=>{e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=e=>!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5]),e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=(e,t,n)=>{},e.FreePrecomputedWeights=e=>{},e.interpolatePoint=(e,t,n)=>{},e.interpolateRow=(e,t,n,r,o,i)=>{}}const Ly={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:Fy.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:{...Dy},interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function By(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ly,n),gt.obj(e,t),gt.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),gt.get(e,t,["origin","spacing"]),ky(e,t)}var Vy={newInstance:gt.newInstance(By,"vtkAbstractImageInterpolator"),extend:By,...Ey};function Uy(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=e=>{let n=1;t.interpolationMode===Ay.LINEAR?n=2:t.interpolationMode===Ay.CUBIC&&(n=4);const r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(let t=0;t<3;++t){let n=!0;for(let r=0;r<3;++r)n=n&&Number.isInteger(e[4*t+r]);n&&(r[t]=1)}return r},e.internalUpdate=()=>{t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=()=>!0,e.interpolateNearest=(e,t,n)=>{const r=e.extent,o=e.increments,i=e.numberOfComponents;let a=Oy(t[0]),s=Oy(t[1]),l=Oy(t[2]);switch(e.borderMode){case Cy.REPEAT:a=My(a,r[0],r[1]),s=My(s,r[2],r[3]),l=My(l,r[4],r[5]);break;case Cy.MIRROR:a=Ry(a,r[0],r[1]),s=Ry(s,r[2],r[3]),l=Ry(l,r[4],r[5]);break;default:a=Ny(a,r[0],r[1]),s=Ny(s,r[2],r[3]),l=Ny(l,r[4],r[5])}const u=a*o[0]+s*o[1]+l*o[2];for(let t=0;t{const r=e.extent,o=e.increments,i=e.numberOfComponents,a=Py(t[0]),s=Py(t[1]),l=Py(t[2]);let u=a.floored,c=s.floored,d=l.floored;const p=a.error,f=s.error,h=l.error;let m=u+(0!==p),g=c+(0!==f),v=d+(0!==h);switch(e.borderMode){case Cy.REPEAT:u=My(u,r[0],r[1]),c=My(c,r[2],r[3]),d=My(d,r[4],r[5]),m=My(m,r[0],r[1]),g=My(g,r[2],r[3]),v=My(v,r[4],r[5]);break;case Cy.MIRROR:u=Ry(u,r[0],r[1]),c=Ry(c,r[2],r[3]),d=Ry(d,r[4],r[5]),m=Ry(m,r[0],r[1]),g=Ry(g,r[2],r[3]),v=Ry(v,r[4],r[5]);break;default:u=Ny(u,r[0],r[1]),c=Ny(c,r[2],r[3]),d=Ny(d,r[4],r[5]),m=Ny(m,r[0],r[1]),g=Ny(g,r[2],r[3]),v=Ny(v,r[4],r[5])}const y=u*o[0],b=m*o[0],x=c*o[1],_=g*o[1],T=d*o[2],S=v*o[2],w=x+T,C=x+S,A=_+T,E=_+S,D=1-p,I=1-f,P=1-h,O=I*P,N=f*P,M=I*h,R=f*h,F=e.pointer;for(let e=0;e{switch(t.interpolationMode){case Ay.LINEAR:e.interpolateLinear(n,r,o);break;case Ay.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateNearest(n,r,o)}},e.interpolateRowNearest=(e,t,n,r,o,i)=>{const a=e.positions[0].subarray(t),s=e.positions[1].subarray(n),l=e.positions[2].subarray(r),u=e.pointer.subarray(s[0]+l[0]),c=e.numberOfComponents;for(let e=0;e{const a=e.kernelSize[0],s=e.kernelSize[1],l=e.kernelSize[2],u=t*a,c=n*s,d=r*l,p=e.weights[0].subarray(u),f=e.weights[1].subarray(c),h=e.weights[2].subarray(d),m=e.positions[0].subarray(u),g=e.positions[1].subarray(c),v=e.positions[2].subarray(d),y=e.pointer,b=e.numberOfComponents,x=g.subarray(v[0]);let _=x,T=x,S=x,w=1,C=0,A=1,E=0;2===s&&(T=g[1].subarray(v[0]),S=T,w=f[0],C=f[1]),2===l&&(_=g[0].subarray(v[1]),S=_,A=h[0],E=h[1]),s+l===4&&(S=g[1].subarray(v[1]));const D=w*A,I=w*E,P=C*A,O=C*E;if(1===a)if(0===C&&0===E)for(let e=i;e>0;--e)for(let t=0;t0;--e)for(let t=0;t0;--e)for(let t=0;t0;--t){const n=p[0+2*e],r=p[1+2*e],a=m[0+2*e],s=m[1+2*e];for(let e=0;e0;--t){const t=p[0+2*e],n=p[1+2*e],r=m[0+2*e],i=m[1+2*e];for(let e=0;e{switch(t.interpolationMode){case Ay.LINEAR:e.interpolateRowLinear(n,r,o,i,a,s);break;case Ay.CUBIC:console.log("CUBIC not implemented");break;default:e.interpolateRowNearest(n,r,o,i,a,s)}},e.vtkTricubicInterpWeights=e=>{const t=e-1,n=.5*e,r=3*e;return[-n*t*t,((r-2)*n-1)*t,-((r-4)*e-1)*n,e*n*t]},e.precomputeWeightsForExtent=(n,r,o)=>{const i={...Iy.newInstance(),...t.interpolationInfo};i.weightType="Float32Array";const a=i.interpolationMode;let s=!0;for(let l=0;l<3;++l){let u;for(u=0;u<3&&0===n[4*l+u];++u);o[2*l]=r[2*l],o[2*l+1]=r[2*l+1];const c=i.extent[2*u],d=i.extent[2*u+1],p=t.structuredBounds[2*u],f=t.structuredBounds[2*u+1];let h=1;h=a1)if(a===Ay.LINEAR)v[h*t+1-y]=_[1]*S,b[h*t-y]=1-g,b[h*t+1-y]=g;else if(a===Ay.CUBIC){const n=e.vtkTricubicInterpWeights(g);if(4===h)for(let e=0;e<4;e++)v[h*t+e-y]=_[e]*S,b[h*t+e-y]=n[e];else{const e=[0,0,0,0];for(let t=0;t<4;t++)e[_[t]-c]+=n[t];for(let n=0;n=p&&r<=f?0===x&&(x=1,o[2*l]=t):1===x&&(x=2,o[2*l+1]=t-1)}(0===x||o[2*l]>o[2*l+1])&&(s=!1)}if(!s)for(let e=0;e<3;e++)o[2*e]=r[2*e],o[2*e+1]=r[2*e]-1}}const Gy={interpolationMode:Ay.NEAREST};function zy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gy,n),Vy.extend(e,t,n),gt.setGet(e,t,["interpolationMode"]),Uy(e,t)}var jy={newInstance:gt.newInstance(zy,"vtkImageInterpolator"),extend:zy};function Wy(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=(e,n,r,o)=>{const i=e.getExtent();let a=n;null==a&&(a=i);let s,l,u,c=!1;for(let e=0;e<6;e+=2)t.extent[e]=Math.max(a[e],i[e]),t.extent[e+1]=Math.min(a[e+1],i[e+1]),t.extent[e]>t.extent[e+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,l=0,u=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(let e=0;e<6;e+=2)t.extent[e]=i[e],t.extent[e+1]=i[e]-1}else s=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,u=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*l;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*l-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*u-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;const e=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,e[3]>=e[2]&&e[5]>=e[4]){t.spanSliceIncrement=e[3]-e[2]+1;const n=t.extent[2]-e[2];n>=0&&(t.spanSliceEndIncrement+=n);const r=e[3]-t.extent[3];r>=0&&(t.spanSliceEndIncrement+=r)}let n=0;const o=t.extent[2]-e[2];o<0?(t.extent[2]=e[2],n-=1):n+=o,e[3]<=t.extent[3]&&(t.extent[3]=e[3]);const i=t.extent[4]-e[4];i<0?(t.extent[4]=e[4],o>=0&&(n-=1+t.spanSliceEndIncrement)):n+=i*t.spanSliceIncrement,e[5]<=t.extent[5]&&(t.extent[5]=e[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(n),t.spanListPointer=r.extentLists.subarray(n),o>=0&&i>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(o){t.algorithm=o;const e=l*u;t.target=e/50+1,t.count=50*t.target-e/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=e=>{let n=!1;const r=t.spanListPointer,o=t.spanCountPointer[0];let i;for(i=0;ie);++i)n=!n;t.spanIndex=i,t.inStencil=n;let a=t.extent[1]+1;i{if(t.spanEnd===t.rowEnd){let n=1;if(t.spanEnd!==t.sliceEnd)t.id=t.rowEnd+t.rowEndIncrement,t.rowEnd+=t.rowIncrement,t.spanEnd=t.rowEnd,t.index[1]++;else{if(t.spanEnd===t.end)return void(t.id=t.end);t.id=t.sliceEnd+t.sliceEndIncrement,t.sliceEnd+=t.sliceIncrement,t.rowEnd=t.id+(t.rowIncrement-t.rowEndIncrement),t.spanEnd=t.rowEnd,t.index[1]=t.startY,t.index[2]++,n+=t.spanSliceEndIncrement}t.index[0]=t.extent[0],t.hasStencil&&(t.index[1]>=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;const e=t.spanCountPointer[0];let n=t.extent[1]+1;if(t.index[0]=n,t.spanIndext.id===t.end,e.isInStencil=()=>t.inStencil,e.spanEndId=()=>t.spanEnd,e.reportProgress=()=>{},e.getArray=(e,t)=>e.getData().subarray(t*e.getNumberOfComponents()),e.getScalars=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}const Hy={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Xy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hy,n),gt.obj(e,t),gt.get(e,t,["id","index"]),Wy(e,t)}var Ky={newInstance:gt.newInstance(Xy,"vtkImagePointDataIterator"),extend:Xy},qy={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}};const{SlabMode:$y}=qy,{vtkErrorMacro:Yy}=gt;function Jy(e,t){t.classHierarchy.push("vtkImageReslice");const n={...e},r=f(new Float64Array(16));let o=null;function i(e,t,n,r){const o=n-1;for(let n=0;n{let e=n.getMTime();return t.resliceTransform&&(e=Math.max(e,t.resliceTransform.getMTime())),e},e.setResliceAxes=n=>(t.resliceAxes||(t.resliceAxes=f(new Float64Array(16))),!te(t.resliceAxes,n)&&(c(t.resliceAxes,n),e.modified(),!0)),e.requestData=(n,i)=>{const a=n[0];if(!a)return void Yy("Invalid or missing input");const s=a.getOrigin(),l=a.getSpacing(),u=a.getDimensions(),c=a.getPointData().getScalars(),d=[0,u[0]-1,0,u[1]-1,0,u[2]-1],p=[0,0,0],h=[1,1,1],g=[0,0,0,0,0,0],v=[0,0,0],b=f(new Float64Array(16));t.resliceAxes&&y(b,b,t.resliceAxes);const x=new Float64Array(16);m(x,b);const _=[s[0]+.5*(d[0]+d[1])*l[0],s[1]+.5*(d[2]+d[3])*l[1],s[2]+.5*(d[4]+d[5])*l[2]];let T=null;t.autoCropOutput&&(T=e.getAutoCroppedOutputBounds(a));for(let e=0;e<3;e++){let n=0,r=0,o=0,i=0;if(t.transformInputSampling){let t=0;for(let a=0;a<3;a++){i+=x[4*a+e]*(_[a]-b[12+a]);const s=b[4*e+a]*b[4*e+a];n+=s*Math.abs(l[a]),r+=s*(d[2*a+1]-d[2*a])*Math.abs(l[a]),o+=s*d[2*a],t+=s}n/=t,r/=t*Math.sqrt(t),o/=t}else i=_[e],n=l[e],r=(d[2*e+1]-d[2*e])*n,o=d[2*e];null==t.outputSpacing?h[e]=n:h[e]=t.outputSpacing[e],e>=t.outputDimensionality?(g[2*e]=0,g[2*e+1]=0):null==t.outputExtent?(t.autoCropOutput&&(r=T[2*e+1]-T[2*e]),g[2*e]=Math.round(o),g[2*e+1]=Math.round(g[2*e]+Math.abs(r/h[e]))):(g[2*e]=t.outputExtent[2*e],g[2*e+1]=t.outputExtent[2*e+1]),e>=t.outputDimensionality?p[e]=0:null==t.outputOrigin?t.autoCropOutput?p[e]=T[2*e]-g[2*e]*h[e]:p[e]=i-.5*(g[2*e]+g[2*e+1])*h[e]:p[e]=t.outputOrigin[e],v[e]=g[2*e+1]-g[2*e]+1}let S=c.getDataType();t.outputScalarType&&(S=t.outputScalarType);const w=a.getPointData().getScalars().getNumberOfComponents(),C=gt.newTypedArray(S,v[0]*v[1]*v[2]*w),A=Wr.newInstance({name:"Scalars",values:C,numberOfComponents:w}),E=qh.newInstance();E.setDimensions(v),E.setOrigin(p),E.setSpacing(h),t.outputDirection&&E.setDirection(t.outputDirection),E.getPointData().setScalars(A),e.getIndexMatrix(a,E);let D=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==o&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(r)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(r,g)&&(D=Ay.NEAREST)),t.interpolator.setInterpolationMode(D);let I=Cy.CLAMP;I=t.wrap?Cy.REPEAT:I,I=t.mirror?Cy.MIRROR:I,t.interpolator.setBorderMode(I);const P=762939453125e-17;let O=.5*t.border;O=I===Cy.CLAMP?O:4294967294,O=O>P?O:P,t.interpolator.setTolerance(O),t.interpolator.initialize(a),e.vtkImageResliceExecute(a,E),t.interpolator.releaseData(),i[0]=E},e.vtkImageResliceExecute=(n,i)=>{const a=n.getPointData().getScalars(),s=i.getPointData().getScalars();let l=s.getData();const u=i.getExtent(),c=r,d=Math.max(t.slabNumberOfSlices,1),p=t.slabSliceSpacingFraction,f=e.isPerspectiveMatrix(c);let h=a.getData();const m=a.getDataType(),g=a.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),b=n.getDimensions(),x=[0,b[0]-1,0,b[1]-1,0,b[2]-1],_=[0,0,0];_[0]=a.getNumberOfComponents(),_[1]=_[0]*b[0],_[2]=_[1]*b[1];const T=b[0]*b[1]*b[2];v>0&&v+g<_[0]&&(h=h.subarray(1*v));let S=Ay.NEAREST;t.interpolator.isA("vtkImageInterpolator")&&(S=t.interpolator.getInterpolationMode());const w=0!==t.scalarShift||1!==t.scalarScale,C=S===Ay.NEAREST&&y===Cy.CLAMP&&!(null!=o||f||w)&&m===s.getDataType()&&T===a.getNumberOfTuples()&&!0===t.border&&d<=1,A=s.getDataType(),E=s.getNumberOfComponents(),D=[0,0,0,0],I=[0,0,0,0],P=[0,0,0,0],O=[0,0,0,0];for(let e=0;e<4;++e)D[e]=c[0+e],I[e]=c[4+e],P[e]=c[8+e],O[e]=c[12+e];let N=null;C||(N=new Float64Array(g*(u[1]-u[0]+d)));const M=gt.newTypedArray(m,t.backgroundColor),R=S>Ay.LINEAR||d>1&&t.slabMode===$y.SUM,F=e.getConversionFunc(m,A,t.scalarShift,t.scalarScale,R),k=e.getSetPixelsFunc(A,1,E,l),L=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration);let B=u[2]-1,V=u[4]-1;const U=[0,0,0,0],G=[0,0,0,0],z=Ky.newInstance();z.initialize(i,u,t.stencil,null);const j=z.getScalars(i,0);let W=0;const H=gt.newTypedArray(A,bf.getDiagonalLength(u)*E*2),X=new Float64Array(g*d),K=new Float64Array(g);for(;!z.isAtEnd();z.nextSpan()){const n=z.spanEndId()-z.getId();if(W=1*z.getId()*E,z.isInStencil()){const r=z.getIndex();r[2]>V&&(V=r[2],U[0]=O[0]+V*P[0],U[1]=O[1]+V*P[1],U[2]=O[2]+V*P[2],U[3]=O[3]+V*P[3],B=u[2]-1),r[1]>B&&(B=r[1],G[0]=U[0]+B*I[0],G[1]=U[1]+B*I[1],G[2]=U[2]+B*I[2],G[3]=U[3]+B*I[3]);const i=r[0],a=i+n-1;if(C){const e=h,t=l,n=1*_[0],r=1*_[1],o=1*_[2],s=x[1]-x[0]+1,u=x[3]-x[2]+1,c=x[5]-x[4]+1;let d=i,p=i-1,f=!1;const m=1*g;for(let t=i;t<=a;t++){const a=[G[0]+t*D[0],G[1]+t*D[1],G[2]+t*D[2]],l=Oy(a[0])-x[0],h=Oy(a[1])-x[2],g=Oy(a[2])-x[4];if(l>=0&&l=0&&h=0&&g1){let e=n-.5*(d-1);e*=p,s[0]=a[0]+e*P[0],s[1]=a[1]+e*P[1],s[2]=a[2]+e*P[2],s[3]=a[3]+e*P[3],h=s}if(f){const e=1/h[3];h[0]*=e,h[1]*=e,h[2]*=e}if(null!==o){const n=t.interpolator.getOrigin(),r=t.interpolator.getSpacing(),i=[1/r[0],1/r[1],1/r[2]];e.applyTransform(o,h,n,i)}if(t.interpolator.checkBoundsIJK(h)){r=1,t.interpolator.interpolateIJK(h,K);for(let e=0;eg&&L(X,g,m/g);for(let e=0;ei?n:r}const h=l-1-(r!==n)-s+1;let m=0;n?(w&&e.rescaleScalars(N,g,a-i+1,t.scalarShift,t.scalarScale),m=F(H,N.subarray(s*g),E,h)):m=k(H,M,E,h);for(let e=0;e{const i=f(new Float64Array(16));return o=null,t.resliceAxes&&c(i,t.resliceAxes),t.resliceTransform&&(t.resliceTransform.isA("vtkHomogeneousTransform")?y(i,t.resliceTransform.getMatrix(),i):Ae("Non homogeneous transform have not yet been ported")),y(i,i,n.getIndexToWorld()),null==o&&y(i,e.getWorldToIndex(),i),c(r,i),r},e.getAutoCroppedOutputBounds=e=>{const n=e.getOrigin(),r=e.getSpacing(),o=e.getDirection(),i=e.getDimensions(),a=[0,i[0]-1,0,i[1]-1,0,i[2]-1],s=new Float64Array(16);t.resliceAxes?m(s,t.resliceAxes):f(s);let l=null;t.resliceTransform&&(l=t.resliceTransform.getInverse());let u=null;Or.isIdentity3x3(o)||(u=Va().translate(n[0],n[1],n[2]).multiply3x3(o).translate(-n[0],-n[1],-n[2]).invert().getMatrix());const c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=[0,0,0,0];for(let e=0;e<8;++e){d[0]=n[0]+a[e%2]*r[0],d[1]=n[1]+a[2+Math.floor(e/2)%2]*r[1],d[2]=n[2]+a[4+Math.floor(e/4)%2]*r[2],d[3]=1,u&&Mo(d,d,u),t.resliceTransform&&l.transformPoint(d,d),Mo(d,d,s);const o=1/d[3];d[0]*=o,d[1]*=o,d[2]*=o;for(let e=0;e<3;++e)d[e]>c[2*e+1]&&(c[2*e+1]=d[e]),d[e]{switch(e){case"Int8Array":return{min:-128,max:127};case"Int16Array":return{min:-32768,max:32767};case"Uint16Array":return{min:0,max:65535};case"Int32Array":return{min:-2147483648,max:2147483647};case"Uint32Array":return{min:0,max:4294967295};case"Float32Array":case"Float64Array":return{min:-12e37,max:12e37};default:return{min:0,max:255}}},e.clamp=(e,t,n,r,o,i)=>{const a=r*n;for(let n=0;n{const o=r*n;for(let n=0;n{let a=i;if(n!==on.FLOAT&&n!==on.DOUBLE&&!i){const i=e.getDataTypeMinMax(t);let s=(i.min+r)*o,l=(i.max+r)*o;const u=e.getDataTypeMinMax(n),c=u.min,d=u.max;if(s>l){const e=l;l=s,s=e}a=sd}if(a&&n!==on.FLOAT&&n!==on.DOUBLE){const t=e.getDataTypeMinMax(n);return(n,r,o,i)=>e.clamp(n,r,o,i,t.min,t.max)}return e.convert},e.set=(e,t,n,r)=>{const o=n*r;for(let n=0;n(e.fill(t[0],0,r),r),e.getSetPixelsFunc=(t,n,r,o)=>1===r?e.set1:e.set,e.getCompositeFunc=(e,t)=>{let n=null;switch(e){case $y.MIN:n=s;break;case $y.MAX:n=l;break;case $y.MEAN:n=t?d:u;break;case $y.SUM:n=t?h:p}return n},e.applyTransform=(e,t,n,r)=>{t[3]=1,Mo(t,t,e),t[0]-=n[0],t[1]-=n[1],t[2]-=n[2],t[0]*=r[0],t[1]*=r[1],t[2]*=r[2]},e.rescaleScalars=(e,t,n,r,o)=>{const i=n*t;for(let t=0;t{for(let t=0;t<3;t++)if(0!==e[4*t+3])return!1;if(1!==e[15])return!1;for(let t=0;t<3;t++){let n=0;for(let r=0;r<3;r++)0!==e[4*t+r]&&n++;if(1!==n)return!1}return!0},e.isIdentityMatrix=e=>{for(let t=0;t<4;++t)for(let n=0;n<4;++n)if((t===n?1:0)!==e[4*n+t])return!1;return!0},e.isPerspectiveMatrix=e=>0!==e[3]||0!==e[7]||0!==e[11]||1!==e[15],e.canUseNearestNeighbor=(e,t)=>{for(let n=0;n<3;n++){let r;for(r=0;r<3&&0===e[4*r+n];r++);if(r>=3)return!1;let o=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=o*t[2*n],o=0);const a=Py(o).error,s=Py(i).error;if(0!==a||0!==s)return!1}return!0}}const Qy={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputDirection:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:Ay.NEAREST,slabMode:$y.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,interpolator:jy.newInstance(),usePermuteExecute:!1};function Zy(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qy,n),gt.obj(e,t),gt.algo(e,t,1,1),gt.setGet(e,t,["outputDimensionality","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","interpolationMode","resliceTransform","slabMode","slabTrapezoidIntegration","slabNumberOfSlices","slabSliceSpacingFraction"]),gt.setGetArray(e,t,["outputOrigin","outputSpacing"],3),gt.setGetArray(e,t,["outputExtent"],6),gt.setGetArray(e,t,["outputDirection"],9),gt.setGetArray(e,t,["backgroundColor"],4),gt.get(e,t,["resliceAxes"]),Jy(e,t)}var eb={newInstance:gt.newInstance(Zy,"vtkImageReslice"),extend:Zy,...qy};const{vtkErrorMacro:tb}=gt;function nb(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=()=>t.nodes.length,e.getType=()=>{let e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(let o=1;on)switch(r){case 0:case 1:r=1;break;default:r=3}else switch(r){case 0:case 2:r=2;break;default:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},e.getDataPointer=()=>{const e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(let n=0;n{if(0===t.nodes.length)return 0;let e=1,n=0,r=0;for(;r0?t.nodes[r-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x,n},e.getNodeValue=(e,n)=>{const r=t.nodes.length;return e<0||e>=r?(tb("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=(n,r)=>{const o=t.nodes.length;if(n<0||n>=o)return tb("Index out of range!"),-1;const i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=(t,n)=>e.addPointLong(t,n,.5,0),e.addPointLong=(n,r,o,i)=>{if(o<0||o>1)return tb("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return tb("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);const a={x:n,y:r,midpoint:o,sharpness:i};let s;for(t.nodes.push(a),e.sortAndUpdateRange(),s=0;s{t.nodes!==n&&(t.nodes=n,e.sortAndUpdateRange())},e.sortAndUpdateRange=()=>{t.nodes.sort(((e,t)=>e.x-t.x)),e.updateRange()||e.modified()},e.updateRange=()=>{const n=t.range.slice(),r=t.nodes.length;return r?(t.range[0]=t.nodes[0].x,t.range[1]=t.nodes[r-1].x):(t.range[0]=0,t.range[1]=0),(n[0]!==t.range[0]||n[1]!==t.range[1])&&(e.modified(),!0)},e.removePoint=n=>{let r;for(r=0;r=t.nodes.length)return-1;const o=r;let i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.removeAllPoints=()=>{t.nodes=[],e.sortAndUpdateRange()},e.addSegment=(n,r,o,i)=>{e.sortAndUpdateRange();for(let e=0;e=n&&t.nodes[e].x<=o?t.nodes.splice(e,1):e++;e.addPoint(n,r,.5,0),e.addPoint(o,i,.5,0)},e.getValue=t=>{const n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=n=>{if(n.length<2)return 0;const r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(let e=0;e=n[0]&&t.nodes[e].x<=n[1]?t.nodes.splice(e,1):++e;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=(t,n)=>{const r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=()=>{const e=t.nodes.length;if(e<2)return-1;let n=t.nodes[1].x-t.nodes[0].x;for(let r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0;const l=t.nodes.length;let u=0;0!==l&&(u=t.nodes[l-1].y);let c=0,d=0,p=0,f=0,h=0,m=0,g=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)s++,s.99999&&(m=.99999));if(s>=l)o[v]=t.clamping?u:0;else if(0===s)o[v]=t.clamping?t.nodes[0].y:0;else{let e=(c-d)/(p-d);if(e=e.99){if(e<.5){o[v]=f;continue}o[v]=h;continue}if(g<.01){o[v]=(1-e)*f+e*h;continue}e<.5?e=.5*(2*e)**(1+10*g):e>.5&&(e=1-.5*(2*(1-e))**(1+10*g));const t=e*e,n=t*e,r=2*n-3*t+1,i=-2*n+3*t,a=n-2*t+e,s=n-t,l=(1-g)*(h-f);o[v]=r*f+i*h+a*l+s*l;const u=fh?f:h;o[v]=o[v]y?y:o[v]}}}}const rb={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function ob(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rb,n),gt.obj(e,t),t.nodes=[],gt.setGet(e,t,["allowDuplicateScalars","clamping"]),gt.setArray(e,t,["range"],2),gt.getArray(e,t,["range"]),nb(e,t)}var ib={newInstance:gt.newInstance(ob,"vtkPiecewiseFunction"),extend:ob};const{InterpolationType:ab,OpacityMode:sb}=nl,{vtkErrorMacro:lb}=gt;function ub(e,t){t.classHierarchy.push("vtkVolumeProperty"),e.getMTime=()=>{let e,n=t.mtime;for(let r=0;r<4;r++)1===t.componentData[r].colorChannels?t.componentData[r].grayTransferFunction&&(e=t.componentData[r].grayTransferFunction.getMTime(),n=n>e?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(e=t.componentData[r].rGBTransferFunction.getMTime(),n=n>e?n:e),t.componentData[r].scalarOpacity&&(e=t.componentData[r].scalarOpacity.getMTime(),n=n>e?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(e=t.componentData[r].gradientOpacity.getMTime(),n=n>e?n:e));return n},e.getColorChannels=e=>e<0||e>3?(lb("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels,e.setGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,o=!0),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,o=!0),o&&e.modified(),o},e.getGrayTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=ib.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=!1;return t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,o=!0),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,o=!0),o&&e.modified(),o},e.getRGBTransferFunction=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=Tp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified(),!0)},e.getScalarOpacity=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=ib.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<0||n>=4)return lb("Invalid index"),!1;const o=Math.min(1,Math.max(0,r));return t.componentData[n].componentWeight!==o&&(t.componentData[n].componentWeight=o,e.modified(),!0)},e.getComponentWeight=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0||e>=4?(lb("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=()=>e.setInterpolationType(ab.NEAREST),e.setInterpolationTypeToLinear=()=>e.setInterpolationType(ab.LINEAR),e.setInterpolationTypeToFastLinear=()=>e.setInterpolationType(ab.FAST_LINEAR),e.getInterpolationTypeAsString=()=>gt.enumToString(ab,t.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`set${r}`]=(r,o)=>t.componentData[r][`${n}`]!==o&&(t.componentData[r][`${n}`]=o,e.modified(),!0)})),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode"].forEach((n=>{const r=gt.capitalize(n);e[`get${r}`]=e=>t.componentData[e][`${n}`]}))}const cb={independentComponents:!0,interpolationType:ab.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1};function db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,cb,n),gt.obj(e,t),!t.componentData){t.componentData=[];for(let e=0;e<4;++e)t.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:sb.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1})}gt.setGet(e,t,["independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity"]),gt.setGetArray(e,t,["labelOutlineThickness"]),ub(e,t)}var pb={newInstance:gt.newInstance(db,"vtkVolumeProperty"),extend:db,...nl};const{vtkDebugMacro:fb}=gt;function hb(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=()=>e,e.makeProperty=pb.newInstance,e.getProperty=()=>(null===t.property&&(t.property=e.makeProperty()),t.property),e.getBounds=()=>{if(null===t.mapper)return t.bounds;const n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||!(r=[n,t.mapperBounds],r[0].map(((e,t)=>r.map((e=>e[t]))))).reduce(((e,t)=>e&&t[0]===t[1]),!0)||e.getMTime()>t.boundsMTime.getMTime()){fb("Recomputing bounds..."),t.mapperBounds=n.map((e=>e));const r=[];bf.getCorners(n,r),e.computeMatrix();const o=new Float64Array(16);h(o,t.matrix),r.forEach((e=>Yt(e,e,o))),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(((e,t)=>t%2==0?r.reduce(((e,n)=>e>n[t/2]?n[t/2]:e),e):r.reduce(((e,n)=>e{let e=t.mtime;if(null!==t.property){const n=t.property.getMTime();e=n>e?n:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),n=t.mapper.getInput().getMTime(),e=n>e?n:e)}return e}}const mb={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function gb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mb,n),Ph.extend(e,t,n),t.boundsMTime={},gt.obj(t.boundsMTime),gt.set(e,t,["property"]),gt.setGet(e,t,["mapper"]),gt.getArray(e,t,["bounds"],6),hb(e,t)}var vb={newInstance:gt.newInstance(gb,"vtkVolume"),extend:gb};const{BlendMode:yb,FilterMode:bb}=ol,xb={createRadonTransferFunction:function(e,t,n,r,o){let i=null;return o?(i=o,i.removeAllPoints()):i=ib.newInstance(),i.addPointLong(-1024,0,1,1),i.addPoint(e,t),i.addPoint(n,r),i}};function _b(e,t){t.classHierarchy.push("vtkVolumeMapper");const n={...e};e.getBounds=()=>{const n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=Dr(),t.bounds},e.update=()=>{e.getInputData()},e.setBlendModeToComposite=()=>{e.setBlendMode(yb.COMPOSITE_BLEND)},e.setBlendModeToMaximumIntensity=()=>{e.setBlendMode(yb.MAXIMUM_INTENSITY_BLEND)},e.setBlendModeToMinimumIntensity=()=>{e.setBlendMode(yb.MINIMUM_INTENSITY_BLEND)},e.setBlendModeToAverageIntensity=()=>{e.setBlendMode(yb.AVERAGE_INTENSITY_BLEND)},e.setBlendModeToAdditiveIntensity=()=>{e.setBlendMode(yb.ADDITIVE_INTENSITY_BLEND)},e.setBlendModeToRadonTransform=()=>{e.setBlendMode(yb.RADON_TRANSFORM_BLEND)},e.getBlendModeAsString=()=>gt.enumToString(yb,t.blendMode),e.setAverageIPScalarRange=(t,n)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),e.setIpScalarRange(t,n)},e.getFilterModeAsString=()=>gt.enumToString(bb,t.filterMode),e.setFilterModeToOff=()=>{e.setFilterMode(bb.OFF)},e.setFilterModeToNormalized=()=>{e.setFilterMode(bb.NORMALIZED)},e.setFilterModeToRaw=()=>{e.setFilterMode(bb.RAW)},e.setGlobalIlluminationReach=e=>n.setGlobalIlluminationReach(xr(e,0,1)),e.setVolumetricScatteringBlending=e=>n.setVolumetricScatteringBlending(xr(e,0,1)),e.setVolumeShadowSamplingDistFactor=e=>n.setVolumeShadowSamplingDistFactor(e>=1?e:1),e.setAnisotropy=e=>n.setAnisotropy(xr(e,-.99,.99)),e.setLAOKernelSize=e=>n.setLAOKernelSize(Sn(xr(e,1,32))),e.setLAOKernelRadius=e=>n.setLAOKernelRadius(e>=1?e:1)}const Tb={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:yb.COMPOSITE_BLEND,ipScalarRange:[-1e6,1e6],filterMode:bb.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,volumeShadowSamplingDistFactor:5,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7};function Sb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tb,n),kh(e,t,n),gt.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","volumeShadowSamplingDistFactor","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius"]),gt.setGetArray(e,t,["ipScalarRange"],2),gt.event(e,t,"lightingActivated"),_b(e,t)}var wb={newInstance:gt.newInstance(Sb,"vtkVolumeMapper"),extend:Sb,...xb},Cb=n(206);function Ab(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=(n,r,o)=>{o!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.numberOfComponents||1;n.length&&(n.length=r);const o=e*r;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1;return e*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Ib({name:t.name,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(n,r)=>{t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}const Eb={name:"",numberOfComponents:1,size:0,dataType:"string"};function Db(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Eb,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),gt.obj(e,t),gt.set(e,t,["name"]),Ab(e,t)}const Ib=gt.newInstance(Db,"vtkStringArray");var Pb={newInstance:Ib,extend:Db};function Ob(e){return new TextDecoder("latin1").decode(e)}var Nb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=Ob(e),o=t.exec(r);if(!o)return{text:r};const i=o.index+o[0].length,a=r.substring(0,i);let s=null;const l=n?n.exec(r):null;return s=l?{text:a+r.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s};const{vtkErrorMacro:Mb,vtkDebugMacro:Rb}=gt,Fb=()=>(Mb("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let kb=0;function Lb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new XMLHttpRequest;return r.open(e,t,!0),n.headers&&Object.entries(n.headers).forEach((e=>{let[t,n]=e;return r.setRequestHeader(t,n)})),n.progressCallback&&r.addEventListener("progress",n.progressCallback),r}const Bb={fetchArray:function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return r&&r.compression?Fb():n.ref&&!n.ref.pending?new Promise(((o,i)=>{const a=Lb("GET",[t,n.ref.basepath,n.ref.id].join("/"),r);a.onreadystatechange=t=>{1===a.readyState&&(n.ref.pending=!0,1==++kb&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(n.ref.pending=!1,200===a.status||0===a.status?(n.buffer=a.response,"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(Md!==n.ref.encode&&Md&&(Rb(`Swap bytes of ${n.name}`),Rd(n.buffer,rn[n.dataType])),n.values=gt.newTypedArray(n.dataType,n.buffer)),n.values.length!==n.size&&Mb(`Error in FetchArray: ${n.name}, does not have the proper array size. Got ${n.values.length}, instead of ${n.size}`),delete n.ref,0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(n)):i({xhr:a,e:t}))},a.responseType="string"!==n.dataType?"arraybuffer":"text",a.send()})):Promise.resolve(n)},fetchJSON:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Fb():new Promise(((r,o)=>{const i=Lb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++kb&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchText:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression?Fb():new Promise(((r,o)=>{const i=Lb("GET",t,n);i.onreadystatechange=t=>{1===i.readyState&&1==++kb&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0==--kb&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?r(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()}))},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const o=Lb("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?n(o.response):r({xhr:o,e:e}))},o.responseType="arraybuffer",o.send()}))},fetchImage:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((e,r)=>{const o=new Image;n.crossOrigin&&(o.crossOrigin=n.crossOrigin),o.onload=()=>e(o),o.onerror=r,o.src=t}))}};function Vb(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}kd("http")||Ld("http",(e=>Bb));const Ub={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},Gb={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function zb(e){const t=e.length-1;return e.filter(((e,n)=>n0&&(a=0===i?r*o:(r-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e,t){const[n]=e;return(e.length-1)*n}(n);for(;u{e.trim().length&&(c[n++]=Number(e))}))}else if("binary"===l){const e=new Uint8Array(Od(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===n){const t=Hb(e,o);c=new Ub[a](t.buffer),/^U?Int64$/.test(a)&&(c=zb(c))}else c=new Ub[a](e.buffer,Gb[o]),-1!==a.indexOf("Int64")&&(c=zb(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=jb(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function Kb(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function qb(e,t){function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Bd("http")),e.setUrl=function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;const o=n.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(r)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=n=>{if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();const{text:r,binaryBuffer:o}=Nb(n,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m);var i;t.rawDataBuffer=n,t.binaryBuffer=o;const a=(i=r,(0,Cb.create)(i)).root(),s=a.node,l=s.getAttribute("type"),u=s.getAttribute("compressor"),c=s.getAttribute("byte_order"),d=s.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(c&&"LittleEndian"!==c)return console.error("Only LittleEndian encoding is supported"),!1;if(l!==t.dataType)return console.error("Invalid data type",l,"expecting",t.dataType),!1;if(Vb(s,"AppendedData")){const e=Vb(s,"AppendedData"),n=e.getAttribute("encoding"),r=a.filter((e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")}),!1,!0).map((e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))})));r.sort(((e,t)=>e.offset-t.offset));let o=t.binaryBuffer;"base64"===n&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length),0),c=new ArrayBuffer(l),p=new Uint8Array(c);for(let e=0,t=0;eWr.newInstance(Xb(Number(e.getAttribute("NumberOfTuples")),e,t,0,r,o)))),a=[...e.getElementsByTagName("Array")].filter((e=>"String"===e.getAttribute("type"))).map((e=>{const n=Pb.newInstance(function(e,t,n,r,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let n=0;const r=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const $b={};var Yb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$b,n),gt.obj(e,t),gt.get(e,t,["url","baseURL"]),gt.setGet(e,t,["dataAccessHelper"]),gt.algo(e,t,0,1),qb(e,t)},Jb=function(e,t,n,r,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach((e=>{const r=t.getAttribute(e);r&&(o[r]=n[`set${e}`])}));const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const a=e.getElementsByTagName(t.dataType)[0],s=a.getAttribute("Origin").split(" ").map((e=>Number(e))),l=a.getAttribute("Spacing").split(" ").map((e=>Number(e))),u=a.getAttribute("Direction")?.split(" ").map((e=>Number(e))),c=a.getElementsByTagName("Piece"),d=c.length;for(let e=0;eNumber(e))),d=qh.newInstance({origin:s,spacing:l,direction:u,extent:a});Jb(d.getNumberOfPoints(),n.getElementsByTagName("PointData")[0],d.getPointData(),r,o,i,t.binaryBuffer),Jb(d.getNumberOfCells(),n.getElementsByTagName("CellData")[0],d.getCellData(),r,o,i,t.binaryBuffer),t.output[e]=d}}}const Zb={dataType:"ImageData"};function ex(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zb,n),Yb(e,t,n),Qb(e,t)}var tx={newInstance:gt.newInstance(ex,"vtkXMLImageDataReader"),extend:ex},nx=n(892),rx=n.n(nx),ox=n(760),ix=n.n(ox),ax=n(311),sx=n.n(ax),lx=n(192),ux=n.n(lx),cx=n(60),dx=n.n(cx),px=n(865),fx=n.n(px),hx=n(551),mx={};mx.styleTagTransform=fx(),mx.setAttributes=ux(),mx.insert=sx().bind(null,"head"),mx.domAPI=ix(),mx.insertStyleElement=dx(),rx()(hx.Z,mx),hx.Z&&hx.Z.locals&&hx.Z.locals;const gx=py.newInstance({background:[0,0,0]}),vx=gx.getRenderer(),yx=gx.getRenderWindow(),bx=by.newInstance({renderWindow:gx.getApiSpecificRenderWindow()}),xx=tx.newInstance(),_x=eb.newInstance(),Tx=vb.newInstance(),Sx=wb.newInstance();_x.setInputConnection(xx.getOutputPort()),Sx.setInputConnection(_x.getOutputPort()),Tx.setMapper(Sx),vx.addVolume(Tx);const wx=Tp.newInstance(),Cx=ib.newInstance(),{fileURL:Ax="https://data.kitware.com/api/v1/file/59de9dca8d777f31ac641dc2/download",xrSessionType:Ex=null,colorPreset:Dx=null,rotateX:Ix=0,rotateY:Px=0,rotateZ:Ox=0}=bh();let Nx=Ex;Object.values(fy).includes(Nx)||(console.warn("Could not parse requested XR session type: ",Nx),Nx=null),Nx===fy.LookingGlassVR?import("https://unpkg.com/@lookingglass/webxr@0.3.0/dist/@lookingglass/bundle/webxr.js").then((e=>{new e.LookingGlassWebXRPolyfill})):null===Nx&&navigator.xr.isSessionSupported("immersive-vr").then((e=>{e?Nx=fy.HmdVr:navigator.xr.isSessionSupported("immersive-ar").then((e=>{Nx=e?fy.MobileAR:null}))})),wy.fetchBinary(Ax).then((e=>{xx.parseAsArrayBuffer(e);const t=l();if(Ix){const e=l();E(e,Or.radiansFromDegrees(Ix),[1,0,0]),y(t,t,e)}if(Px){const e=l();E(e,Or.radiansFromDegrees(Px),[0,1,0]),y(t,t,e)}if(Ox){const e=l();E(e,Or.radiansFromDegrees(Ox),[0,0,1]),y(t,t,e)}_x.setResliceAxes(t);const n=_x.getOutputData(0),r=(n.getPointData().getScalars()||n.getPointData().getArrays()[0]).getRange(),o=.7*Math.sqrt(n.getSpacing().map((e=>e*e)).reduce(((e,t)=>e+t),0));Sx.setSampleDistance(o),"CT-AAA"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(143,.62,.36,.18),wx.addRGBPoint(166,.68,.6,.34),wx.addRGBPoint(214,.7,.7,.7),wx.addRGBPoint(419,.9,.84,.85),wx.addRGBPoint(3071,.83,.66,1),Cx.addPoint(-3024,0),Cx.addPoint(144,0),Cx.addPoint(166,.69),Cx.addPoint(214,.7),Cx.addPoint(420,.83),Cx.addPoint(3071,.8)):"CT-Bone"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(-16.4458,.729412,.254902,.301961),wx.addRGBPoint(641.385,.905882,.815686,.552941),wx.addRGBPoint(3071,1,1,1),Cx.addPoint(-3024,0),Cx.addPoint(-16.4458,0),Cx.addPoint(641.385,.715686),Cx.addPoint(3071,.705882)):"CT-Cardiac2"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(42,.55,.25,.15),wx.addRGBPoint(163,.92,.64,.06),wx.addRGBPoint(278,1,.88,.62),wx.addRGBPoint(1587,1,1,1),wx.addRGBPoint(3071,.83,.66,1),Cx.addPoint(-3024,0),Cx.addPoint(43,0),Cx.addPoint(163,.42),Cx.addPoint(277,.78),Cx.addPoint(1587,.75),Cx.addPoint(3071,.8)):"CT-Chest-Contrast-Enhanced"===Dx?(wx.addRGBPoint(-3024,0,0,0),wx.addRGBPoint(67.0106,.54902,.25098,.14902),wx.addRGBPoint(251.105,.882353,.603922,.290196),wx.addRGBPoint(439.291,1,.937033,.954531),wx.addRGBPoint(3071,.827451,.658824,1),Cx.addPoint(-3024,0),Cx.addPoint(67.0106,0),Cx.addPoint(251.105,.446429),Cx.addPoint(439.291,.625),Cx.addPoint(3071,.616071)):(wx.addRGBPoint(r[0],0,.3,.3),wx.addRGBPoint(r[1],1,1,1),Cx.addPoint(r[0],0),Cx.addPoint((r[1]-r[0])/4,0),Cx.addPoint(r[1],.5)),Tx.getProperty().setRGBTransferFunction(0,wx),Tx.getProperty().setScalarOpacity(0,Cx),Tx.getProperty().setInterpolationTypeToLinear(),vx.resetCamera(),yx.render();const i=document.createElement("button");let a="XR not available!";i.textContent=a,void 0!==navigator.xr&&bx.getXrSupported()&&(a=Nx===fy.MobileAR?"Start AR":"Start VR",i.textContent=a),i.addEventListener("click",(()=>{i.textContent===a?(bx.startXR(Nx),i.textContent="Exit XR"):(bx.stopXR(),i.textContent=a)})),document.querySelector(".content").appendChild(i)})),n.g.source=xx,n.g.mapper=Sx,n.g.actor=Tx,n.g.ctfun=wx,n.g.ofun=Cx,n.g.renderer=vx,n.g.renderWindow=yx},793:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},22:function(e){"use strict";e.exports=function(e){return e[1]}},145:function(e,t,n){"use strict";var r=n(426),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),r}},640:function(e,t,n){var r=n(64),o=n(115),i=n(965),a=n(332),s=n(65),l=n(182),u=n(293);u.alea=r,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},64:function(e,t,n){var r;!function(e,o,i){function a(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new a(e),r=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.alea=l}(0,e=n.nmd(e),n.amdD)},182:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,o=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.tychei=l}(0,e=n.nmd(e),n.amdD)},115:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor128=l}(0,e=n.nmd(e),n.amdD)},65:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.w,o=t.X,i=t.i;return t.w=r=r+1640531527|0,n=o[i+34&127],e=o[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=o[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,o,i,a,s=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;e.w=a,e.X=s,e.i=o}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.X&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xor4096=l}(0,e=n.nmd(e),n.amdD)},332:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this;t.next=function(){var e,n,r=t.x,o=t.i;return e=r[o],n=(e^=e>>>7)^e<<24,n^=(e=r[o+1&7])^e>>>10,n^=(e=r[o+3&7])^e>>>3,n^=(e=r[o+4&7])^e<<7,e=r[o+7&7],n^=(e^=e<<13)^e<<9,r[o]=n,t.i=o+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function l(e,t){null==e&&(e=+new Date);var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&(r.x&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorshift7=l}(0,e=n.nmd(e),n.amdD)},965:function(e,t,n){var r;!function(e,o,i){function a(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new a(e),r=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&s(r,n),o.state=function(){return s(n,{})}),o}o&&o.exports?o.exports=l:n.amdD&&n.amdO?void 0===(r=function(){return l}.call(t,n,t,o))||(o.exports=r):this.xorwow=l}(0,e=n.nmd(e),n.amdD)},293:function(e,t,n){var r;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,n){var r=[],p=v(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,y(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),y(e)}catch(e){var t=o.navigator,n=t&&t.plugins;return[+new Date,o,n,o.screen,y(i)]}}():e,3),r),f=new h(r),b=function(){for(var e=f.g(6),t=u,n=0;e=d;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,v(y(f.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&m(r,f),e.state=function(){return m(f,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,o=0,i=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);o>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function o(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)n(c,r(e.substring(t-64,t)));for(o=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function s(e){var t;for(t=0;tu?new ArrayBuffer(0):(r=u-l,o=new ArrayBuffer(r),i=new Uint8Array(o),a=new Uint8Array(this,l,r),i.set(a),o)}}(),c.prototype.append=function(e){return this.appendBinary(l(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,o=this._buff.length;for(t=64;t<=o;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},c.prototype.end=function(e){var t,n,r=this._buff,o=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,t){var r,o,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=o,e[15]=i,n(this._hash,e)},c.hash=function(e,t){return c.hashBinary(l(e),t)},c.hashBinary=function(e,t){var n=s(i(e));return t?u(n):n},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var t,r,i,a,s,l=(r=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),s.set(new Uint8Array(i),r.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,t=64;t<=u;t+=64)n(this._hash,o(l.subarray(t-64,t)));return this._buff=t-64>2]|=r[t]<<(t%4<<3);return this._finish(i,o),n=s(this._hash),e&&(n=u(n)),this.reset(),n},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,o=new ArrayBuffer(r),i=new Uint8Array(o);for(n=0;n>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(c,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,n(c,i),c}(new Uint8Array(e)));return t?u(r):r},c}()},206:function(e){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=184)}([function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(240)),r(n(251)),r(n(175)),r(n(107)),r(n(29)),r(n(73)),r(n(106)),r(n(30)),r(n(252)),r(n(52)),r(n(97)),r(n(253)),r(n(37)),r(n(51)),r(n(173)),r(n(176)),r(n(172)),r(n(108)),r(n(254)),r(n(255)),r(n(256)),r(n(72)),r(n(177)),r(n(105)),r(n(17)),r(n(257)),r(n(12)),r(n(174))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(212);t.FixedSizeSet=o.FixedSizeSet;var i=n(213);t.ObjectCache=i.ObjectCache;var a=n(214);t.CompareCache=a.CompareCache;var s=n(215);t.Lazy=s.Lazy;var l=n(216);function u(e,t,n){if(m(e))e.forEach((function(e,r){return t.call(n,r,e)}));else for(var r in e)e.hasOwnProperty(r)&&t.call(n,r,e[r])}function c(e){var t,n;if(d(e))return e;if(f(e)){var o=[];try{for(var i=r(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),n=t.constructor;return t&&n&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var n=[],r=2;r>6|192;else{if(o>55295&&o<56320){if(++r>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(r);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[n++]=o>>18|240,t[n++]=o>>12&63|128}else t[n++]=o>>12|224;t[n++]=o>>6&63|128}t[n++]=63&o|128}}return t.subarray(0,n)},t.utf8Decode=function(e){for(var t="",n=0;n127)if(r>191&&r<224){if(n>=e.length)throw new Error("Incomplete 2-byte sequence.");r=(31&r)<<6|63&e[n++]}else if(r>223&&r<240){if(n+1>=e.length)throw new Error("Incomplete 3-byte sequence.");r=(15&r)<<12|(63&e[n++])<<6|63&e[n++]}else{if(!(r>239&&r<248))throw new Error("Unknown multi-byte start.");if(n+2>=e.length)throw new Error("Incomplete 4-byte sequence.");r=(7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++]}if(r<=65535)t+=String.fromCharCode(r);else{if(!(r<=1114111))throw new Error("Code point exceeds UTF-16 limit.");r-=65536,t+=String.fromCharCode(r>>10|55296),t+=String.fromCharCode(1023&r|56320)}}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(241);t.Cast=r.Cast;var o=n(150);t.Guard=o.Guard;var i=n(242);t.EmptySet=i.EmptySet},function(e,t,n){var r=n(11),o=n(55).f,i=n(21),a=n(25),s=n(80),l=n(119),u=n(123);e.exports=function(e,t){var n,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||s(h,{}):(r[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(n,c))&&f.value:n[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(n,c,p,e)}}},function(e,t,n){var r=n(11),o=n(81),i=n(14),a=n(58),s=n(86),l=n(124),u=o("wks"),c=r.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new r.CompareCache,this._rangeList=new r.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),r.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(228));t.base64=o;var i=r(n(146));t.byte=i;var a=r(n(147));t.byteSequence=a;var s=r(n(96));t.codePoint=s;var l=r(n(232));t.json=l;var u=r(n(233));t.list=u;var c=r(n(234));t.map=c;var d=r(n(235));t.namespace=d;var p=r(n(236));t.queue=p;var f=r(n(237));t.set=f;var h=r(n(238));t.stack=h;var m=r(n(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,n){void 0===n&&(n="");var r=e.call(this,n)||this;return r.name=t,r}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=v;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=y;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=T;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=S;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=w;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=C;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=I;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=P;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=O},function(e,t,n){"use strict";var r=n(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")()}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,n){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:n})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(16),o=n(115),i=n(18),a=n(56),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(8);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2);function a(e,t,n){if(void 0===n&&(n=!1),n&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var r=t._parent;r&&r!==e;){if(r._nextSibling)return r._nextSibling;r=r._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);for(var o=t?e:a(e,e,n);o&&r&&!r(o);)o=a(e,o,n);return o}function u(e,t,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=a(e,t,r);i&&o&&!o(i);)i=a(e,i,r);return i}function c(e,t,n,r){var o;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,n);return{next:function(){for(;o&&r&&!r(o);)o=a(e,o,n);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,n),t}}},o):s()}function d(e,t,n){void 0===t&&(t=!1);for(var r=t?e:e._parent;r&&n&&!n(r);)r=r._parent;return r}function p(e,t,n,r){void 0===n&&(n=!1);for(var o=t._parent;o&&r&&!r(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var n=h(e,!1);return o.Guard.isShadowRoot(n)?h(n._host,!0):n}return e._parent?h(e._parent):e}function m(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var i=n?e:r&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=r&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),n=0,r=l(t);null!==r;){if(n++,r===e)return n;r=u(t,r)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,n,r){var i;return void 0===t&&(t=!1),void 0===n&&(n=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,n,(function(e){return o.Guard.isElementNode(e)}))[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&r&&!r(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,n){var r;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((r={})[Symbol.iterator]=function(){var r=e._parent?e._parent._firstChild:null;return{next:function(){for(;r&&(n&&!n(r)||!t&&r===e);)r=r._nextSibling;if(null===r)return{done:!0,value:null};var o={done:!1,value:r};return r=r._nextSibling,o}}},r):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,n){var r;return void 0===t&&(t=!1),t||e._parent?((r={})[Symbol.iterator]=function(){var r=d(e,t,n);return{next:function(){if(null===r)return{done:!0,value:null};var e={done:!1,value:r};return r=p(0,r,t,n),e}}},r):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var n=[],r=[],o=d(e,!0);null!==o;)n.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)r.push(i),i=p(0,i,!0);for(var a=n.length,s=r.length,l=null,u=Math.min(a,s);u>0;u--){var c=n[--a];if(c!==r[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var n=t._parent;if(null===n||n===e)return null;if(n._nextSibling)return n._nextSibling;t=n}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var n,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=r(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=r(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=r(t._children),v=g.next();!v.done;v=g.next())if(!e(v.value))return!1}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);for(var o=l(e,n,r);null!==o;){if(o===t)return!0;o=u(e,o,n,r)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,n,r){if(void 0===r&&(r=!1),m(t,n,r))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,n,r))},t.tree_isSiblingOf=function(e,t,n){return void 0===n&&(n=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!n},t.tree_isPreceding=function(e,t){var n=g(e),r=g(t);return-1!==n&&-1!==r&&h(e)===h(t)&&rn},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var n=h(e);if(!o.Guard.isShadowRoot(n))return e;if(t&&o.Guard.isNode(t)&&m(n,t,!0,!0))return e;e=n.host}}},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,n){"use strict";var r=n(24),o=n(130),i=n(49),a=n(43),s=n(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",(function(e,t){l(this,{type:"Array Iterator",target:r(e),index:0,kind:t})}),(function(){var e=u(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(90),o=n(25),i=n(202);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,n){var r=n(16),o=n(15),i=n(40);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(137).charAt,o=n(43),i=n(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(e){a(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=s(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o),t.index+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(11),o=n(203),i=n(19),a=n(21),s=n(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=r[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,n){var r=n(41),o=n(35);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(11),o=n(21),i=n(14),a=n(80),s=n(117),l=n(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,n,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),c(n).source=d.join("string"==typeof t?t:"")),e!==r?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(e,t,n){var r=n(47),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(16),o=n(8),i=n(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var n=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!n&&!o((function(){if(u&&!r)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,c,d)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(148),o=n(149),i=n(151),a=n(98),s=n(153),l=n(154),u=n(155),c=n(99),d=n(100),p=n(156),f=n(157),h=n(101),m=n(158),g=n(159),v=n(160),y=n(161),b=n(162),x=n(163),_=n(164),T=n(165),S=n(166),w=n(167),C=n(168),A=n(169),E=n(170);t.create_domImplementation=function(e){return r.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,n,r){return u.DocumentTypeImpl._create(e,t,n,r)},t.create_element=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_htmlUnknownElement=function(e,t,n,r){return c.ElementImpl._create(e,t,n,r)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,n){return v.ProcessingInstructionImpl._create(e,t,n)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),y.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return T.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,n){return S.NodeIteratorImpl._create(e,t,n)},t.create_treeWalker=function(e,t){return w.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return C.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,n,r,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,n,r,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(17),a=n(3),s=n(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var n=i.tree_getFollowingNode(e._root,t);if(null!==n&&i.tree_isDescendantOf(e._root,n,!0)&&!i.tree_isDescendantOf(t,n,!0))return void(e._reference=n);if(null===n)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var r=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(r=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=r}}}function c(e,t,n,r,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,n,r,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(r===n)return;if(null===r&&""===n)return;if(""===r&&null===n)return;e._name=null===r||""===r?"":r,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,n,r){"id"===t&&null===r&&(e._uniqueIdentifier=n||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,n,r){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,n,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,n,i,a),c.call(e,e,t,n,i,a)),p.call(e,e,t,i,a);try{for(var u=r(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,n,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(46),a=n(44),s=n(16),l=n(86),u=n(124),c=n(8),d=n(14),p=n(59),f=n(13),h=n(18),m=n(27),g=n(24),v=n(56),y=n(40),b=n(60),x=n(61),_=n(82),T=n(190),S=n(85),w=n(55),C=n(15),A=n(79),E=n(21),D=n(25),I=n(81),P=n(57),O=n(45),N=n(58),M=n(5),R=n(125),F=n(126),k=n(62),L=n(43),B=n(36).forEach,V=P("hidden"),U=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),X=w.f,K=C.f,q=T.f,$=A.f,Y=I("symbols"),J=I("op-symbols"),Q=I("string-to-symbol-registry"),Z=I("symbol-to-string-registry"),ee=I("wks"),te=o.QObject,ne=!te||!te.prototype||!te.prototype.findChild,re=s&&c((function(){return 7!=b(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=X(j,t);r&&delete j[t],K(e,t,n),r&&e!==j&&K(j,t,r)}:K,oe=function(e,t){var n=Y[e]=b(W.prototype);return G(n,{type:"Symbol",tag:e,description:t}),s||(n.description=t),n},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,n){e===j&&ae(J,t,n),h(e);var r=v(t,!0);return h(n),d(Y,r)?(n.enumerable?(d(e,V)&&e[V][r]&&(e[V][r]=!1),n=b(n,{enumerable:y(0,!1)})):(d(e,V)||K(e,V,y(1,{})),e[V][r]=!0),re(e,r,n)):K(e,r,n)},se=function(e,t){h(e);var n=g(t),r=x(n).concat(de(n));return B(r,(function(t){s&&!le.call(n,t)||ae(e,t,n[t])})),e},le=function(e){var t=v(e,!0),n=$.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(n||!d(this,t)||!d(Y,t)||d(this,V)&&this[V][t])||n)},ue=function(e,t){var n=g(e),r=v(t,!0);if(n!==j||!d(Y,r)||d(J,r)){var o=X(n,r);return!o||!d(Y,r)||d(n,V)&&n[V][r]||(o.enumerable=!0),o}},ce=function(e){var t=q(g(e)),n=[];return B(t,(function(e){d(Y,e)||d(O,e)||n.push(e)})),n},de=function(e){var t=e===j,n=q(t?J:g(e)),r=[];return B(n,(function(e){!d(Y,e)||t&&!d(j,e)||r.push(Y[e])})),r};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),n=function(e){this===j&&n.call(J,e),d(this,V)&&d(this[V],t)&&(this[V][t]=!1),re(this,t,y(1,e))};return s&&ne&&re(j,t,{configurable:!0,set:n}),oe(t,e)}).prototype,"toString",(function(){return z(this).tag})),D(W,"withoutSetter",(function(e){return oe(N(e),e)})),A.f=le,C.f=ae,w.f=ue,_.f=T.f=ce,S.f=de,R.f=function(e){return oe(M(e),e)},s&&(K(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),B(x(ee),(function(e){F(e)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var n=W(t);return Q[t]=n,Z[n]=t,n},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),r({target:"Object",stat:!0,forced:c((function(){S.f(1)}))},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),H&&r({target:"JSON",stat:!0,forced:!l||c((function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))}))},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[U]||E(W.prototype,U,W.prototype.valueOf),k(W,"Symbol"),O[V]=!0},function(e,t,n){"use strict";var r=n(4),o=n(16),i=n(11),a=n(14),s=n(13),l=n(15).f,u=n(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(e,t,n){n(126)("iterator")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(70),u=n(3),c=n(9),d=n(0),p=n(152),f=n(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,n,r,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,(function(e){return u.Guard.isExclusiveTextNode(e)}));for(var l=0;lS;S++)if((p||S in x)&&(y=_(v=x[S],S,b),e))if(t)C[S]=y;else if(y)switch(e){case 3:return!0;case 5:return v;case 6:return S;case 2:l.call(C,v)}else if(c)return!1;return d?-1:u||c?c:C}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=r(t._children),S=T.next();!S.done;S=T.next())if(S.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");w=w._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var C=r(t._children),A=C.next();!A.done;A=C.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=C.return)&&d.call(C)}finally{if(c)throw c.error}}if(n){if(v===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(w=n._nextSibling;w;){if(w._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");w=w._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=r(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(n)for(var I=n._previousSibling;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._previousSibling}else for(I=t._firstChild;I;){if(I._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");I=I._nextSibling}}}function x(e,t,n){b(e,t,n);var r=n;return r===e&&(r=e._nextSibling),y.document_adopt(e,t._nodeDocument),_(e,t,r),e}function _(e,t,n,o){var s,h;if(null!==n||e._nodeType===l.NodeType.DocumentFragment){var y=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==n&&0!==a.dom.rangeList.size){var b=f.tree_index(n);try{for(var x=r(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var S=_.value;S._start[0]===t&&S._start[1]>b&&(S._start[1]+=y),S._end[0]===t&&S._end[1]>b&&(S._end[1]+=y)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var w=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)T(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],w,null,null);for(var C=n?n._previousSibling:t._lastChild,A=null===n?-1:f.tree_index(n),E=0;E_&&w._start[1]--,w._end[0]===t&&w._end[1]>_&&w._end[1]--}}catch(e){o={error:e}}finally{try{S&&!S.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var C=r(a.dom.rangeList),A=C.next();!A.done;A=C.next())(w=A.value)._start[0]===t&&w._start[1]>_&&(w._start[1]-=1),w._end[0]===t&&w._end[1]>_&&(w._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=r(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var I=D.value;I._root._nodeDocument===e._nodeDocument&&v.dom_runNodeIteratorPreRemovingSteps(I,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=E.return)&&y.call(E)}finally{if(d)throw d.error}}var P=e._previousSibling,O=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,(function(e){return u.Guard.isSlot(e)}))&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&v.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&v.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var k=(b=void 0,r(F._registeredObserverList)),L=k.next();!L.done;L=k.next()){var B=L.value;B.options.subtree&&e._registeredObserverList.push({observer:B.observer,options:B.options,source:B})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=k.return)&&x.call(k)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(n||g.observer_queueTreeMutationRecord(t,[],[e],P,O)),a.dom.features.steps&&u.Guard.isTextNode(e)&&v.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,n){var o,i,u,c,d,p,h,m;if(n._nodeType!==l.NodeType.Document&&n._nodeType!==l.NodeType.DocumentFragment&&n._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+n.nodeName+".");if(f.tree_isHostIncludingAncestorOf(n,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+n.nodeName+".");if(e._parent!==n)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+n.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&n._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&n._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+n.nodeName+".");if(n._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var v=0;try{for(var b=r(t._children),x=b.next();!x.done;x=b.next()){var S=x.value;if(S._nodeType===l.NodeType.Element)v++;else if(S._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+S.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(v>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var w=r(n._children),C=w.next();!C.done;C=w.next())if((O=C.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{C&&!C.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=r(n._children),D=E.next();!D.done;D=E.next())if((O=D.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var I=r(n._children),P=I.next();!P.done;P=I.next()){var O;if((O=P.value)._nodeType===l.NodeType.DocumentType&&O!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{P&&!P.done&&(m=I.return)&&m.call(I)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;y.document_adopt(t,n._nodeDocument);var F=[];null!==e._parent&&(F.push(e),T(e,e._parent,!0));var k=[];return t._nodeType===l.NodeType.DocumentFragment?k=Array.from(t._children):k.push(t),_(t,n,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(n,k,F,R,M),e},t.mutation_replaceAll=function(e,t){var n,o;null!==e&&y.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=r(i),c=u.next();!c.done;c=u.next())T(c.value,t,!0)}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return T(e,t),e},t.mutation_remove=T},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(8);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},function(e,t){e.exports={}},function(e,t,n){"use strict";n(31),n(32),n(33),n(220),n(64),n(19),n(65),n(20),n(68),n(66),n(92),n(144),n(22),n(94),n(23);var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(n)},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s;try{for(var l=r(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,n,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var n,o;try{for(var i=r(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,n,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix,p.push([null,"xmlns",y,this._serializeAttributeValue(v,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([v,y,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var n,o,i=[],a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value.toString();return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(7),l=n(29),u=n(17),c=n(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then((function(){p()})))}function p(){var e,t,n,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var n=0;n"+e+"<\/script>"},f=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=r?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var n=a.length;n--;)delete f.prototype[a[n]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(d.prototype=o(e),n=new d,d.prototype=null,n[c]=e):n=f(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(121),o=n(84);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(15).f,o=n(14),i=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(8),o=n(5),i=n(129),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},function(e,t,n){"use strict";var r=n(4),o=n(122).indexOf,i=n(48),a=n(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(16),o=n(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(25),o=n(18),i=n(8),a=n(136),s=RegExp.prototype,l=s.toString,u=i((function(){return"/a/b"!=l.call({source:"a",flags:"b"})})),c="toString"!=l.name;(u||c)&&r(RegExp.prototype,"toString",(function(){var e=o(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in s)?a.call(e):n)}),{unsafe:!0})},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(138),n(20),n(66),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=n(2),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=a.applyDefaults(n,{format:"object",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var n,r,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,v=0;v2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[r+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?r+(s++).toString():r]=e;return s},t.prototype.beginElement=function(e){var t,n,r=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=r,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(r):o[e]=[o[e],r]:this._currentList.push(((n={})[e]=r,n))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=r:this._listRegister.push(r),this._currentList=r},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var n,r;if(0===this._currentList.length)this._currentList.push({"@":(n={},n[e]=t,n)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(r={},r[e]=t,r)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var n=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":n});else{var r=this._currentList[this._currentList.length-1];this._isInstructionNode(r)?a.isArray(r["?"])?r["?"].push(n):r["?"]=[r["?"],n]:this._currentList.push({"?":n})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(n(50).BaseWriter);t.ObjectWriter=l},function(e,t,n){"use strict";var r=n(4),o=n(93);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=r},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=n(3),a=n(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,n){void 0===n&&(n={passive:!1,once:!1,capture:!1});var o,s=r(a.eventTarget_flattenMore(n),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,n){void 0===n&&(n={capture:!1});var r=a.eventTarget_flatten(n);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,n){"use strict";var r=n(39);e.exports=r.DEFAULT=new r({include:[n(54)],explicit:[n(299),n(300),n(301)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(185);t.XMLBuilderImpl=r.XMLBuilderImpl;var o=n(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=n(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=n(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){var r=n(11),o=n(21);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(44),o=n(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(121),o=n(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(e,t,n){var r=n(127);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(4),o=n(195),i=n(132),a=n(133),s=n(62),l=n(21),u=n(25),c=n(5),d=n(44),p=n(49),f=n(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),v=function(){return this};e.exports=function(e,t,n,c,f,y,b){o(n,t,c);var x,_,T,S=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},w=t+" Iterator",C=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||S(f),I="Array"==t&&A.entries||E;if(I&&(x=i(I.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,v)),s(x,w,!0,!0),d&&(p[w]=v))),"values"==f&&E&&"values"!==E.name&&(C=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:S("values"),keys:y?D:S("keys"),entries:S("entries")},b)for(T in _)(m||C||!(T in A))&&u(A,T,_[T]);else r({target:t,proto:!0,forced:m||C},_);return _}},function(e,t,n){"use strict";var r=n(4),o=n(13),i=n(59),a=n(83),s=n(26),l=n(24),u=n(134),c=n(5),d=n(63),p=n(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,v=Math.max;r({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var n,r,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(n=d.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[m])&&(n=void 0):n=void 0,n===Array||void 0===n))return g.call(d,f,h);for(r=new(void 0===n?Array:n)(v(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),n=new RegExp("^(?:"+h+")",f)),p&&(n=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),r=s.call(u?n:a,g),u?r?(r.input=r.input.slice(m),r[0]=r[0].slice(m),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:c&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),p&&r&&r.length>1&&l.call(r[0],n,(function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(e,t,n,r){var g=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,v=r.REPLACE_KEEPS_$0,y=g?"$":"$0";return[function(n,r){var o=l(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!g&&v||"string"==typeof r&&-1===r.indexOf(y)){var i=n(t,e,this,r);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof r;h||(r=String(r));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var T=c(l,f);if(null===T)break;if(_.push(T),!m)break;""===String(T[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var S,w="",C=0,A=0;A<_.length;A++){T=_[A];for(var E=String(T[0]),D=d(p(s(T.index),f.length),0),I=[],P=1;P=C&&(w+=f.slice(C,D)+M,C=D+E.length)}return w+f.slice(C)}];function b(e,n,r,o,a,s){var l=r+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,(function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s}))}}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var n in this._items)t._items[n]=this._items[n].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var n=null===t?this._nullItems:this._items[t]||null;if(null===n)return null;for(var r=null,o=0;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){O=F;break}if(null!==O)if(l.Guard.isNode(O.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(O.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,n,e,r)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,n,e,r),t._type=d}}}function x(e,t,n,r,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=n(2),u=n(9),c=n(34),d=n(3),p=n(1),f=n(7),h=n(152),m=n(0),g=n(12),v=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var n=i(this._children),r=n.next();!r.done;r=n.next()){var o=r.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var n=null;void 0!==t&&(n=p.isString(t)?t:t.is);var r="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,r,null,n,!0)},t.prototype.createElementNS=function(e,t,n){return m.document_internalCreateElementNS(this,e,t,n)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var n=a(m.namespace_validateAndExtract(e,t),3),r=n[0],o=n[1],i=n[2],s=m.create_attr(this,i);return s._namespace=r,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_nodeIterator(e,e,!0);return r._whatToShow=t,r._iteratorCollection=m.create_nodeList(e),p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype.createTreeWalker=function(e,t,n){void 0===t&&(t=l.WhatToShow.All),void 0===n&&(n=null);var r=m.create_treeWalker(e,e);return r._whatToShow=t,p.isFunction(n)?(r._filter=m.create_nodeFilter(),r._filter.acceptNode=n):r._filter=n,r},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(2),l=n(34),u=n(9),c=n(7),d=n(0),p=n(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,n=[];try{for(var r=i(this._attributeList),o=r.next();!o.done;o=r.next()){var a=o.value;n.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var n=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return n?n._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var n=null,r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(71),l=n(0),u=n(12),c=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n._name="",n._assignedSlot=null,n}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,n="";try{for(var r=i(l.text_contiguousTextNodes(this,!0)),o=r.next();!o.done;o=r.next())n+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,n){void 0===n&&(n="");var r=new t(n);return r._nodeDocument=e,r},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=r.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(0),i=n(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=r.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var n=this._currentTarget;if(null===n)throw new Error("Event currentTarget is null.");e.push(n);for(var r=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===n){r=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=r-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),a=n(3),s=n(1),l=n(99),u=n(73),c=n(17),d=n(173),p=n(30),f=n(52),h=n(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,n,o){var i=r(d.namespace_validateAndExtract(t,n),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var n,r;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(n=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(17),l=n(51),u=n(30);t.characterData_replaceData=function(e,t,n,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+n>f&&(n=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+n);e._data=h;try{for(var m=r(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var v=g.value;v._start[0]===e&&v._start[1]>t&&v._start[1]<=t+n&&(v._start[1]=t),v._end[0]===e&&v._end[1]>t&&v._end[1]<=t+n&&(v._end[1]=t),v._start[0]===e&&v._start[1]>t+n&&(v._start[1]+=c.length-n),v._end[0]===e&&v._end[1]>t+n&&(v._end[1]+=c.length-n)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,n){var r=s.tree_nodeLength(e);if(t>r)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+r+", Node is "+e.nodeName+".");return t+n>r?e._data.substr(t):e._data.substr(t,n)}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,n){var r,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(n){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return!0}},function(e,t,n){"use strict";n(179),Object.defineProperty(t,"__esModule",{value:!0});var r=n(262),o=n(110),i=n(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new r.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var n="";e+="";for(var r=0;r=32&&o<=55295||o>=57344&&o<=65533)n+=e.charAt(r);else if(o>=55296&&o<=56319&&r=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,n+=String.fromCodePoint(o),r++):n+=i.isString(t)?t:t(e.charAt(r),r,e)}else n+=i.isString(t)?t:t(e.charAt(r),r,e)}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(153);t.AbortController=o.AbortControllerImpl;var i=n(154);t.AbortSignal=i.AbortSignalImpl;var a=n(102);t.AbstractRange=a.AbstractRangeImpl;var s=n(157);t.Attr=s.AttrImpl;var l=n(158);t.CDATASection=l.CDATASectionImpl;var u=n(71);t.CharacterData=u.CharacterDataImpl;var c=n(263),d=n(159);t.Comment=d.CommentImpl;var p=n(171);t.CustomEvent=p.CustomEventImpl;var f=n(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=n(98);t.Document=h.DocumentImpl;var m=n(264),g=n(155);t.DocumentType=g.DocumentTypeImpl;var v=n(6);t.dom=v.dom;var y=n(148);t.DOMImplementation=y.DOMImplementationImpl;var b=n(170);t.DOMTokenList=b.DOMTokenListImpl;var x=n(99);t.Element=x.ElementImpl;var _=n(104);t.Event=_.EventImpl;var T=n(70);t.EventTarget=T.EventTargetImpl;var S=n(161);t.HTMLCollection=S.HTMLCollectionImpl;var w=n(265);t.MutationObserver=w.MutationObserverImpl;var C=n(169);t.MutationRecord=C.MutationRecordImpl;var A=n(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=n(168);t.NodeFilter=E.NodeFilterImpl;var D=n(34);t.Node=D.NodeImpl;var I=n(166);t.NodeIterator=I.NodeIteratorImpl;var P=n(162);t.NodeList=P.NodeListImpl;var O=n(163);t.NodeListStatic=O.NodeListStaticImpl;var N=n(266),M=n(267),R=n(268),F=n(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var k=n(165);t.Range=k.RangeImpl;var L=n(156);t.ShadowRoot=L.ShadowRootImpl;var B=n(269),V=n(270);t.StaticRange=V.StaticRangeImpl;var U=n(101);t.Text=U.TextImpl;var G=n(103);t.Traverser=G.TraverserImpl;var z=n(167);t.TreeWalker=z.TreeWalkerImpl;var j=n(149);t.Window=j.WindowImpl;var W=n(151);t.XMLDocument=W.XMLDocumentImpl,r.applyMixin(x.ElementImpl,c.ChildNodeImpl),r.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),r.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),r.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),r.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),r.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),r.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),r.applyMixin(h.DocumentImpl,R.ParentNodeImpl),r.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),r.applyMixin(x.ElementImpl,R.ParentNodeImpl),r.applyMixin(U.TextImpl,B.SlotableImpl),r.applyMixin(x.ElementImpl,B.SlotableImpl)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,n){"use strict";n(64),n(20),n(66);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=this,r=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,(function(t){return o=n.parse(e,t)}),this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,(function(t,a){if(i.isFunction(a)&&(a=a.apply(n)),r.ignoreConverters||0!==t.indexOf(r.convert.att))if(r.ignoreConverters||0!==t.indexOf(r.convert.text))if(r.ignoreConverters||0!==t.indexOf(r.convert.cdata))if(r.ignoreConverters||0!==t.indexOf(r.convert.comment))if(r.ignoreConverters||0!==t.indexOf(r.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=n.element(e,void 0,n.sanitize(t))||o;else if(r.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,(function(r){var i={};i[t]=r,o=n.parse(e,i)}),n);else if(i.isMap(a)||i.isObject(a))(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.parse(s,a));else if(null!=a&&""!==a){var s;(s=n.element(e,void 0,n.sanitize(t)))&&(o=s,n.text(s,n._decodeText(n.sanitize(a))))}else o=n.element(e,void 0,n.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=n.instruction(e,n.sanitize(u),n.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){var r=t.indexOf(" "),i=-1===r?t:t.substr(0,r),a=-1===r?"":t.substr(r+1);o=n.instruction(e,n.sanitize(i),n.sanitize(a))||o}),n):i.forEachObject(a,(function(t,r){return o=n.instruction(e,n.sanitize(t),n.sanitize(r))||o}),n);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.comment(e,n.sanitize(t))||o}),n):o=n.comment(e,n.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,(function(t){return o=n.cdata(e,n.sanitize(t))||o}),n):o=n.cdata(e,n.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?n.parse(e,a):n.text(e,n._decodeText(n.sanitize(a)))||o;else if(t===r.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,(function(t,r){o=n.attribute(e,void 0,n.sanitize(t),n._decodeAttributeValue(n.sanitize(r)))||o}))}else o=n.attribute(e,void 0,n.sanitize(t.substr(r.convert.att.length)),n._decodeAttributeValue(n.sanitize(a)))||o}),this):(r.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(n(75).BaseReader);t.ObjectReader=a},function(e,t,n){"use strict";var r=n(39);e.exports=new r({explicit:[n(286),n(287),n(288)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,n){var r=n(16),o=n(8),i=n(116);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(11),o=n(13),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){var r=n(118),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},function(e,t,n){var r=n(11),o=n(80),i=r["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,n){var r=n(14),o=n(187),i=n(55),a=n(15);e.exports=function(e,t){for(var n=o(t),s=a.f,l=i.f,u=0;ul;)r(s,n=t[l++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(24),o=n(26),i=n(83),a=function(e){return function(t,n,a){var s,l=r(t),u=o(l.length),c=i(a,u);if(e&&n!=n){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=s[a(e)];return n==u||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(86);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,n){var r=n(5);t.f=r},function(e,t,n){var r=n(120),o=n(14),i=n(125),a=n(15).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){var r=n(13),o=n(59),i=n(5)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){var r,o,i=n(11),a=n(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},function(e,t,n){var r=n(5),o=n(60),i=n(15),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,n){"use strict";var r,o,i,a=n(132),s=n(21),l=n(14),u=n(5),c=n(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),c||l(r,d)||s(r,d,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(e,t,n){var r=n(14),o=n(27),i=n(57),a=n(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,n){var r=n(18),o=n(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return r(n),o(i),t?e.call(n,i):n.__proto__=i,n}}():void 0)},function(e,t,n){"use strict";var r=n(56),o=n(15),i=n(40);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(90),o=n(42),i=n(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";var r=n(18);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(47),o=n(35),i=function(e){return function(t,n){var i,a,s=String(o(t)),l=r(n),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,n){var r=n(4),o=n(27),i=n(61);r({target:"Object",stat:!0,forced:n(8)((function(){i(1)}))},{keys:function(e){return i(o(e))}})},function(e,t,n){"use strict";var r=n(4),o=n(11),i=n(123),a=n(25),s=n(140),l=n(141),u=n(142),c=n(13),d=n(8),p=n(208),f=n(62),h=n(209);e.exports=function(e,t,n){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),v=m?"set":"add",y=o[e],b=y&&y.prototype,x=y,_={},T=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(g||b.forEach&&!d((function(){(new y).entries().next()})))))x=n.getConstructor(t,e,m,v),s.REQUIRED=!0;else if(i(e,!0)){var S=new x,w=S[v](g?{}:-0,1)!=S,C=d((function(){S.has(1)})),A=p((function(e){new y(e)})),E=!g&&d((function(){for(var e=new y,t=5;t--;)e[v](t,t);return!e.has(-0)}));A||((x=t((function(t,n){u(t,x,e);var r=h(new y,t,x);return null!=n&&l(n,r[v],r,m),r}))).prototype=b,b.constructor=x),(C||E)&&(T("delete"),T("has"),m&&T("get")),(E||w)&&T(v),g&&b.clear&&delete b.clear}return _[e]=x,r({global:!0,forced:x!=y},_),f(x,e),g||n.setStrong(x,e,m),x}},function(e,t,n){var r=n(45),o=n(13),i=n(14),a=n(15).f,s=n(58),l=n(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};r[u]=!0},function(e,t,n){var r=n(18),o=n(205),i=n(26),a=n(87),s=n(206),l=n(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,c,d){var p,f,h,m,g,v,y,b=a(t,n,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(r(y=e[h])[0],y[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(v=p.next;!(y=v.call(p)).done;)if("object"==typeof(g=l(p,b,y.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){"use strict";var r=n(15).f,o=n(60),i=n(210),a=n(87),s=n(142),l=n(141),u=n(88),c=n(211),d=n(16),p=n(140).fastKey,f=n(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,n,u){var c=e((function(e,r){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=r&&l(r,e[u],e,n)})),f=m(t),g=function(e,t,n){var r,o,i=f(e),a=v(e,t);return a?a.value=n:(i.last=a={index:o=p(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},v=function(e,t){var n,r=f(e),o=p(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),n=v(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),d?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=f(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!v(this,e)}}),i(c.prototype,n?{get:function(e){var t=v(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&r(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,n){var r=t+" Iterator",o=m(t),i=m(r);u(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),c(t)}}},function(e,t,n){"use strict";var r,o=n(4),i=n(55).f,a=n(26),s=n(222),l=n(35),u=n(224),c=n(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var n=arguments.length>1?arguments[1]:void 0,r=a(t.length),o=void 0===n?r:p(a(n),r),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,n){"use strict";(function(e){var r=n(229),o=n(230),i=n(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var d=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function F(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(e,t,n,r,i){return i||F(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||F(e,0,n,8),o.write(e,t,n,r,52,8),n+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return u(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return T(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);N(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(78))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&n<=90&&(e[t]=n+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&n<=122&&(e[t]=n-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n=65&&r<=90&&(r+=32),o>=65&&o<=90&&(o+=32),r!==o)return!1}return!0},t.startsWith=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;if(e[n]!==t[n])return!1;n++}},t.byteLessThan=function(e,t){for(var n=0;;){if(n>=e.length)return!1;if(n>=t.length)return!0;var r=e[n],o=t[n];if(ro)return!1;n++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=n(7),i=n(0),a=n(12),s=function(){function e(e){this._associatedDocument=e||r.dom.window.document}return e.prototype.createDocumentType=function(e,t,n){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,n)},e.prototype.createDocument=function(e,t,n){void 0===n&&(n=null);var r=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(r,e,t)),n&&r.appendChild(n),a&&r.appendChild(a),r._origin=this._associatedDocument._origin,e===o.namespace.HTML?r._contentType="application/xhtml+xml":e===o.namespace.SVG?r._contentType="image/svg+xml":r._contentType="application/xml",r},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var n=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(n);var r=i.element_createAnElement(t,"head",o.namespace.HTML);if(n.appendChild(r),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);r.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return n.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(1),s=n(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var n=t._nodeType;return n===r.NodeType.Text||n===r.NodeType.ProcessingInstruction||n===r.NodeType.Comment||n===r.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===r.NodeType.Text||t._nodeType===r.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===r.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(n(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(1),s=n(243),l=n(7),u=n(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function v(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function y(e){return e in c}function b(e){return y(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function T(e,t){var n,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=S(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=r(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function S(e){return a.isNumber(e)?w(e):a.isArray(e)?"["+C(e)+"]":e}function w(e){for(var t="",n=e,r=1;r<=4;r++)t=(n%256).toString()+t,4!==r&&(t="."+t),n=Math.floor(n/256);return t}function C(e){for(var t="",n=null,r=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,r=a)}i>1&&(n=r);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),n!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,n,o,i){var u,c,g,T;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var S=/^[\u0000-\u001F\u0020]+/,w=/[\u0000-\u001F\u0020]+$/;(S.test(e)||w.test(e))&&v("Input string contains leading or trailing control characters or space."),e=(e=e.replace(S,"")).replace(w,"")}var C=/[\u0009\u000A\u000D]/g;C.test(e)&&v("Input string contains tab or newline characters."),e=e.replace(C,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===n||"replacement"===n||"UTF-16BE"===n||"UTF-16LE"===n?"UTF-8":n,F="",k=!1,L=!1,V=!1,U=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(U.c()))F+=U.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return v("Invalid scheme start character."),null;A=s.ParserState.NoScheme,U.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(U.c())||"+"===U.c()||"-"===U.c()||"."===U.c())F+=U.c().toLowerCase();else{if(":"!==U.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,U.pointer=0;continue}return v("Invalid input string."),null}if(void 0!==i){if(y(o.scheme)&&!y(F))return o;if(!y(o.scheme)&&y(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(U.remaining().startsWith("//")||v("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:U.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,U.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==U.c())return v("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===U.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,U.pointer--):(A=s.ParserState.File,U.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Invalid input string."),A=s.ParserState.Relative,U.pointer--);break;case s.ParserState.PathOrAuthority:"/"===U.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,U.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,U.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===U.c()?(v("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,U.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==U.c()&&"\\"!==U.c())if("/"===U.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,U.pointer--}else"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===U.c()&&U.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer++):(v("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,U.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==U.c()&&"\\"!==U.c()?(A=s.ParserState.Authority,U.pointer--):v("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===U.c()){v("Unexpected '@'."),k&&(F="%40"+F),k=!0;try{for(var z=(u=void 0,r(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||V){var H=G(W,h);V?o.password+=H:o.username+=H}else V=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(k&&""===F)return v("Invalid input string."),null;U.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=U.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)U.pointer--,A=s.ParserState.FileHost;else if(":"!==U.c()||L)if(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()){if(U.pointer--,b(o)&&""===F)return v("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return v("Invalid input string."),o;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===U.c()&&(L=!0),"]"===U.c()&&(L=!1),F+=U.c();else{if(""===F)return v("Invalid input string."),null;if(null===(K=M(F,!b(o))))return null;if(o.host=K,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(U.c()))F+=U.c();else{if(!(""===U.c()||"/"===U.c()||"?"===U.c()||"#"===U.c()||b(o)&&"\\"===U.c()||i))return v("Invalid input string."),null;if(""!==F&&""!==F){var X=parseInt(F,10);if(X>Math.pow(2,16)-1)return v("Invalid port number."),null;o.port=X===x(o.scheme)?null:X,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,U.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===U.c()||"\\"===U.c())"\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(U.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(U.substring())?v("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),I(o)),A=s.ParserState.Path,U.pointer--}else A=s.ParserState.Path,U.pointer--;break;case s.ParserState.FileSlash:"/"===U.c()||"\\"===U.c()?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(U.substring())||(P(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,U.pointer--);break;case s.ParserState.FileHost:if(""===U.c()||"/"===U.c()||"\\"===U.c()||"?"===U.c()||"#"===U.c())if(U.pointer--,void 0===i&&O(F))v("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var K;if(null===(K=M(F,!b(o))))return null;if("localhost"===K&&(K=""),o.host=K,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=U.c();break;case s.ParserState.PathStart:b(o)?("\\"===U.c()&&v("Invalid input string."),A=s.ParserState.Path,"/"!==U.c()&&"\\"!==U.c()&&U.pointer--):void 0===i&&"?"===U.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):""!==U.c()&&(A=s.ParserState.Path,"/"!==U.c()&&U.pointer--);break;case s.ParserState.Path:if(""===U.c()||"/"===U.c()||b(o)&&"\\"===U.c()||void 0===i&&("?"===U.c()||"#"===U.c())){if(b(o)&&"\\"===U.c()&&v("Invalid input string."),D(F))I(o),"/"===U.c()||b(o)&&"\\"===U.c()||o.path.push("");else if(!E(F)||"/"===U.c()||b(o)&&"\\"===U.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&O(F)){null!==o.host&&""!==o.host&&(v("Invalid input string."),o.host="");var q=Array.from(F);F=q.slice(0,1)+":"+q.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===U.c()||"?"===U.c()||"#"===U.c()))for(;o.path.length>1&&""===o.path[0];)v("Invalid input string."),o.path.splice(0,1);"?"===U.c()&&(o.query="",A=s.ParserState.Query),"#"===U.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),F+=G(U.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===U.c()?(o.query="",A=s.ParserState.Query):"#"===U.c()?(o.fragment="",A=s.ParserState.Fragment):(""===U.c()||m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),""!==U.c()&&(o.path[0]+=G(U.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===U.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==U.c()){if(m.test(U.c())||"%"===U.c()||v("Character is not a URL code point or a percent encoded character."),"%"!==U.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(U.remaining())||v("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var $=a.utf8Encode(U.c());if($.length>=3&&38===$[0]&&35===$[1]&&59===$[$.length-1])$=$.subarray(2,$.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode($)+"%3B";else try{for(var Y=(g=void 0,r($)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=B(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(T=Y.return)&&T.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===U.c()||("\0"===U.c()?v("NULL character in input string."):(m.test(U.c())||"%"===U.c()||v("Unexpected character in fragment string."),"%"!==U.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(U.remaining())||v("Unexpected character in fragment string."),o.fragment+=G(U.c(),p)))}if(U.eof)break;U.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function I(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&P(t[0])||e.path.splice(e.path.length-1,1))}function P(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&O(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?k(e.substring(1,e.length-1)):(v("Expected ']' after '['."),null);if(t)return L(e);var n=W(a.utf8Decode(U(e)));if(null===n)return v("Invalid domain."),null;if(g.test(n))return v("Invalid domain."),null;var r=F(n);return null===r||a.isNumber(r)?r:n}function R(e,t){void 0===t&&(t={value:!1});var n=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),n=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),n=8),""===e?0:(10===n?/^[0-9]+$/:16===n?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,n):null}function F(e){var t,n,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=r(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(y=R(d,a)))return e;l.push(y)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a.value&&v("Invalid IP v4 address.");for(var p=0;p255&&(v("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return v("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=r(l),g=m.next();!g.done;g=m.next()){var y;f+=(y=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function k(e){var t,n=[0,0,0,0,0,0,0,0],r=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return v("Invalid IP v6 address."),null;s.pointer+=2,i=r+=1}for(;""!==s.c();){if(8===r)return v("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return v("Invalid IP v6 address."),null;if(s.pointer-=c,r>6)return v("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return v("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return v("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return v("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return v("Invalid IP v6 address."),null;s.pointer++}if(null===p)return v("Invalid IP v6 address."),null;n[r]=256*n[r]+p,2!=++d&&4!==d||r++}if(4!==d)return v("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return v("Invalid IP v6 address."),null}else if(""!==s.c())return v("Invalid IP v6 address."),null;n[r]=u,r++}else{if(null!==i)return v("Invalid IP v6 address."),null;s.pointer++,i=++r}}if(null!==i){var h=r-i;for(r=7;0!==r&&h>0;)t=o([n[i+h-1],n[r]],2),n[r]=t[0],n[i+h-1]=t[1],r--,h--}else if(null===i&&8!==r)return v("Invalid IP v6 address."),null;return n}function L(e){var t,n;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return v("Invalid host string."),null;var o="";try{for(var i=r(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function B(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function V(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},n=new Uint8Array(e.length),r=0,o=0;o=e.length-2)n[r]=i,r++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);n[r]=s,r++,o+=2}else n[r]=i,r++}return n.subarray(0,r)}function U(e){return V(a.utf8Encode(e))}function G(e,t){var n,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=r(i),u=l.next();!u.done;u=l.next())s+=B(u.value)}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}function z(e){var t,n,o,i,s=[],l=[];try{for(var u=r(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=r(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),v=-1!==g?m.slice(0,g):m,y=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):B(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var n=u.domainToASCII(e);return""===n?(v("Invalid domain name."),null):n}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=y,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=T,t.hostSerializer=S,t.iPv4Serializer=w,t.iPv6Serializer=C,t.urlParser=function(e,t,n){var r=A(e,t,n);return null===r?null:("blob"!==r.scheme||(r._blobURLEntry=null),r)},t.basicURLParser=A,t.setTheUsername=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.username=i},t.setThePassword=function(e,t){var n,o,i="";try{for(var a=r(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=I,t.isNormalizedWindowsDriveLetter=P,t.isWindowsDriveLetter=O,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=k,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=B,t.percentDecode=V,t.stringPercentDecode=U,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,n){return void 0===n&&(n=!1),T(e,n)===T(t,n)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var n,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var n=A(t.path[0]);return null===n?s.OpaqueOrigin:e(n);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var n=u.domainToUnicode(e);return""===n&&v("Invalid domain name."),n},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+S(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(){this._signal=r.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){r.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(70),a=n(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(34),s=n(12),l=function(e){function t(t,n,r){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=n,o._systemId=r,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=n(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var n=e.next();return n.done?{done:!0,value:null}:{done:!1,value:[t++,n.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var n,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=r(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.get=function(e,t,n){if(!i.isString(t))return Reflect.get(e,t,n);var r=Number(t);return isNaN(r)?Reflect.get(e,t,n):e._items[r]||void 0},e.prototype.set=function(e,t,n,r){if(!i.isString(t))return Reflect.set(e,t,n,r);var o=Number(t);return isNaN(o)?Reflect.set(e,t,n,r):o>=0&&o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),s=n(2),l=n(102),u=n(9),c=n(0),d=n(12),p=n(3),f=function(e){function t(){var t=e.call(this)||this,n=a.dom.window._associatedDocument;return t._start=[n,0],t._end=[n,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var n,r;switch(e){case s.HowToCompare.StartToStart:n=this._start,r=t._start;break;case s.HowToCompare.StartToEnd:n=this._end,r=t._start;break;case s.HowToCompare.EndToEnd:n=this._end,r=t._end;break;case s.HowToCompare.EndToStart:n=this._start,r=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(n,r);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,n,r;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var v=o;null!==v._parent&&!c.tree_isAncestorOf(s,v._parent,!0);)v=v._parent;if(null===v._parent)throw new Error("Parent node is null.");u=v._parent,d=c.tree_index(v)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var y=i(f),b=y.next();!b.done;b=y.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,n;try{for(var r=i(c.range_getPartiallyContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(n,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var n=[e,t];return c.boundaryPoint_position(n,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(n,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var n=c.tree_index(e);return c.boundaryPoint_position([t,n],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,n+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,n="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(n+=this._startNode._data.substring(this._startOffset));try{for(var r=i(c.range_getContainedNodes(this)),o=r.next();!o.done;o=r.next()){var a=o.value;p.Guard.isTextNode(a)&&(n+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(n+=this._endNode._data.substring(0,this._endOffset)),n},t._create=function(e,n){var r=new t;return e&&(r._start=e),n&&(r._end=n),r},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(103),a=n(0),s=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=n,o._pointerBeforeReference=r,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,n,r){return new t(e,n,r)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=n(103),s=n(0),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._current=n,r}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var n=s.traversal_filter(this,e);n!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,n=s.traversal_filter(this,e);if(n===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var n=null,r=e;null!==r;){if(r===this._root)return null;if(null!==(n=r._nextSibling)){e=n;break}r=r._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,n){return new t(e,n)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return r.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=n,this._removedNodes=r,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,n,r,o,i,a,s,l,u){return new e(t,n,r,o,i,a,s,l,u)},e}();t.MutationRecordImpl=r},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(9),a=n(7),s=n(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var n=t._localName,r=s.element_getAnAttributeValue(e,n),i=this;this._element._attributeChangeSteps.push((function(e,t,n,r,o){t===i._attribute._localName&&null===o&&(r?i._tokenSet=s.orderedSet_parse(r):i._tokenSet.clear())})),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,n,r,r,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,n,o=0;try{for(var i=r(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,n=[],o=0;o=97&&n<=122||n>=65&&n<=90||58===n||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==t&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,n=0;n=97&&r<=122||r>=65&&r<=90||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==n&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(0===n||58!==r){if(r>=55296&&r<=56319&&n=56320&&o<=57343&&(n++,(r=1024*(r-55296)+o-56320+65536)>=65536&&r<=983039))continue}return!1}if(t)return!1;if(n===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&n<=55295||n>=57344&&n<=65533)){if(n>=55296&&n<=56319&&t=56320&&r<=57343&&(t++,(n=1024*(n-55296)+r-56320+65536)>=65536&&n<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&n<=122||n>=65&&n<=90||n>=39&&n<=59||32===n||13===n||10===n||n>=35&&n<=37||33===n||61===n||63===n||64===n||95===n))return!1}return!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(17);t.boundaryPoint_position=function e(t,n){var i=t[0],a=t[1],s=n[0],l=n[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?r.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=n(29),l=n(108),u=n(30),c=n(37),d=n(52);t.node_stringReplaceAll=function(e,t){var n=null;""!==e&&(n=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(n,t)},t.node_clone=function e(t,n,a){var l,p,f,h,m;if(void 0===n&&(n=null),void 0===a&&(a=!1),null===n&&(n=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(n,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=r(t._attributeList),v=g.next();!v.done;v=g.next()){var y=e(v.value,n);d.element_append(y,m)}}catch(e){l={error:e}}finally{try{v&&!v.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(n,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(n,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(n,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(n,t._data):i.Guard.isCommentNode(t)?s.create_comment(n,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(n,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(n):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,n=m):m._nodeDocument=n,o.dom.features.steps&&u.dom_runCloningSteps(m,t,n,a),a)try{for(var _=r(t._children),T=_.next();!T.done;T=_.next()){var S=e(T.value,n,!0);c.mutation_append(S,m)}}catch(e){f={error:e}}finally{try{T&&!T.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,n){var o,a,s,l;if(t._nodeType!==n._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(n)){if(t._name!==n._name||t._publicId!==n._publicId||t._systemId!==n._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){if(t._namespace!==n._namespace||t._namespacePrefix!==n._namespacePrefix||t._localName!==n._localName||t._attributeList.length!==n._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(n)){if(t._namespace!==n._namespace||t._localName!==n._localName||t._value!==n._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(n)){if(t._target!==n._target||t._data!==n._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(n)&&t._data!==n._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(n)){var u={};try{for(var c=r(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=r(n._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==n._children.size)return!1;for(var g=t._children[Symbol.iterator](),v=n._children[Symbol.iterator](),y=g.next(),b=v.next();!y.done&&!b.done;){if(!e(y.value,b.value))return!1;y=g.next(),b=v.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,(function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e})):s.create_htmlCollection(t,(function(t){return t._qualifiedName===e}))},t.node_listOfElementsWithNamespace=function(e,t,n){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(n):"*"===e?s.create_htmlCollection(n,(function(e){return e._localName===t})):"*"===t?s.create_htmlCollection(n,(function(t){return t._namespace===e})):s.create_htmlCollection(n,(function(n){return n._localName===t&&n._namespace===e}))},t.node_listOfElementsWithClassNames=function(e,t){var n=l.orderedSet_parse(e);if(0===n.size)return s.create_htmlCollection(t,(function(){return!1}));var r="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,(function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,n,r)}))},t.node_locateANamespacePrefix=function e(t,n){if(t._namespace===n&&null!==t._namespacePrefix)return t._namespacePrefix;for(var r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(9),s=n(29),l=n(17),u=n(107),c=n(37);t.text_contiguousTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_contiguousExclusiveTextNodes=function(e,t){var n;return void 0===t&&(t=!1),(n={})[Symbol.iterator]=function(){for(var n=e;n&&i.Guard.isExclusiveTextNode(n._previousSibling);)n=n._previousSibling;return{next:function(){if(n&&!t&&n===e&&(n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null),null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=i.Guard.isExclusiveTextNode(n._nextSibling)?n._nextSibling:null,r}}},n},t.text_descendantTextContent=function(e){for(var t="",n=l.tree_getFirstDescendantNode(e,!1,!1,(function(e){return i.Guard.isTextNode(e)}));null!==n;)t+=n._data,n=l.tree_getNextDescendantNode(e,n,!1,!1,(function(e){return i.Guard.isTextNode(e)}));return t},t.text_split=function(e,t){var n,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=r(o.dom.rangeList),v=g.next();!v.done;v=g.next()){var y=v.value;y._start[0]===e&&y._start[1]>t&&(y._start[0]=h,y._start[1]-=t),y._end[0]===e&&y._end[1]>t&&(y._end[0]=h,y._end[1]-=t);var b=l.tree_index(e);y._start[0]===m&&y._start[1]===b+1&&y._start[1]++,y._end[0]===m&&y._end[1]===b+1&&y._end[1]++}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,n){"use strict";var r=n(4),o=n(41),i=n(24),a=n(48),s=[].join,l=o!=Object,u=a("join",",");r({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,n){var r=n(4),o=n(83),i=String.fromCharCode,a=String.fromCodePoint;r({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");n.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return n.join("")}})},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",n="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:n};var i=r(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?n=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var n=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:n,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var n=this.attribute();t.push(n)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var n=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),n},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var n=0;nthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,n){void 0===n&&(n=!1);for(var r=this._index;this._indexthis._index){i=n.index;break}throw this.err={line:r,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(182)]})},function(e,t,n){"use strict";var r=n(39);e.exports=new r({include:[n(113)],implicit:[n(289),n(290),n(291),n(292)]})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(91),o=n(1),i=n(3),a=n(77),s=n(109);function l(e,t){var n=c(void 0===e||u(e)?e:r.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,n);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!r.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,r.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,n){var r=e;r._xmlBuilderOptions=t,r._isFragment=n}t.builder=function(e,t){var n=c(u(e)?e:r.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(91),a=n(1),s=n(217),l=n(2),u=n(3),c=n(0),d=n(109),p=n(7),f=n(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,n,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(r+1)),t=t.slice(0,r)),void 0===e)e=n?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var n,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=r(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var v=g.value,y=v.prefix?v.prefix+":"+v.localName:v.localName,b=r(c.namespace_extractQName(y),1)[0],x=v.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(y,v.value):h.setAttributeNS(x,y,v.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var T=o(l.childNodes),S=T.next();!S.done;S=T.next()){var w=S.value.cloneNode(!0);if(h.appendChild(w),u.Guard.isElementNode(w)){var C=r(c.namespace_extractQName(w.prefix?w.prefix+":"+w.localName:w.localName),1)[0],A=h.lookupNamespaceURI(C);new e(w)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,n=t.parentNode;e=e||t.nodeName;var r=n?n.nodeName:"";return r?"node: <"+e+">, parent: <"+r+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,n){var r=n(11),o=n(117),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,n){var r=n(46),o=n(82),i=n(85),a=n(18);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){var r=n(16),o=n(15),i=n(18),a=n(61);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=r.length,l=0;s>l;)o.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var r=n(46);e.exports=r("document","documentElement")},function(e,t,n){var r=n(24),o=n(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){"use strict";var r=n(4),o=n(36).every,i=n(48),a=n(28),s=i("every"),l=a("every");r({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(36).filter,i=n(63),a=n(28),s=i("filter"),l=a("filter");r({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(46);e.exports=r("navigator","userAgent")||""},function(e,t,n){"use strict";var r=n(4),o=n(36).find,i=n(130),a=n(28),s=!0,l=a("find");"find"in[]&&Array(1).find((function(){s=!1})),r({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,n){"use strict";var r=n(131).IteratorPrototype,o=n(60),i=n(40),a=n(62),s=n(49),l=function(){return this};e.exports=function(e,t,n){var u=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,n){var r=n(8);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},function(e,t,n){var r=n(13);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,n){"use strict";var r=n(4),o=n(36).map,i=n(63),a=n(28),s=i("map"),l=a("map");r({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(4),o=n(200).left,i=n(48),a=n(28),s=i("reduce"),l=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(127),o=n(27),i=n(41),a=n(26),s=function(e){return function(t,n,s,l){r(n);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=n(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,n){"use strict";var r=n(4),o=n(36).some,i=n(48),a=n(28),s=i("some"),l=a("some");r({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){"use strict";var r=n(90),o=n(135);e.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){var r=n(8);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(e,t,n){var r=n(5),o=n(49),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,n){var r=n(135),o=n(49),i=n(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(18);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(13),o=n(133);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},function(e,t,n){var r=n(25);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(46),o=n(15),i=n(5),a=n(16),s=i("species");e.exports=function(e){var t=r(e),n=o.f;a&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;this._items.forEach((function(r){return e.call(t,r,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach((function(n,r){return e.call(t,r,n)}))},e.prototype.keys=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}}))},e.prototype.values=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}}))},e.prototype.entries=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}}))},e.prototype[Symbol.iterator]=function(){return r(this,(function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}}))},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var n=Math.random()<.5;if(n?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}return n},e}();t.CompareCache=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(218);t.MapWriter=r.MapWriter;var o=n(258);t.XMLWriter=o.XMLWriter;var i=n(67);t.ObjectWriter=i.ObjectWriter;var a=n(260);t.JSONWriter=a.JSONWriter;var s=n(261);t.YAMLWriter=s.YAMLWriter},function(e,t,n){"use strict";n(19),n(219),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(67),s=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=i.applyDefaults(n,{format:"map",wellFormed:!1,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(n)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o((function(){var e=[];return e[h]=!1,e.concat()[0]!==e})),g=d("concat"),v=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,n,r,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,n){"use strict";var r=n(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),t.BROKEN_CARET=r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},function(e,t,n){var r=n(223);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,n){var r=n(13),o=n(42),i=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){"use strict";n(68);var r=n(25),o=n(8),i=n(5),a=n(93),s=n(21),l=i("species"),u=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$
    ")})),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,d){var h=i(e),m=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),g=m&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var v=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?m&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=y[0],x=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,n){"use strict";var r=n(137).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},function(e,t,n){var r=n(42),o=n(93);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(r.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,n(145).Buffer)},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),c=0,d=s>0?a-4:a;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,l=(1<>1,c=-7,d=n?o-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){var t,n;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,n){var r,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=n);else if(c===t)return void(e[i]=n);i++}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}},t.insert=function(e,t,n){e.splice(n,0,t)},t.remove=function(e,t){for(var n=e.length;n--;){var r=e[n];if(s.isFunction(t))t.call(null,r)&&e.splice(n,1);else if(r===t)return void e.splice(n,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var n,r;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1},t.size=function(e,t){var n,r;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var n,o,i,s,l,u;return r(this,(function(r){switch(r.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return r.sent(),[3,9];case 2:r.trys.push([2,7,8,9]),n=a(e),o=n.next(),r.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:r.sent(),r.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return s=r.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}return[7];case 9:return[2]}}))},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?-1:1}))},t.sortInDescendingOrder=function(e,t){return e.sort((function(e,n){return t.call(null,e,n)?1:-1}))}},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(96),i=n(147),a=n(146),s=n(1);function l(e,t){for(var n=0;;){var r=n=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,n){if(!s.isArray(t))return f(e,Array.from(t),n);for(var r="";n.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,n;try{for(var o=r(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,n){if(!s.isArray(t))return e(Array.from(t),n);var r={position:0},o=[],i=f((function(e){return n!==e}),t,r);for(o.push(i);r.position=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,n;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=r(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(150),o=function(){function e(){}return e.asNode=function(e){if(r.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=r;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,n){"use strict";var r=n(245),o=n(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(248);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var k=P.slice(0,E),L=P.slice(E+1),B=N.match(h);B&&(k.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+V,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[T])for(E=0,O=c.length;E0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=S.slice(-1)[0],A=(n.host||e.host||S.length>1)&&("."===C||".."===C)||""===C,E=0,D=S.length;D>=0;D--)"."===(C=S[D])?S.splice(D,1):".."===C?(S.splice(D,1),E++):E&&(S.splice(D,1),E--);if(!_&&!T)for(;E--;E)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),A&&"/"!==S.join("/").substr(-1)&&S.push("");var I,P=""===S[0]||S[0]&&"/"===S[0].charAt(0);return w&&(n.hostname=n.host=P?"":S.length?S.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(_=_||n.host&&S.length)&&!P&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var o;!function(i){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function y(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+h(e)})).join("")}function x(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function T(e){var t,n,r,o,i,a,s,u,c,d,p,h=[],g=e.length,v=0,y=128,x=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),h.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&m("invalid-input"),((u=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>f((l-v)/a))&&m("overflow"),v+=u*a,!(u<(c=s<=x?1:s>=x+26?26:s-x));s+=36)a>f(l/(d=36-c))&&m("overflow"),a*=d;x=_(v-i,t=h.length+1,0==i),f(v/t)>l-y&&m("overflow"),y+=f(v/t),v%=t,h.splice(v++,0,y)}return b(h)}function S(e){var t,n,r,o,i,a,s,u,c,d,p,g,v,b,T,S=[];for(g=(e=y(e)).length,t=128,n=0,i=72,a=0;a=t&&pf((l-n)/(v=r+1))&&m("overflow"),n+=(s-t)*v,t=s,a=0;al&&m("overflow"),p==t){for(u=n,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)T=u-d,b=36-d,S.push(h(x(d+T%b,0))),u=f(T/b);S.push(h(x(u,0))),i=_(n,v,r==o),n=0,++r}++n,++t}return S.join("")}s={version:"1.4.1",ucs2:{decode:y,encode:b},decode:T,encode:S,toASCII:function(e){return v(e,(function(e){return c.test(e)?"xn--"+S(e):e}))},toUnicode:function(e){return v(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(o=function(){return s}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(246)(e),n(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(249),t.encode=t.stringify=n(250)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),n=!1,r=!1;return o.isBoolean(e)||(n=e.once||!1,r=e.passive||!1),[t,r,n]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var n,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;O--){var N;if(b(N=P[O],e)){I=N;break}}var M,R,F=[];try{for(var k=r(C._children),L=k.next();!L.done;L=k.next())if(y(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=k.return)&&a.call(k)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(S,_,!0))M=_,R=T;else{for(var B=_;null!==B._parent&&!c.tree_isAncestorOf(S,B._parent);)B=B._parent;if(null===B._parent)throw new Error("Parent node is null.");M=B._parent,R=1+c.tree_index(B)}if(l.Guard.isCharacterDataNode(A))(V=f.node_clone(_))._data=p.characterData_substringData(_,T,c.tree_nodeLength(_)-T),h.mutation_append(V,v),p.characterData_replaceData(_,T,c.tree_nodeLength(_)-T,"");else if(null!==A){var V=f.node_clone(A);h.mutation_append(V,v);var U=x(u.create_range([_,T],[A,c.tree_nodeLength(A)]));h.mutation_append(U,V)}try{for(var G=r(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,v)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(I)?((V=f.node_clone(S))._data=p.characterData_substringData(S,0,w),h.mutation_append(V,v),p.characterData_replaceData(S,0,w,"")):null!==I&&(V=f.node_clone(I),h.mutation_append(V,v),U=x(u.create_range([I,0],[S,w])),h.mutation_append(U,V)),e._start=[M,R],e._end=[M,R],v}t.range_collapsed=g,t.range_root=v,t.range_isContained=y,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._end)!==a.BoundaryPosition.After||(e._end=r),e._start=r},t.range_setTheEnd=function(e,t,n){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(n>c.tree_nodeLength(t))throw new s.IndexSizeError;var r=[t,n];v(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(r,e._start)!==a.BoundaryPosition.Before||(e._start=r),e._end=r},t.range_select=function(e,t){var n=e._parent;if(null===n)throw new s.InvalidNodeTypeError;var r=c.tree_index(e);t._start=[n,r],t._end=[n,r+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var n,o,a,d,m,v,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var T=t._startNode,S=t._startOffset,w=t._endNode,C=t._endOffset;T===w&&l.Guard.isCharacterDataNode(T)&&((L=f.node_clone(T))._data=p.characterData_substringData(T,S,C-S),h.mutation_append(L,_));for(var A=T;!c.tree_isAncestorOf(w,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(w,T,!0))try{for(var D=r(A._children),I=D.next();!I.done;I=D.next())if(b(M=I.value,t)){E=M;break}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=D.return)&&o.call(D)}finally{if(n)throw n.error}}var P=null;if(!c.tree_isAncestorOf(T,w,!0))for(var O=i(A._children),N=O.length-1;N>0;N--){var M;if(b(M=O[N],t)){P=M;break}}var R=[];try{for(var F=r(A._children),k=F.next();!k.done;k=F.next())if(y(G=k.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{k&&!k.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(T))._data=p.characterData_substringData(T,S,c.tree_nodeLength(T)-S),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var B=e(u.create_range([T,S],[E,c.tree_nodeLength(E)]));h.mutation_append(B,L)}try{for(var V=r(R),U=V.next();!U.done;U=V.next()){var G=U.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{U&&!U.done&&(v=V.return)&&v.call(V)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(P)?((L=f.node_clone(w))._data=p.characterData_substringData(w,0,C),h.mutation_append(L,_)):null!==P&&(L=f.node_clone(P),_.append(L),B=x(u.create_range([P,0],[w,C])),h.mutation_append(B,L)),_},t.range_insert=function(e,t){var n,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=r(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var v=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?v+=c.tree_nodeLength(e):v++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,v])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!y(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,n=c.tree_getFirstDescendantNode(t);return{next:function(){for(;n&&!b(n,e);)n=c.tree_getNextDescendantNode(t,n);if(null===n)return{done:!0,value:null};var r={done:!1,value:n};return n=c.tree_getNextDescendantNode(t,n),r}}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new r.NotSupportedError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(105);t.treeWalker_traverseChildren=function(e,t){for(var n=t?e._current._firstChild:e._current._lastChild;null!==n;){var i=o.traversal_filter(e,n);if(i===r.FilterResult.Accept)return e._current=n,n;if(i===r.FilterResult.Skip){var a=t?n._firstChild:n._lastChild;if(null!==a){n=a;continue}}for(;null!==n;){var s=t?n._nextSibling:n._previousSibling;if(null!==s){n=s;break}var l=n._parent;if(null===l||l===e._root||l===e._current)return null;n=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var n=e._current;if(n===e._root)return null;for(;;){for(var i=t?n._nextSibling:n._previousSibling;null!==i;){n=i;var a=o.traversal_filter(e,n);if(a===r.FilterResult.Accept)return e._current=n,n;i=t?n._firstChild:n._lastChild,a!==r.FilterResult.Reject&&null!==i||(i=t?n._nextSibling:n._previousSibling)}if(null===(n=n._parent)||n===e._root)return null;if(o.traversal_filter(e,n)===r.FilterResult.Accept)return null}}},function(e,t,n){"use strict";n(89),n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(2),s=n(50),l=n(3),u=function(e){function t(t,n){var r=e.call(this,t)||this;return r._indentation={},r._lengthToLastNewline=0,r._writerOptions=i.applyDefaults(n,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),r}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,n){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,n){this._beginLine(),this._refs.markup+=t&&n?"':t?"':n?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,n){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!n){for(var r=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){r=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&r&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(n||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=n?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+n.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+n):this._refs.markup+=" "+n},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,n){"use strict";var r=n(47),o=n(35);e.exports="".repeat||function(e){var t=String(o(this)),n="",i=r(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(n+=t);return n}},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;return r._writerOptions=s.applyDefaults(n,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(n,this._writerOptions)},t.prototype._convertObject=function(e,t,n){var r,o,a=this;void 0===n&&(n=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,n+1)+this._beginLine(t,n+1)+this._convertObject(h,t,n+1),d0?new Array(n).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var n=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,(function(e){return t+=n._descendantCount(e,t)}),this):s.isObject(e)?s.forEachObject(e,(function(e,r){return t+=n._descendantCount(r,t)}),this):t++,t},t}(n(50).BaseWriter);t.JSONWriter=l},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(178),n(89),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=n(67),s=n(1),l=function(e){function t(t,n){var r=e.call(this,t)||this;if(r._writerOptions=s.applyDefaults(n,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),r._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(r._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),n=new a.ObjectWriter(this._builderOptions,t).serialize(e),r=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(n,this._writerOptions,0);return r.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(r=r.slice(0,-this._writerOptions.newline.length)),r},t.prototype._convertObject=function(e,t,n,r){var o,a,l=this;void 0===r&&(r=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,n,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,n,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,(function(e,o){r?(u+=l._key(e),r=!1):u+=l._beginLine(t,n)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,n+1):u+=" "+l._val(o)+l._endLine(t)}),this);return u},t.prototype._beginLine=function(e,t,n){void 0===n&&(n=!1);var r=e.offset+t+1,o=new Array(r).join(e.indent);return n?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(50).BaseWriter);t.YAMLWriter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(110).dom.setFeatures(!0);var r=n(110);t.DOMImplementation=r.DOMImplementation;var o=n(271);t.DOMParser=o.DOMParser;var i=n(274);t.XMLSerializer=i.XMLSerializer},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(3),a=n(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var n,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,n;if(e.observer===c){s=!0;try{for(var o=(t=void 0,r(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,(function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e}))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=r(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,n=this;try{for(var o=r(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,(function(e){return e.observer===n}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._previousSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=r.Cast.asNode(this)._nextSibling;e;){if(r.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(r.Cast.asNode(this),!1,!1,(function(e){return r.Guard.isElementNode(e)}));null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(r.Cast.asNode(this),t,!1,!1,(function(e){return r.Guard.isElementNode(e)}))}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,n=0;try{for(var i=r(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&n++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),a=n(111),s=n(7),l=n(0),u=n(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,n,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var v=m;if(!l.xml_isPubidChar(v.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(v.sysId)||-1!==v.sysId.indexOf('"')&&-1!==v.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(v.name,v.pubId,v.sysId));break;case a.TokenType.CDATA:var y=m;if(!l.xml_isLegalChar(y.data)||-1!==y.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(y.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var T=m,S=r(l.namespace_extractQName(T.name),2),w=S[0],C=S[1];if(-1!==C.indexOf(":")||!l.xml_isName(C))throw new Error("Node local name contains invalid characters.");if("xmlns"===w)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(w),E={};try{for(var D=(t=void 0,o(T.attributes)),I=D.next();!I.done;I=D.next()){var P=r(I.value,2),O=P[0],N=P[1];if("xmlns"===O)A=N;else{var M=r(l.namespace_extractQName(O),2),R=M[0],F=M[1];"xmlns"===R&&(F===w&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{I&&!I.done&&(n=D.return)&&n.call(D)}finally{if(t)throw t.error}}var k=null!==A?f.createElementNS(A,T.name):f.createElement(T.name);h.appendChild(k);var L=new u.LocalNameSet;try{for(var B=(c=void 0,o(T.attributes)),V=B.next();!V.done;V=B.next()){var U=r(V.value,2),G=(O=U[0],N=U[1],r(l.namespace_extractQName(O),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=k.lookupNamespaceURI(R))&&k.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?k.setAttributeNS(z,O,this._decodeAttributeValue(N)):k.setAttribute(O,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(c)throw c.error}}T.selfClosing||(h=k);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(275);t.XMLSerializer=r.XMLSerializerImpl},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(69),a=n(95),s=n(9),l=n(7),u=n(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var n=new a.NamespacePrefixMap;n.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,n,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,n,r,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,n,r,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,n,r,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,n,r,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,n,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},v=this._recordNamespaceInformation(t,m,g),y=n,b=t.namespaceURI;if(y===b)null!==v&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===v||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==v&&v!==l.namespace.XML&&(y=v||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==v&&(y=v||null)):null===v||null!==v&&v!==b?(h=!0,y=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(y=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var T=b===l.namespace.HTML;if(T&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):T||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(T&&"template"===t.localName);else try{for(var S=r(t._children||t.childNodes),w=S.next();!w.done;w=S.next()){var C=w.value;d+=this._serializeNodeNS(C,y,m,i,a)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,n,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeDocumentFragmentNS=function(e,t,n,o,i){var a,s,l="";try{for(var u=r(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,n,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,n,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=r(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var v=g.namespaceURI,y=null;if(null!==v)if(y=t.get(g.prefix,v),v===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(y="xmlns")}else null===y&&(p+=" xmlns:"+(y=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,v)?this._generatePrefix(v,t,n):g.prefix)+'="'+this._serializeAttributeValue(v,s)+'"');if(p+=" ",null!==y&&(p+=y+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===v))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,n){var o,i,a=null;try{for(var s=r(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var n="",r=0;r"===o?">":o}return n},e.prototype._serializeElement=function(e,t){var n,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=r(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s+""},e.prototype._serializeDocument=function(e,t){var n,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var n,o,i="";try{for(var a=r(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype._serializeAttributes=function(e,t){var n,o,i="",a=t?{}:void 0;try{for(var s=r(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(277);t.XMLReader=r.XMLReader;var o=n(112);t.ObjectReader=o.ObjectReader;var i=n(280);t.JSONReader=i.JSONReader;var a=n(281);t.YAMLReader=a.YAMLReader},function(e,t,n){"use strict";n(31),n(32),n(33),n(19),n(65),n(20),n(22),n(23);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=n(180),l=n(111),u=n(7),c=n(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var n,r,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,v=this.sanitize(g.version);if("1.0"!==v)throw new Error("Invalid xml version: "+v);var y={version:v};g.encoding&&(y.encoding=this.sanitize(g.encoding)),g.standalone&&(y.standalone="yes"===this.sanitize(g.standalone)),h.set(y);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var T=m;h=this.instruction(h,this.sanitize(T.target),this.sanitize(T.data))||h;break;case l.TokenType.Text:var S=m;h=this.text(h,this._decodeText(this.sanitize(S.data)))||h;break;case l.TokenType.Element:var w=m,C=this.sanitize(w.name),A=i(c.namespace_extractQName(C),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var I=(n=void 0,a(w.attributes)),P=I.next();!P.done;P=I.next()){var O=i(P.value,2),N=O[0],M=O[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],k=R[1];"xmlns"===F&&(k===A&&(E=M),D[k]=M)}}}catch(e){n={error:e}}finally{try{P&&!P.done&&(r=I.return)&&r.call(I)}finally{if(n)throw n.error}}var L=null!==E?this.element(h,E,C):this.element(h,void 0,C);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var B=(o=void 0,a(w.attributes)),V=B.next();!V.done;V=B.next()){var U=i(V.value,2);N=U[0],M=U[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],k=G[1],null);"xmlns"===F||null===F&&"xmlns"===k?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{V&&!V.done&&(d=B.return)&&d.call(B)}finally{if(o)throw o.error}}w.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(n(75).BaseReader);t.XMLReader=d},function(e,t,n){var r=n(4),o=n(279);r({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,n){"use strict";var r=n(16),o=n(8),i=n(61),a=n(85),s=n(79),l=n(27),u=n(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o((function(){if(r&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=c({},e)[n]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,v=0;g>v;)f=m[v++],r&&!p.call(h,f)||(n[f]=h[f]);return n}:c},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(n(75).BaseReader);t.JSONReader=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(112),a=n(75),s=n(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var n=s.safeLoad(t);if(void 0===n)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,n)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,n){"use strict";var r=n(283);e.exports=r},function(e,t,n){"use strict";var r=n(284),o=n(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(10),e.exports.Schema=n(39),e.exports.FAILSAFE_SCHEMA=n(113),e.exports.JSON_SCHEMA=n(182),e.exports.CORE_SCHEMA=n(181),e.exports.DEFAULT_SAFE_SCHEMA=n(54),e.exports.DEFAULT_FULL_SCHEMA=n(76),e.exports.load=r.load,e.exports.loadAll=r.loadAll,e.exports.safeLoad=r.safeLoad,e.exports.safeLoadAll=r.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=n(53),e.exports.MINIMAL_SCHEMA=n(113),e.exports.SAFE_SCHEMA=n(54),e.exports.DEFAULT_SCHEMA=n(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,n){"use strict";var r=n(38),o=n(53),i=n(285),a=n(54),s=n(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function v(e){return 9===e||32===e||10===e||13===e}function y(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var T=new Array(256),S=new Array(256),w=0;w<256;w++)T[w]=x(w)?1:0,S[w]=x(w);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var I={YAML:function(e,t,n){var r,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),i=parseInt(r[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],p.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=o}};function P(e,t,n,r){var o,i,a,s;if(t1&&(e.result+=r.repeat("\n",t-1))}function L(e,t){var n,r,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&v(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,U(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(U(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else m(s)?(P(e,n,r,!0),k(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?C=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!v(r)&&!y(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(e)?(C=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,n){var r,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(v(c=e.input.charCodeAt(e.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(v(r=e.input.charCodeAt(e.position+1))||n&&y(r)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(v(r=e.input.charCodeAt(e.position+1))||n&&y(r))break}else if(35===c){if(v(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||n&&y(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(P(e,o,i,!1),k(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return P(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===n)&&(C=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(C=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||C}function G(e){var t,n,r,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!v(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(I,n)?I[n](e,n,r):D(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),U(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){n=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),r.repeat(" ",e)+n+s+i+"\n"+r.repeat(" ",e+this.position-o+n.length)+"^"},o.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=o},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(38),o=n(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=e.length,o=0,s=!1;if(!r)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===r)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,n){"use strict";var r=n(38),o=n(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,r,o;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){o.unshift(parseFloat(e,10))})),t=0,r=1,o.forEach((function(e){t+=e*r,r*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},function(e,t,n){"use strict";var r=n(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,n,r,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,r,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(n,r,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,n){"use strict";var r=n(10);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,n){"use strict";var r;try{r=n(145).Buffer}catch(e){}var o=n(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=i;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(n=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),r?r.from?r.from(u):new r(u):u},predicate:function(e){return r&&r.isBuffer(e)},represent:function(e){var t,n,r="",o=0,a=e.length,s=i;for(t=0;t>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]),o=(o<<8)+e[t];return 0==(n=a%3)?(r+=s[o>>18&63],r+=s[o>>12&63],r+=s[o>>6&63],r+=s[63&o]):2===n?(r+=s[o>>10&63],r+=s[o>>4&63],r+=s[o<<2&63],r+=s[64]):1===n&&(r+=s[o>>2&63],r+=s[o<<4&63],r+=s[64],r+=s[64]),r}})},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,a,s,l=[],u=e;for(t=0,n=u.length;t3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,n){"use strict";var r;try{r=n(302)}catch(e){"undefined"!=typeof window&&(r=window.esprima)}var o=n(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=r.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",o=r.parse(n,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach((function(e){i.push(e.name)})),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,n.slice(t[0]+1,t[1]-1)):new Function(i,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,n){var r;r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(3),i=n(8),a=n(15);function s(e,t,n){var a=null,s=function(e,t){n&&n(e,t),a&&a.visit(e,t)},l="function"==typeof n?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new r.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,n){var r=t||{};return r.sourceType="module",s(e,r,n)},t.parseScript=function(e,t,n){var r=t||{};return r.sourceType="script",s(e,r,n)},t.tokenize=function(e,t,n){var r,o=new a.Tokenizer(e,t);r=[];try{for(;;){var i=o.getNextToken();if(!i)break;n&&(i=n(i)),r.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var l=n(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===r.Syntax.BlockStatement&&0===e.body.length){for(var n=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(n.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var r=this.trailing[n];r.start>=e.end.offset&&t.unshift(r.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,n=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var r=(t.leadingComments?t.leadingComments.length:0)-1;r>=0;--r){var o=t.leadingComments[r];o.range[1]<=e.start.offset&&(n.unshift(o),t.leadingComments.splice(r,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,n}for(r=this.leading.length-1;r>=0;--r){var i;(i=this.leading[r]).start<=e.start.offset&&(n.unshift(i.comment),this.leading.splice(r,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===r.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var n=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),n.length>0&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",r={type:n,value:e.value};if(e.range&&(r.range=e.range),e.loc&&(r.loc=e.loc),this.comments.push(r),this.attach){var o={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=n,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),a=n(5),s=n(6),l=n(7),u=n(8),c=n(13),d=n(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var n=e;t=p(n.namespace)+":"+p(n.name);break;case s.JSXSyntax.JSXMemberExpression:var r=e;t=p(r.object)+"."+p(r.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",n=!0,r=!1,o=!1,a=!1;!this.scanner.eof()&&n&&!r;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(r=";"===s,t+=s,++this.scanner.index,!r)switch(t.length){case 2:o="#"===s;break;case 3:o&&(n=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:n=(n=n&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,n=this.scanner.source[this.scanner.index++],r="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==n;)r+="&"===l?this.scanXHTMLEntity(n):l;return{type:8,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var n=this.scanner.source[this.scanner.index];if("{"===n||"<"===n)break;++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var r={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(r)),r},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var r=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),n=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=n;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(r,o))}else e=n;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,n))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,r,n))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var n=this.parseJSXElementName(),r=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(n,o,r))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],r=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:r,children:n});n=o.children,r=o.closing}return this.finalize(e,new a.JSXElement(t,n,r))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&n.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&n.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.JSXClosingElement=function(e){this.type=r.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,n){this.type=r.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n};t.JSXEmptyExpression=function(){this.type=r.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=r.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=r.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=r.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=r.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=r.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,n){this.type=r.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n};t.JSXSpreadAttribute=function(e){this.type=r.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=r.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.ArrayExpression=function(e){this.type=r.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=r.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!1};t.AssignmentExpression=function(e,t,n){this.type=r.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n};t.AssignmentPattern=function(e,t){this.type=r.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,n){this.type=r.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,n){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,n){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=r.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,n){var o="||"===e||"&&"===e;this.type=o?r.Syntax.LogicalExpression:r.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n};t.BlockStatement=function(e){this.type=r.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=r.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=r.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=r.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=r.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,n){this.type=r.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n};t.ClassExpression=function(e,t,n){this.type=r.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n};t.ComputedMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,n){this.type=r.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n};t.ContinueStatement=function(e){this.type=r.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=r.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=r.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=r.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=r.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=r.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=r.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,n){this.type=r.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n};t.ExportSpecifier=function(e,t){this.type=r.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=r.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,n){this.type=r.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1};t.ForOfStatement=function(e,t,n){this.type=r.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n};t.ForStatement=function(e,t,n,o){this.type=r.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=o};t.FunctionDeclaration=function(e,t,n,o){this.type=r.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,n,o){this.type=r.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=r.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,n){this.type=r.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n};t.ImportDeclaration=function(e,t){this.type=r.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=r.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=r.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=r.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=r.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=r.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=r.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,n,o,i){this.type=r.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=o,this.static=i};t.Module=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=r.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=r.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=r.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,n,o,i,a){this.type=r.Syntax.Property,this.key=t,this.computed=n,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,n,o){this.type=r.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:n,flags:o}};t.RestElement=function(e){this.type=r.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=r.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=r.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=r.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=r.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=r.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=r.Syntax.Super};t.SwitchCase=function(e,t){this.type=r.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=r.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=r.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=r.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=r.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=r.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=r.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,n){this.type=r.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n};t.UnaryExpression=function(e,t){this.type=r.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,n){this.type=r.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n};t.VariableDeclaration=function(e,t){this.type=r.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=r.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=r.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=r.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=r.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(10),i=n(11),a=n(7),s=n(12),l=n(2),u=n(13),c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=n,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,n,r=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(r,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(t.value,n));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal("true"===t.value,n));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.Literal(null,n));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),n=this.getTokenRaw(t),e=this.finalize(r,new a.RegexLiteral(t.regex,n,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(r,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(r,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=n,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters(),r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,n=this.context.await;this.context.allowYield=!1,this.context.await=!0;var r=this.parseFormalParameters(),o=this.parsePropertyMethod(r);return this.context.allowYield=t,this.context.await=n,this.finalize(e,new a.AsyncFunctionExpression(null,r.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),n=this.nextToken();switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,i.Messages.StrictOctalLiteral);var r=this.getTokenRaw(n);e=this.finalize(t,new a.Literal(n.value,r));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(n.value));break;case 7:"["===n.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(n);break;default:e=this.throwUnexpectedToken(n)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,n=this.createNode(),r=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===r.type){var p=r.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(n,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===r.type&&!d&&"get"===r.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===r.type&&!d&&"set"===r.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===r.type&&"*"===r.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===r.type)if(p=this.finalize(n,new a.Identifier(r.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(n,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(n,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){r.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n=t.value,r=t.cooked;return this.finalize(e,new a.TemplateElement({raw:n,cooked:r},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],r=this.parseTemplateHead();for(n.push(r);!r.tail;)t.push(this.parseExpression()),r=this.parseTemplateElement(),n.push(r);return this.finalize(e,new a.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var r=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(r=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,n.value,s],u=[r];!((r=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&r<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(r),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,r,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var n=0;n")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var v=e;this.scanner.isRestrictedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(v.name)&&this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var y=(n=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(y,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var n=[];for(n.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),r=this.parsePattern([],e);this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&r.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new a.VariableDeclarator(r,o))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;r.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var o=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("...");var r=this.parsePattern(e,t);return this.finalize(n,new a.RestElement(r))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var r=[];!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(e,t));break}r.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new a.ArrayPattern(r))},e.prototype.parsePropertyPattern=function(e,t){var n,r,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;n=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();r=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),r=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,r=u)}else i=this.match("["),n=this.parseObjectPropertyKey(),this.expect(":"),r=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",n,i,r,!1,s))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new a.ObjectPattern(r))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,r=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,r=this.finalize(this.startNode(n),new a.AssignmentPattern(r,i))}return r},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,i.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.await)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(t,new a.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(n,r))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),n=null;this.expectKeyword("if"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new a.IfStatement(r,e,n))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(n,r))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var r=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=r}return this.finalize(t,new a.WhileStatement(n,e))},e.prototype.parseForStatement=function(){var e,t,n,r=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(r=this.finalize(r,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new a.VariableDeclaration(p,h)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,u=!1):(this.consumeSemicolon(),r=this.finalize(r,new a.VariableDeclaration(p,h)))):(r=this.finalize(r,new a.Identifier(h)),this.nextToken(),e=r,t=this.parseExpression(),r=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,u=!1;else{if(this.match(",")){for(var g=[r];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var v=this.context.inIteration;this.context.inIteration=!0,n=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=v}return void 0===e?this.finalize(c,new a.ForStatement(r,o,s,n)):u?this.finalize(c,new a.ForInStatement(e,t,n)):this.finalize(c,new a.ForOfStatement(e,t,n))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier();t=n;var r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var n=this.parseVariableIdentifier(),r="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,n.name),t=n}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(n,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var r=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),r.push(s)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new a.SwitchStatement(t,r))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),n=this.parseExpression();if(n.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var r=n,o="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",r.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(r,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(n);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),r={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();1!==n.params.length?this.tolerateError(i.Messages.BadSetterArity):n.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var r=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,n.params,r,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var r=this.context.allowYield;this.context.allowYield=!1,(n=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=r}return this.finalize(e,new a.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),r="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(r="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(r="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(r="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!r&&o&&this.match("(")&&(r="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==r||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,r="constructor")),this.finalize(n,new a.MethodDefinition(o,l,s,r,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=n,this.finalize(t,new a.ClassDeclaration(r,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=3===this.lookahead.type?this.parseVariableIdentifier():null,r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(n,r,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e,t,n=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(n,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(n,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(n))}else this.matchKeyword("class")?(n=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):this.matchContextualKeyword("async")?(n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(n))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(n)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(r,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(n=void 0,this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null))}else if(this.matchAsyncFunction())n=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(n,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(r=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(r,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}return n},e.prototype.createError=function(e,t,n,r){var o="Line "+t+": "+r,i=this.constructError(o,n);return i.index=e,i.lineNumber=t,i.description=r,i},e.prototype.throwError=function(e,t,n,r){throw this.createError(e,t,n,r)},e.prototype.tolerateError=function(e,t,n,r){var o=this.createError(e,t,n,r);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(4),i=n(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,n,r=[];for(this.trackComment&&(r=[],t=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:n};r.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}return this.trackComment&&(n.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:n},r.push(a)),r},e.prototype.skipMultiLineComment=function(){var e,t,n=[];for(this.trackComment&&(n=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};n.push(i)}return n}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},n.push(i)),this.tolerateUnexpectedToken(),n},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(n))++this.index;else if(o.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n)if(47===(n=this.source.charCodeAt(this.index+1))){this.index+=2;var r=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(r)),t=!0}else{if(42!==n)break;this.index+=2,r=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(r))}else if(t&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,r=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(r))}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,r=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(r))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var n=this.source.charCodeAt(e+1);n>=56320&&n<=57343&&(t=1024*(t-55296)+n-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,n=0,r=0;r1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),n=o.Character.fromCodePoint(t);for(this.index+=n.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),n=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)n+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),n+=e);return n},e.prototype.octalToDecimal=function(e){var t="0"!==e,n=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+s(this.source[this.index++]))),{code:n,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,n=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3)&&t+n.length!==this.index){var r=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=r}return{type:e,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,n="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)n+=this.source[this.index++];return 0===n.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var n="",r=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(e,t,n){var o=parseInt(t||n,16);return o>1114111&&r.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(n)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];r.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else{if("/"===e){a=!0;break}"["===e&&(n=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var n=this.index,r=this.scanHexEscape("u");if(null!==r)for(e+=r;n=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),o=n(12),i=n(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(r=this.values[this.curly-4])&&!this.beforeFunctionExpression(r);else if("function"===this.values[this.curly-4]){var r;t=!(r=this.values[this.curly-5])||!this.beforeFunctionExpression(r)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&n>=e.flowLevel;switch(function(e,t,n,r,o){var i,a,s,l,u=!1,c=!1,d=-1!==r,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&v(a,s)}else{for(i=0;ir&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&v(a,s)}c=c||d&&i-p-1>r&&" "!==e[p+1]}return u||c?n>9&&y(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+x(t,e.indent)+_(f(function(e,t){for(var n,r,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,T(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];r=i.exec(e);){var l=r[1],u=r[2];n=" "===u[0],a+=l+(s||n||""===u?"":"\n")+T(u,t),s=n}return a}(t,a),i));case 5:return'"'+function(e){for(var t,n,r,o="",i=0;i=55296&&t<=56319&&(n=e.charCodeAt(i+1))>=56320&&n<=57343?(o+=d(1024*(t-55296)+n-56320+65536),i++):o+=!(r=u[t])&&g(t)?e[i]:r||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var n=y(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function T(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,i=0,a=0,s=0,l="";n=o.exec(e);)(s=n.index)-i>t&&(r=a>i?a:s,l+="\n"+e.slice(i,r),i=r+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function S(e,t,n){var r,i,a,u,c,d;for(a=0,u=(i=n?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');r=c.represent[d](t,d)}e.dump=r}return!0}return!1}function w(e,t,n,r,i,a){e.tag=null,e.dump=n,S(e,n,!1)||S(e,n,!0);var l=s.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),w(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var r,o,i,a,s,l="",u=e.tag,c=Object.keys(n);for(r=0,o=c.length;r1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),w(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;r&&0!==e.dump.length?(function(e,t,n,r){var o,i,a="",s=e.tag;for(o=0,i=n.length;o "+e.dump)}return!0}function C(e,t){var n=new p(t=t||{});return n.noRefs||function(e,t){var n,r,o=[],i=[];for(function e(t,n,r){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=n.indexOf(t)))-1===r.indexOf(i)&&r.push(i);else if(n.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(91),l=n(1),u=n(183),c=n(0),d=n(7),p=n(95),f=n(69),h=n(3),m=n(305),g=n(306),v=n(307),y=function(e){function t(t,n){void 0===n&&(n=!1);var r=e.call(this)||this;return r._hasDeclaration=!1,r._docTypeName="",r._hasDocumentElement=!1,r._currentElementSerialized=!1,r._openTags=[],r._ended=!1,r._fragment=n,r._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),r._builderOptions={defaultNamespace:r._options.defaultNamespace,namespaceAlias:r._options.namespaceAlias},"json"===r._options.format?r._writer=new g.JSONCBWriter(r._options):"yaml"===r._options.format?r._writer=new v.YAMLCBWriter(r._options):r._writer=new m.XMLCBWriter(r._options),void 0!==r._options.data&&r.on("data",r._options.data),void 0!==r._options.end&&r.on("end",r._options.end),void 0!==r._options.error&&r.on("error",r._options.error),r._prefixMap=new p.NamespacePrefixMap,r._prefixMap.set("xml",d.namespace.XML),r._prefixIndex={value:1},r._push(r._writer.frontMatter()),r}return o(t,e),t.prototype.ele=function(e,t,n){var r,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(n)),this},t.prototype.ins=function(e,t){var n;void 0===t&&(t=""),this._serializeOpenTag(!0);try{n=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==n.target.indexOf(":")||/^xml$/i.test(n.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(n.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(n.target,n.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,n,r=u.fragment().set(this._options);try{r.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(r.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var n=this._currentElement.node;if(!this._options.wellFormed||-1===n.localName.indexOf(":")&&c.xml_isName(n.localName)){var r="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(n,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=n.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),r=u===d.namespace.XML?"xml:"+n.localName:n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r));else{var p=n.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(r=f+":"+n.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(r),this._push(this._writer.openTagBegin(r))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),r+=p+":"+n.localName,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(r+=n.localName,l=u,this._writer.beginElement(r),this._push(this._writer.openTagBegin(r)))}this._serializeAttributes(n,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(n.localName)?(this._push(this._writer.openTagEnd(r,!0,!0)),this._writer.endElement(r)):h||e?this._push(this._writer.openTagEnd(r,!1,!1)):(this._push(this._writer.openTagEnd(r,!0,!1)),this._writer.endElement(r)),this._currentElementSerialized=!0,this._openTags.push([r,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),n=t[0],r=(t[1],t[2]),o=t[3];this._prefixMap=r,o&&(this._push(this._writer.closeTag(n)),this._writer.endElement(n))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,n,r,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,n,r,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,v=null;if(null!==g)if(v=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in r)||r[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(v="xmlns")}else null===v&&(v=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,n):m.prefix,this._push(this._writer.attribute("xmlns:"+v,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==v?v+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,n){var r,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),n[f]=h||""}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a},t.prototype._generatePrefix=function(e,t,n){var r="ns"+n.value;return n.value++,t.set(r,e),r},t.prototype._isPrefixMapModified=function(e,t){var n=e._items,r=t._items,o=e._nullItems,i=t._nullItems;for(var a in r){var s=n[a];if(void 0===s)return!0;var l=r[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,n){return this._beginLine()+(t&&n?"':t?"':n?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,n){return n?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var n=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+n.length>this._writerOptions.width?(n=this._beginLine()+this._indent(1)+n,this._lineLength=n.length,n):(this._lineLength+=1+n.length," "+n)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(n(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;return n._hasChildren=[],n._additionalLevel=0,n}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,n){if(t){var r=this._sep()+"]";return this._additionalLevel--,r+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,n){"use strict";n(74);var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var n=e.call(this,t)||this;if(n._rootWritten=!1,n._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,n){return""},t.prototype.docType=function(e,t,n){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var n=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,n},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,n){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var n=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?n.substr(0,n.length-2)+"-"+n.substr(-1,1):n},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(n(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,a,s;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(77);t.createCB=function(e){return new r.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new r.XMLBuilderCBImpl(e,!0)}}])},551:function(e,t,n){"use strict";var r=n(22),o=n.n(r),i=n(793),a=n.n(i)()(o());a.push([e.id,"body {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\nbutton {\n position: absolute;\n left: 10px;\n top: 10px;\n width: 200px;\n z-index: 2;\n cursor: pointer;\n}\n",""]),a.locals={},t.Z=a},991:function(e,t,n){var r=n(775),o=n(903);void 0===o.WebXRVolume&&(o.WebXRVolume=r),e.exports=r},892:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},865:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},706:function(){}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},n.nc=void 0,n(991)}(); \ No newline at end of file diff --git a/examples/WidgetManager.html b/examples/WidgetManager.html index dbc880eb3e6..1ff9861e359 100644 --- a/examples/WidgetManager.html +++ b/examples/WidgetManager.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/WidgetRepresentation.html b/examples/WidgetRepresentation.html index 71a97367946..066a2faa9fd 100644 --- a/examples/WidgetRepresentation.html +++ b/examples/WidgetRepresentation.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/WindowedSincPolyDataFilter.html b/examples/WindowedSincPolyDataFilter.html index f7221491ddc..18d42c3ebbe 100644 --- a/examples/WindowedSincPolyDataFilter.html +++ b/examples/WindowedSincPolyDataFilter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/XMLImageDataWriter.html b/examples/XMLImageDataWriter.html index ba6fa606458..a920cc2f194 100644 --- a/examples/XMLImageDataWriter.html +++ b/examples/XMLImageDataWriter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/XMLPolyDataWriter.html b/examples/XMLPolyDataWriter.html index 3840470b5fd..a5e6f211f36 100644 --- a/examples/XMLPolyDataWriter.html +++ b/examples/XMLPolyDataWriter.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/ZipHttpReader.html b/examples/ZipHttpReader.html index 29efa3e2b2f..77bfe734840 100644 --- a/examples/ZipHttpReader.html +++ b/examples/ZipHttpReader.html @@ -48,8 +48,8 @@ - - + + @@ -120,7 +120,7 @@

    diff --git a/examples/index.html b/examples/index.html index 742bb24b605..596ccf6e81a 100644 --- a/examples/index.html +++ b/examples/index.html @@ -104,8 +104,8 @@ - - + + @@ -238,7 +238,7 @@

    diff --git a/index.html b/index.html index 931ffb3f9a7..beec0cabfe8 100644 --- a/index.html +++ b/index.html @@ -49,8 +49,8 @@ - - + + diff --git a/sitemap.xml b/sitemap.xml index 7649e8343ba..36242f85137 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,7 +4,7 @@ https://kitware.github.io/vtk-js/examples/LineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -13,7 +13,7 @@ https://kitware.github.io/vtk-js/examples/PaintWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -22,7 +22,7 @@ https://kitware.github.io/vtk-js/examples/PolyLineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -31,7 +31,7 @@ https://kitware.github.io/vtk-js/examples/ResliceCursorWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -40,7 +40,7 @@ https://kitware.github.io/vtk-js/examples/SeedWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -49,7 +49,7 @@ https://kitware.github.io/vtk-js/examples/ShapeWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -58,7 +58,7 @@ https://kitware.github.io/vtk-js/examples/SphereWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -67,7 +67,7 @@ https://kitware.github.io/vtk-js/examples/SplineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -76,7 +76,7 @@ https://kitware.github.io/vtk-js/examples/AngleWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -85,7 +85,7 @@ https://kitware.github.io/vtk-js/examples/ImageCroppingWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -94,7 +94,7 @@ https://kitware.github.io/vtk-js/examples/ImplicitPlaneRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -103,7 +103,7 @@ https://kitware.github.io/vtk-js/examples/ImplicitPlaneWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -112,7 +112,7 @@ https://kitware.github.io/vtk-js/examples/InteractiveOrientationWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -121,16 +121,7 @@ https://kitware.github.io/vtk-js/examples/LabelWidget.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/examples/PolyDataSerialization.html - - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -139,7 +130,7 @@ https://kitware.github.io/vtk-js/examples/StandaloneSceneLoader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -148,7 +139,7 @@ https://kitware.github.io/vtk-js/examples/WidgetManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -157,7 +148,7 @@ https://kitware.github.io/vtk-js/examples/WidgetRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -166,7 +157,7 @@ https://kitware.github.io/vtk-js/examples/ActorSerialization.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -175,205 +166,205 @@ https://kitware.github.io/vtk-js/examples/PipelineExecution.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/RemoteView.html + https://kitware.github.io/vtk-js/examples/PolyDataSerialization.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/RenderWindowWithControlBar.html + https://kitware.github.io/vtk-js/examples/RemoteView.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/SurfaceLICMapper.html + https://kitware.github.io/vtk-js/examples/RenderWindowWithControlBar.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/SynchronizableRenderWindow.html + https://kitware.github.io/vtk-js/examples/SurfaceLICMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeMapper.html + https://kitware.github.io/vtk-js/examples/SynchronizableRenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Glyph3DMapper.html + https://kitware.github.io/vtk-js/examples/ImageResliceMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/HardwareSelector.html + https://kitware.github.io/vtk-js/examples/PointPicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageCPRMapper.html + https://kitware.github.io/vtk-js/examples/ScalarBarActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageMapper.html + https://kitware.github.io/vtk-js/examples/SphereMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageResliceMapper.html + https://kitware.github.io/vtk-js/examples/StickMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PointPicker.html + https://kitware.github.io/vtk-js/examples/VolumeMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ScalarBarActor.html + https://kitware.github.io/vtk-js/examples/CellPicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/SphereMapper.html + https://kitware.github.io/vtk-js/examples/Glyph3DMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/StickMapper.html + https://kitware.github.io/vtk-js/examples/HardwareSelector.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/AnimationProxyManager.html + https://kitware.github.io/vtk-js/examples/ImageCPRMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/CellPicker.html + https://kitware.github.io/vtk-js/examples/ImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/JSONNucleoReader.html + https://kitware.github.io/vtk-js/examples/ResliceRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/OBJReader.html + https://kitware.github.io/vtk-js/examples/View2DProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PDBReader.html + https://kitware.github.io/vtk-js/examples/AnimationProxyManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ProxyManager.html + https://kitware.github.io/vtk-js/examples/OBJReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ResliceRepresentationProxy.html + https://kitware.github.io/vtk-js/examples/PDBReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/View2DProxy.html + https://kitware.github.io/vtk-js/examples/ProxyManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -382,7 +373,7 @@ https://kitware.github.io/vtk-js/examples/XMLImageDataWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -391,7 +382,7 @@ https://kitware.github.io/vtk-js/examples/XMLPolyDataWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -400,7 +391,7 @@ https://kitware.github.io/vtk-js/examples/DracoReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -409,178 +400,169 @@ https://kitware.github.io/vtk-js/examples/ElevationReader.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/examples/HttpDataSetReader.html - - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/HttpDataSetSeriesReader.html + https://kitware.github.io/vtk-js/examples/JSONNucleoReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/HttpSceneLoader.html + https://kitware.github.io/vtk-js/examples/PLYReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageStream.html + https://kitware.github.io/vtk-js/examples/PLYWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PLYReader.html + https://kitware.github.io/vtk-js/examples/PolyDataReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PLYWriter.html + https://kitware.github.io/vtk-js/examples/STLReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PolyDataReader.html + https://kitware.github.io/vtk-js/examples/STLWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/STLReader.html + https://kitware.github.io/vtk-js/examples/HttpDataSetReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/STLWriter.html + https://kitware.github.io/vtk-js/examples/HttpDataSetSeriesReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/DeviceOrientationToCamera.html + https://kitware.github.io/vtk-js/examples/HttpSceneLoader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/InteractorStyleMPRSlice.html + https://kitware.github.io/vtk-js/examples/ImageStream.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/InteractorStyleManipulator.html + https://kitware.github.io/vtk-js/examples/OrientationMarkerWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/InteractorStyleTrackballCamera.html + https://kitware.github.io/vtk-js/examples/PiecewiseGaussianWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/InteractorStyleUnicam.html + https://kitware.github.io/vtk-js/examples/DeviceOrientationToCamera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/MouseCameraTrackballFirstPersonManipulator.html + https://kitware.github.io/vtk-js/examples/InteractorStyleMPRSlice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/MouseRangeManipulator.html + https://kitware.github.io/vtk-js/examples/InteractorStyleManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/OrientationMarkerWidget.html + https://kitware.github.io/vtk-js/examples/InteractorStyleTrackballCamera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PiecewiseGaussianWidget.html + https://kitware.github.io/vtk-js/examples/InteractorStyleUnicam.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/CylinderSource.html + https://kitware.github.io/vtk-js/examples/MouseRangeManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -589,16 +571,7 @@ https://kitware.github.io/vtk-js/examples/KeyboardCameraManipulator.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/examples/LineSource.html - - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -607,16 +580,16 @@ https://kitware.github.io/vtk-js/examples/MouseBoxSelectorManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PlaneSource.html + https://kitware.github.io/vtk-js/examples/MouseCameraTrackballFirstPersonManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -625,7 +598,7 @@ https://kitware.github.io/vtk-js/examples/PointSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -634,7 +607,7 @@ https://kitware.github.io/vtk-js/examples/SLICSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -643,7 +616,7 @@ https://kitware.github.io/vtk-js/examples/SphereSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -652,7 +625,7 @@ https://kitware.github.io/vtk-js/examples/TimeStepBasedAnimationHandler.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -661,7 +634,7 @@ https://kitware.github.io/vtk-js/examples/ArrowSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -670,7 +643,7 @@ https://kitware.github.io/vtk-js/examples/CircleSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -679,7 +652,7 @@ https://kitware.github.io/vtk-js/examples/ConcentricCylinderSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -688,7 +661,7 @@ https://kitware.github.io/vtk-js/examples/ConeSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -697,7 +670,7 @@ https://kitware.github.io/vtk-js/examples/CubeSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -706,205 +679,205 @@ https://kitware.github.io/vtk-js/examples/Cursor3D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/WindowedSincPolyDataFilter.html + https://kitware.github.io/vtk-js/examples/CylinderSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageStreamline.html + https://kitware.github.io/vtk-js/examples/LineSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/OBBTree.html + https://kitware.github.io/vtk-js/examples/PlaneSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/OutlineFilter.html + https://kitware.github.io/vtk-js/examples/WindowedSincPolyDataFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ScalarToRGBA.html + https://kitware.github.io/vtk-js/examples/ImageMarchingCubes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/TriangleFilter.html + https://kitware.github.io/vtk-js/examples/ImageMarchingSquares.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/TubeFilter.html + https://kitware.github.io/vtk-js/examples/ImageOutlineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/WarpScalar.html + https://kitware.github.io/vtk-js/examples/ImageStreamline.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Calculator.html + https://kitware.github.io/vtk-js/examples/OBBTree.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ClipClosedSurface.html + https://kitware.github.io/vtk-js/examples/OutlineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ContourTriangulator.html + https://kitware.github.io/vtk-js/examples/ScalarToRGBA.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Cutter.html + https://kitware.github.io/vtk-js/examples/TriangleFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageCropFilter.html + https://kitware.github.io/vtk-js/examples/TubeFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageMarchingCubes.html + https://kitware.github.io/vtk-js/examples/WarpScalar.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageMarchingSquares.html + https://kitware.github.io/vtk-js/examples/Box.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageOutlineFilter.html + https://kitware.github.io/vtk-js/examples/Calculator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PolyDataNormals.html + https://kitware.github.io/vtk-js/examples/ClipClosedSurface.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Box.html + https://kitware.github.io/vtk-js/examples/ContourTriangulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImplicitBoolean.html + https://kitware.github.io/vtk-js/examples/Cutter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/WebXRChestCTBlendedCVR.html + https://kitware.github.io/vtk-js/examples/ImageCropFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/WebXRHeadFullVolumeCVR.html + https://kitware.github.io/vtk-js/examples/ImplicitBoolean.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/WebXRHeadGradientCVR.html + https://kitware.github.io/vtk-js/examples/PolyDataNormals.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -913,7 +886,7 @@ https://kitware.github.io/vtk-js/examples/WebXRVolume.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -922,214 +895,214 @@ https://kitware.github.io/vtk-js/examples/ZipHttpReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/TestVolumeTypes.html + https://kitware.github.io/vtk-js/examples/VolumePicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeClipPlane.html + https://kitware.github.io/vtk-js/examples/VolumeRenderingWithPolyData.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeContour.html + https://kitware.github.io/vtk-js/examples/WebXRChestCTBlendedCVR.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeMapperBlendModes.html + https://kitware.github.io/vtk-js/examples/WebXRHeadFullVolumeCVR.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeMapperLightAndShadow.html + https://kitware.github.io/vtk-js/examples/WebXRHeadGradientCVR.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeMapperParallelProjection.html + https://kitware.github.io/vtk-js/examples/MultiSliceImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeOutline.html + https://kitware.github.io/vtk-js/examples/Scrolling2DMixedImages.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumePicker.html + https://kitware.github.io/vtk-js/examples/TestVolumeTypes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeRenderingWithPolyData.html + https://kitware.github.io/vtk-js/examples/VolumeClipPlane.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/CustomWebGPUCone.html + https://kitware.github.io/vtk-js/examples/VolumeContour.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ImageLabelOutline.html + https://kitware.github.io/vtk-js/examples/VolumeMapperBlendModes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ItkWasmVolume.html + https://kitware.github.io/vtk-js/examples/VolumeMapperLightAndShadow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/ManyRenderers.html + https://kitware.github.io/vtk-js/examples/VolumeMapperParallelProjection.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/MultiSliceImageMapper.html + https://kitware.github.io/vtk-js/examples/VolumeOutline.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/PBR.html + https://kitware.github.io/vtk-js/examples/CustomWebGPUCone.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/QuadView.html + https://kitware.github.io/vtk-js/examples/ImageLabelOutline.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Scrolling2DMixedImages.html + https://kitware.github.io/vtk-js/examples/ItkWasmVolume.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/SphereArray.html + https://kitware.github.io/vtk-js/examples/ManyRenderers.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Actor2D.html + https://kitware.github.io/vtk-js/examples/PBR.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Convolution2DPass.html + https://kitware.github.io/vtk-js/examples/QuadView.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/LookingGlass.html + https://kitware.github.io/vtk-js/examples/SphereArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/Picking.html + https://kitware.github.io/vtk-js/examples/Actor2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/SimpleCone.html + https://kitware.github.io/vtk-js/examples/Convolution2DPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1138,7 +1111,7 @@ https://kitware.github.io/vtk-js/examples/SpheresAndLabels.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1147,7 +1120,7 @@ https://kitware.github.io/vtk-js/examples/Texture.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1156,7 +1129,7 @@ https://kitware.github.io/vtk-js/examples/TimeSeries.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1165,7 +1138,7 @@ https://kitware.github.io/vtk-js/examples/VR.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1174,7 +1147,7 @@ https://kitware.github.io/vtk-js/examples/AR.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1183,7 +1156,7 @@ https://kitware.github.io/vtk-js/examples/Cone.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1192,7 +1165,7 @@ https://kitware.github.io/vtk-js/examples/CubeAxes.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1201,7 +1174,7 @@ https://kitware.github.io/vtk-js/examples/DepthTest.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1210,7 +1183,7 @@ https://kitware.github.io/vtk-js/examples/GlyphRotation.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1219,34 +1192,34 @@ https://kitware.github.io/vtk-js/examples/ItkWasmGeometry.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/TubesViewer.html + https://kitware.github.io/vtk-js/examples/LookingGlass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/VolumeViewer.html + https://kitware.github.io/vtk-js/examples/Picking.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/examples/GeometryViewer.html + https://kitware.github.io/vtk-js/examples/SimpleCone.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1255,7 +1228,7 @@ https://kitware.github.io/vtk-js/examples/OBJViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1264,7 +1237,7 @@ https://kitware.github.io/vtk-js/examples/OctreeViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1273,7 +1246,7 @@ https://kitware.github.io/vtk-js/examples/OfflineLocalView.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1282,7 +1255,7 @@ https://kitware.github.io/vtk-js/examples/SceneExplorer.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1291,34 +1264,34 @@ https://kitware.github.io/vtk-js/examples/SkyboxViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_SplineWidget.html + https://kitware.github.io/vtk-js/examples/TubesViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ResliceCursorWidget.html + https://kitware.github.io/vtk-js/examples/VolumeViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_SeedWidget.html + https://kitware.github.io/vtk-js/examples/GeometryViewer.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1327,7 +1300,7 @@ https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ShapeWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -1336,952 +1309,952 @@ https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_SphereWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_LineWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_SplineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_PaintWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_RectangleWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_PolyLineWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ResliceCursorWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_RectangleWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_SeedWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ImplicitPlaneWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_LabelWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_InteractiveOrientationWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_LineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_LabelWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_PaintWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_WidgetRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_PolyLineWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_AngleWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_EllipseWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_EllipseWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ImageCroppingWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ImageCroppingWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ImplicitPlaneWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_LineHandleRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_InteractiveOrientationWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_OutlineContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_SphereHandleRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_PolyLineRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_SplineContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_RectangleContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_WidgetRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_SphereContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_AngleWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_SphereHandleRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_GlyphRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_SplineContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_HandleRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_CircleContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_ImplicitPlaneRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_ContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_LineHandleRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_ConvexFaceContextRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_OutlineContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_CroppingOutlineRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_PolyLineRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_CubeHandleRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_RectangleContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_GlyphRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_SphereContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_HandleRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_TrackballManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_ImplicitPlaneRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_ArrowHandleRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_LineManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_CircleContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_PickerManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_ContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_PlaneManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_ConvexFaceContextRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_TrackballManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_CroppingOutlineRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Representations_ArrowHandleRepresentation.html + https://kitware.github.io/vtk-js/api/Widgets_Representations_CubeHandleRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Core_StateBuilder.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_AbstractManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Core_WidgetManager.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_CPRManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Core_WidgetState.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_LineManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_AbstractManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_PickerManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Manipulators_CPRManipulator.html + https://kitware.github.io/vtk-js/api/Widgets_Manipulators_PlaneManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Core_AbstractWidget.html + https://kitware.github.io/vtk-js/api/Widgets_Core_StateBuilder.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Widgets_Core_AbstractWidgetFactory.html + https://kitware.github.io/vtk-js/api/Widgets_Core_WidgetManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebXR_RenderWindowHelper.html + https://kitware.github.io/vtk-js/api/Widgets_Core_WidgetState.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Testing_Examples_ActorSerialization.html + https://kitware.github.io/vtk-js/api/Widgets_Core_AbstractWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Testing_Examples_PipelineExecution.html + https://kitware.github.io/vtk-js/api/Widgets_Core_AbstractWidgetFactory.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Testing_Examples_PolyDataSerialization.html + https://kitware.github.io/vtk-js/api/Testing_Examples_WindTunnel.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Testing_Examples_StandaloneSceneLoader.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VolumePass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Testing_Examples_WindTunnel.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VolumePassFSQ.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Types.html + https://kitware.github.io/vtk-js/api/Rendering_WebXR_RenderWindowHelper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_UniformBuffer.html + https://kitware.github.io/vtk-js/api/Testing_Examples_ActorSerialization.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VertexInput.html + https://kitware.github.io/vtk-js/api/Testing_Examples_PipelineExecution.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ViewNodeFactory.html + https://kitware.github.io/vtk-js/api/Testing_Examples_PolyDataSerialization.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VolumePass.html + https://kitware.github.io/vtk-js/api/Testing_Examples_StandaloneSceneLoader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Volume.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_StorageBuffer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VolumePassFSQ.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Texture.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderModule.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_TextureManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_SimpleMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_TextureView.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_SphereMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Types.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_StickMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_UniformBuffer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_StorageBuffer.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VertexInput.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Texture.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ViewNodeFactory.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_TextureManager.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Volume.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_TextureView.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Sampler.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Profiles.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ScalarBarActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_RenderEncoder.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderCache.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_RenderWindow.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderDescription.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Renderer.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderModule.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Sampler.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_SimpleMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ScalarBarActor.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_SphereMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderCache.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_StickMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ShaderDescription.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PolyDataMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_OpaquePass.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PolyDataMapper2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Profiles.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Pipeline.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_RenderEncoder.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_RenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PolyDataMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Renderer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PolyDataMapper2D.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_HardwareSelectionPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Glyph3DMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_HardwareSelector.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_HardwareSelectionPass.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ImageMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ImageSlice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_HardwareSelector.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_IndexBuffer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ImageSlice.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_OpaquePass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ForwardPass.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_OrderIndependentTranslucentPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_FullScreenQuad.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Pipeline.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_IndexBuffer.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_PixelSpaceCallbackMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_BindGroup.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_CellArrayMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Buffer.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_CubeAxesActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_BufferManager.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Device.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Camera.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_ForwardPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_CellArrayMapper.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_FullScreenQuad.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_CubeAxesActor.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Glyph3DMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Device.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Actor2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_ViewNodeFactory.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_BindGroup.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Actor.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Buffer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Actor2D.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_BufferManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_glsl.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Camera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_RenderPass.html + https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_ViewNode.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_RenderWindowViewNode.html + https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_ViewNodeFactory.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_ViewNode.html + https://kitware.github.io/vtk-js/api/Rendering_WebGPU_Actor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Volume.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_glsl.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_VolumeMapper.html + https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_RenderPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_SphereMapper.html + https://kitware.github.io/vtk-js/api/Rendering_SceneGraph_RenderWindowViewNode.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_StickMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_SurfaceLIC.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_SurfaceLIC.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Texture.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Texture.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_TextureUnitManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_TextureUnitManager.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_VertexArrayObject.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_VertexArrayObject.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ViewNodeFactory.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ViewNodeFactory.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Volume.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ReplacementShaderMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_VolumeMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2290,7 +2263,7 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ScalarBarActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2299,7 +2272,7 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Shader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2308,7 +2281,7 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ShaderCache.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2317,7 +2290,7 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ShaderProgram.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2326,25 +2299,25 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Skybox.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Profiles.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_SphereMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_RadialDistortionPass.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_StickMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2353,7 +2326,16 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Renderer.html - 2024-01-03 + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ReplacementShaderMapper.html + + 2024-01-04 monthly 0.6 @@ -2362,295 +2344,295 @@ https://kitware.github.io/vtk-js/api/Rendering_OpenGL_RenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PolyDataMapper2D.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Profiles.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_RadialDistortionPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageResliceMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageSlice.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageResliceMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageSlice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_OrderIndependentTranslucentPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PolyDataMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PixelSpaceCallbackMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ForwardPass.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PolyDataMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Framebuffer.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_PolyDataMapper2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Glyph3DMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ForwardPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_HardwareSelector.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Framebuffer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Helper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Glyph3DMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageCPRMapper.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_HardwareSelector.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_BufferObject.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Helper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Camera.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_ImageCPRMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_CellArrayBufferObject.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Actor2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Convolution2DPass.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_BufferObject.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_CubeAxesActor.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Camera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_SynchronizableRenderWindow.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_CellArrayBufferObject.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_TextureLODsDownloader.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Convolution2DPass.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Actor.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_CubeAxesActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Actor2D.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_RenderingAPIs.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_GenericRenderWindow.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_SynchronizableRenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_RemoteView.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_TextureLODsDownloader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_RenderWindowWithControlBar.html + https://kitware.github.io/vtk-js/api/Rendering_OpenGL_Actor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_RenderingAPIs.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_CanvasView.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_VolumeMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_FullScreenRenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_VolumeProperty.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_GenericRenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_CanvasView.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_RemoteView.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Misc_FullScreenRenderWindow.html + https://kitware.github.io/vtk-js/api/Rendering_Misc_RenderWindowWithControlBar.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_SurfaceLICInterface.html + https://kitware.github.io/vtk-js/api/Rendering_Core_VolumeMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_SurfaceLICMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_VolumeProperty.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2659,7 +2641,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_Texture.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2668,7 +2650,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_Viewport.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2677,124 +2659,124 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_Volume.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_ScalarBarActor.html + https://kitware.github.io/vtk-js/api/Rendering_Core_StickMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Skybox.html + https://kitware.github.io/vtk-js/api/Rendering_Core_SurfaceLICInterface.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_SphereMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_SurfaceLICMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_StickMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Renderer.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Property2D.html + https://kitware.github.io/vtk-js/api/Rendering_Core_ScalarBarActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_RenderWindow.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Skybox.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_RenderWindowInteractor.html + https://kitware.github.io/vtk-js/api/Rendering_Core_SphereMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Renderer.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Property2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Prop.html + https://kitware.github.io/vtk-js/api/Rendering_Core_RenderWindow.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Prop3D.html + https://kitware.github.io/vtk-js/api/Rendering_Core_RenderWindowInteractor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Property.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Prop.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Mapper2D.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Prop3D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Picker.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Property.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2803,7 +2785,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_PixelSpaceCallbackMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2812,70 +2794,70 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_PointPicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_InteractorStyle.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Mapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Light.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Mapper2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Mapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Picker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_ImageResliceMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_ImageSlice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_ImageSlice.html + https://kitware.github.io/vtk-js/api/Rendering_Core_InteractorObserver.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_InteractorObserver.html + https://kitware.github.io/vtk-js/api/Rendering_Core_InteractorStyle.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_ImageCPRMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Light.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2884,7 +2866,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_ImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2893,16 +2875,16 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_ImageProperty.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Follower.html + https://kitware.github.io/vtk-js/api/Rendering_Core_ImageResliceMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2911,7 +2893,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_Glyph3DMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2920,7 +2902,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_HardwareSelector.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2929,7 +2911,16 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_ImageArrayMapper.html - 2024-01-03 + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/Rendering_Core_ImageCPRMapper.html + + 2024-01-04 monthly 0.6 @@ -2938,7 +2929,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_ColorTransferFunction.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2947,7 +2938,7 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_Coordinate.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2956,16 +2947,16 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_CubeAxesActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Camera.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Follower.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -2974,160 +2965,160 @@ https://kitware.github.io/vtk-js/api/Rendering_Core_CellPicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AnnotatedCubeActor.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Actor2D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AxesActor.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AnnotatedCubeActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractPicker.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AxesActor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Actor.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Camera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_Actor2D.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractImageMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractMapper3D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractMapper.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractPicker.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractMapper3D.html + https://kitware.github.io/vtk-js/api/Rendering_Core_Actor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_VolumeRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_SkyboxRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Rendering_Core_AbstractImageMapper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_SliceRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_ResliceRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_VolumeRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_SkyboxRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_GeometryRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_SliceRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_GlyphRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_SlicedGeometryRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_MoleculeRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_GeometryRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Representations_ResliceRepresentationProxy.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_GlyphRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Core_ProxyManager.html + https://kitware.github.io/vtk-js/api/Proxy_Representations_MoleculeRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3136,7 +3127,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_SourceProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3145,7 +3136,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_View2DProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3154,7 +3145,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_ViewProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3163,16 +3154,16 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_PiecewiseFunctionProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Proxy_Animation_AnimationProxyManager.html + https://kitware.github.io/vtk-js/api/Proxy_Core_ProxyManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3181,7 +3172,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Animation_TimeStepBasedAnimationHandlerProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3190,7 +3181,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_AbstractRepresentationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3199,7 +3190,7 @@ https://kitware.github.io/vtk-js/api/Proxy_Core_LookupTableProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3208,7 +3199,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLPolyDataReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3217,7 +3208,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLPolyDataWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3226,7 +3217,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3235,7 +3226,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3244,16 +3235,16 @@ https://kitware.github.io/vtk-js/api/Proxy_Animation_AbstractAnimationProxy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Misc_OBJReader.html + https://kitware.github.io/vtk-js/api/Proxy_Animation_AnimationProxyManager.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3262,7 +3253,7 @@ https://kitware.github.io/vtk-js/api/IO_Misc_PDBReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3271,7 +3262,7 @@ https://kitware.github.io/vtk-js/api/IO_Misc_SkyboxReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3280,7 +3271,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLImageDataReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3289,16 +3280,7 @@ https://kitware.github.io/vtk-js/api/IO_XML_XMLImageDataWriter.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/api/IO_Misc_ITKPolyDataReader.html - - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3307,7 +3289,7 @@ https://kitware.github.io/vtk-js/api/IO_Misc_JSONNucleoReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3316,7 +3298,7 @@ https://kitware.github.io/vtk-js/api/IO_Misc_JSONReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3325,97 +3307,97 @@ https://kitware.github.io/vtk-js/api/IO_Misc_MTLReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Geometry_STLWriter.html + https://kitware.github.io/vtk-js/api/IO_Misc_OBJReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Legacy_LegacyAsciiParser.html + https://kitware.github.io/vtk-js/api/IO_Legacy_PolyDataReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Legacy_PolyDataReader.html + https://kitware.github.io/vtk-js/api/IO_Misc_ElevationReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Misc_ElevationReader.html + https://kitware.github.io/vtk-js/api/IO_Misc_HttpDataSetLODsLoader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Misc_HttpDataSetLODsLoader.html + https://kitware.github.io/vtk-js/api/IO_Misc_ITKImageReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Misc_ITKImageReader.html + https://kitware.github.io/vtk-js/api/IO_Misc_ITKPolyDataReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Geometry_PLYReader.html + https://kitware.github.io/vtk-js/api/IO_Geometry_PLYWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Geometry_PLYWriter.html + https://kitware.github.io/vtk-js/api/IO_Geometry_STLReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Geometry_STLReader.html + https://kitware.github.io/vtk-js/api/IO_Geometry_STLWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Core_Serializer.html + https://kitware.github.io/vtk-js/api/IO_Legacy_LegacyAsciiParser.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3424,7 +3406,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_WSLinkClient.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3433,7 +3415,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_ZipMultiDataSetReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3442,7 +3424,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_ZipMultiDataSetWriter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3451,16 +3433,16 @@ https://kitware.github.io/vtk-js/api/IO_Geometry_DracoReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Core_HttpSceneLoader.html + https://kitware.github.io/vtk-js/api/IO_Geometry_PLYReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3469,7 +3451,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_ImageStream.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3478,7 +3460,16 @@ https://kitware.github.io/vtk-js/api/IO_Core_ResourceLoader.html - 2024-01-03 + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/IO_Core_Serializer.html + + 2024-01-04 monthly 0.6 @@ -3487,7 +3478,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_DataAccessHelper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3496,7 +3487,7 @@ https://kitware.github.io/vtk-js/api/IO_Core_HttpDataSetReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3505,25 +3496,25 @@ https://kitware.github.io/vtk-js/api/IO_Core_HttpDataSetSeriesReader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/IO_Core_BinaryHelper.html + https://kitware.github.io/vtk-js/api/IO_Core_HttpSceneLoader.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_UI_VolumeController.html + https://kitware.github.io/vtk-js/api/IO_Core_BinaryHelper.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3532,7 +3523,7 @@ https://kitware.github.io/vtk-js/api/Interaction_Widgets_OrientationMarkerWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3541,160 +3532,160 @@ https://kitware.github.io/vtk-js/api/Interaction_Widgets_PiecewiseGaussianWidget.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleUnicam.html + https://kitware.github.io/vtk-js/api/Interaction_UI_Icons.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_UI_CornerAnnotation.html + https://kitware.github.io/vtk-js/api/Interaction_UI_Slider.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_UI_FPSMonitor.html + https://kitware.github.io/vtk-js/api/Interaction_UI_VolumeController.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_UI_Icons.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleTrackballCamera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_UI_Slider.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleUnicam.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleMPRSlice.html + https://kitware.github.io/vtk-js/api/Interaction_UI_CornerAnnotation.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_UI_FPSMonitor.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleRemoteMouse.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleMPRSlice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleTrackballCamera.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_VRButtonPanManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleRemoteMouse.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Misc_DeviceOrientationToCamera.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseRangeManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleImage.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_VRButtonPanManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Misc_DeviceOrientationToCamera.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Style_InteractorStyleImage.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballZoomToMouseManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseRangeManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraUnicamManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraUnicamRotateManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3703,7 +3694,7 @@ https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballRollManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3712,7 +3703,7 @@ https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballRotateManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3721,106 +3712,106 @@ https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballZoomManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballPanManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraSliceManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_GestureCameraManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_KeyboardCameraManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballMultiRotateManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseBoxSelectorManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeVRManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraAxisRotateManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_GestureCameraManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraSliceManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_KeyboardCameraManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_MouseCameraTrackballFirstPersonManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeGestureManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeKeyboardManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeKeyboardManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeMouseManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeMouseManipulator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeVRManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3829,7 +3820,7 @@ https://kitware.github.io/vtk-js/api/Imaging_Hybrid_SampleFunction.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3838,7 +3829,7 @@ https://kitware.github.io/vtk-js/api/Interaction_Animations_TimeStepBasedAnimationHandler.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3847,97 +3838,88 @@ https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeCameraManipulator.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/api/Imaging_Core_ImageInterpolator.html - - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Imaging_Core_ImagePointDataIterator.html + https://kitware.github.io/vtk-js/api/Interaction_Manipulators_CompositeGestureManipulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Imaging_Core_ImageReslice.html + https://kitware.github.io/vtk-js/api/Imaging_Core_AbstractImageInterpolator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Texture_TextureMapToPlane.html + https://kitware.github.io/vtk-js/api/Imaging_Core_ImageInterpolator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Texture_TextureMapToSphere.html + https://kitware.github.io/vtk-js/api/Imaging_Core_ImagePointDataIterator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Imaging_Core_AbstractImageInterpolator.html + https://kitware.github.io/vtk-js/api/Imaging_Core_ImageReslice.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_SLICSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_SphereSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_SphereSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_ViewFinderSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_ViewFinderSource.html + https://kitware.github.io/vtk-js/api/Filters_Texture_TextureMapToPlane.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_PlaneSource.html + https://kitware.github.io/vtk-js/api/Filters_Texture_TextureMapToSphere.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3946,7 +3928,7 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_PointSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3955,25 +3937,25 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_RTAnalyticSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_ImageGridSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_SLICSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_CylinderSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_ImageGridSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -3982,16 +3964,16 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_LineSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_ConeSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_PlaneSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4000,7 +3982,7 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_CubeSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4009,16 +3991,16 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_Cursor3D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Sources_Arrow2DSource.html + https://kitware.github.io/vtk-js/api/Filters_Sources_CylinderSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4027,7 +4009,7 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_ArrowSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4036,7 +4018,7 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_CircleSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4045,16 +4027,16 @@ https://kitware.github.io/vtk-js/api/Filters_Sources_ConcentricCylinderSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_TriangleFilter.html + https://kitware.github.io/vtk-js/api/Filters_Sources_ConeSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4063,7 +4045,7 @@ https://kitware.github.io/vtk-js/api/Filters_General_TubeFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4072,7 +4054,7 @@ https://kitware.github.io/vtk-js/api/Filters_General_WarpScalar.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4081,16 +4063,16 @@ https://kitware.github.io/vtk-js/api/Filters_General_WindowedSincPolyDataFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_OutlineFilter.html + https://kitware.github.io/vtk-js/api/Filters_Sources_Arrow2DSource.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4099,7 +4081,7 @@ https://kitware.github.io/vtk-js/api/Filters_General_PaintFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4108,25 +4090,16 @@ https://kitware.github.io/vtk-js/api/Filters_General_ScalarToRGBA.html - 2024-01-03 - - monthly - 0.6 - - - - https://kitware.github.io/vtk-js/api/Filters_General_ImageStreamline.html - - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_LineFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_TriangleFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4135,7 +4108,7 @@ https://kitware.github.io/vtk-js/api/Filters_General_MoleculeToRepresentation.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4144,187 +4117,187 @@ https://kitware.github.io/vtk-js/api/Filters_General_OBBTree.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageMarchingCubes.html + https://kitware.github.io/vtk-js/api/Filters_General_OutlineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageMarchingSquares.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageSliceFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageOutlineFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageStreamline.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageSliceFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_LineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ContourTriangulator.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageMarchingCubes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageCropFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageMarchingSquares.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ImageDataOutlineFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageOutlineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_AppendPolyData.html + https://kitware.github.io/vtk-js/api/Filters_General_ContourTriangulator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_Calculator.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageCropFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ClipClosedSurface.html + https://kitware.github.io/vtk-js/api/Filters_General_ImageDataOutlineFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_General_ClosedPolyLineToSurfaceFilter.html + https://kitware.github.io/vtk-js/api/Filters_General_ClipClosedSurface.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Transform_Transform.html + https://kitware.github.io/vtk-js/api/Filters_General_ClosedPolyLineToSurfaceFilter.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Core_Cutter.html + https://kitware.github.io/vtk-js/api/Filters_Core_PolyDataNormals.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Core_PolyDataNormals.html + https://kitware.github.io/vtk-js/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Filters_Cornerstone_ImageDataToCornerstoneImage.html + https://kitware.github.io/vtk-js/api/Filters_General_AppendPolyData.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Triangle.html + https://kitware.github.io/vtk-js/api/Filters_General_Calculator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_System_MobileVR.html + https://kitware.github.io/vtk-js/api/Common_System_TimerLog.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_System_TimerLog.html + https://kitware.github.io/vtk-js/api/Common_Transform_LandmarkTransform.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Transform_LandmarkTransform.html + https://kitware.github.io/vtk-js/api/Common_Transform_Transform.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Spline1D.html + https://kitware.github.io/vtk-js/api/Filters_Core_Cutter.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4333,7 +4306,7 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_Spline3D.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4342,43 +4315,43 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_StructuredData.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_SelectionNode.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Triangle.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Sphere.html + https://kitware.github.io/vtk-js/api/Common_System_MobileVR.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_PolyData.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Sphere.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_PolyLine.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Spline1D.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4387,7 +4360,7 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_Polygon.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4396,16 +4369,16 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_Quad.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_PiecewiseFunction.html + https://kitware.github.io/vtk-js/api/Common_DataModel_SelectionNode.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4414,7 +4387,7 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_Plane.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4423,61 +4396,61 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_PointSet.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_KochanekSpline1D.html + https://kitware.github.io/vtk-js/api/Common_DataModel_PolyData.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Line.html + https://kitware.github.io/vtk-js/api/Common_DataModel_PolyLine.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Locator.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Line.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Molecule.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Locator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_ImageData.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Molecule.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_ImplicitBoolean.html + https://kitware.github.io/vtk-js/api/Common_DataModel_PiecewiseFunction.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4486,7 +4459,7 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_IncrementalOctreeNode.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4495,16 +4468,16 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_IncrementalOctreePointLocator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_DataSetAttributes.html + https://kitware.github.io/vtk-js/api/Common_DataModel_KochanekSpline1D.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4513,7 +4486,7 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_EdgeLocator.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4522,25 +4495,25 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_ITKHelper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Cone.html + https://kitware.github.io/vtk-js/api/Common_DataModel_ImageData.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Cylinder.html + https://kitware.github.io/vtk-js/api/Common_DataModel_ImplicitBoolean.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4549,142 +4522,142 @@ https://kitware.github.io/vtk-js/api/Common_DataModel_DataSet.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Cell.html + https://kitware.github.io/vtk-js/api/Common_DataModel_DataSetAttributes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_CellLinks.html + https://kitware.github.io/vtk-js/api/Common_DataModel_CellTypes.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_CellTypes.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Collection.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Collection.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Cone.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_AbstractPointLocator.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Cylinder.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_BoundingBox.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Box.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_Box.html + https://kitware.github.io/vtk-js/api/Common_DataModel_CardinalSpline1D.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_DataModel_CardinalSpline1D.html + https://kitware.github.io/vtk-js/api/Common_DataModel_Cell.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_StringArray.html + https://kitware.github.io/vtk-js/api/Common_DataModel_CellLinks.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_URLExtract.html + https://kitware.github.io/vtk-js/api/Common_Core_VariantArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_VariantArray.html + https://kitware.github.io/vtk-js/api/Common_DataModel_AbstractPointLocator.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_PriorityQueue.html + https://kitware.github.io/vtk-js/api/Common_DataModel_BoundingBox.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_ProgressHandler.html + https://kitware.github.io/vtk-js/api/Common_Core_ScalarsToColors.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_ScalarsToColors.html + https://kitware.github.io/vtk-js/api/Common_Core_StringArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_MatrixBuilder.html + https://kitware.github.io/vtk-js/api/Common_Core_URLExtract.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4693,34 +4666,43 @@ https://kitware.github.io/vtk-js/api/Common_Core_Points.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_Math.html + https://kitware.github.io/vtk-js/api/Common_Core_PriorityQueue.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_HalfFloat.html + https://kitware.github.io/vtk-js/api/Common_Core_ProgressHandler.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_ImageHelper.html + https://kitware.github.io/vtk-js/api/Common_Core_Math.html + + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/Common_Core_MatrixBuilder.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4729,52 +4711,70 @@ https://kitware.github.io/vtk-js/api/Common_Core_LookupTable.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_DataArray.html + https://kitware.github.io/vtk-js/api/Common_Core_HalfFloat.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_Endian.html + https://kitware.github.io/vtk-js/api/Common_Core_ImageHelper.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_Base64.html + https://kitware.github.io/vtk-js/api/Common_Core_ClassHierarchy.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_CellArray.html + https://kitware.github.io/vtk-js/api/Common_Core_DataArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 - https://kitware.github.io/vtk-js/api/Common_Core_ClassHierarchy.html + https://kitware.github.io/vtk-js/api/Common_Core_Endian.html + + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/Common_Core_Base64.html + + 2024-01-04 + + monthly + 0.6 + + + + https://kitware.github.io/vtk-js/api/Common_Core_CellArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4783,7 +4783,7 @@ https://kitware.github.io/vtk-js/index.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4792,7 +4792,7 @@ https://kitware.github.io/vtk-js/docs/index.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4801,7 +4801,7 @@ https://kitware.github.io/vtk-js/docs/intro_vtk_as_es6_dependency.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4810,7 +4810,7 @@ https://kitware.github.io/vtk-js/docs/intro_vtk_as_external_script.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4819,7 +4819,7 @@ https://kitware.github.io/vtk-js/docs/misc_contributing.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4828,7 +4828,7 @@ https://kitware.github.io/vtk-js/docs/misc_tools.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4837,7 +4837,7 @@ https://kitware.github.io/vtk-js/docs/misc_troubleshooting.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4846,7 +4846,7 @@ https://kitware.github.io/vtk-js/docs/old_intro_vtk_es6.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4855,7 +4855,7 @@ https://kitware.github.io/vtk-js/docs/structures.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4864,7 +4864,7 @@ https://kitware.github.io/vtk-js/docs/structures_DataArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4873,7 +4873,7 @@ https://kitware.github.io/vtk-js/docs/structures_MultiBlock.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4882,7 +4882,7 @@ https://kitware.github.io/vtk-js/docs/structures_ParametricDataset.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4891,7 +4891,7 @@ https://kitware.github.io/vtk-js/docs/structures_PolyData.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4900,7 +4900,7 @@ https://kitware.github.io/vtk-js/docs/structures_StringArray.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4909,7 +4909,7 @@ https://kitware.github.io/vtk-js/docs/structures_Table.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4918,7 +4918,7 @@ https://kitware.github.io/vtk-js/docs/structures_UnstructuredGrid.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4927,7 +4927,7 @@ https://kitware.github.io/vtk-js/docs/tutorial.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4936,7 +4936,7 @@ https://kitware.github.io/vtk-js/docs/vtk-js-demo.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4945,7 +4945,7 @@ https://kitware.github.io/vtk-js/docs/vtk_react.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4954,7 +4954,7 @@ https://kitware.github.io/vtk-js/docs/vtk_vanilla.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4963,7 +4963,7 @@ https://kitware.github.io/vtk-js/docs/vtk_vue.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4972,7 +4972,7 @@ https://kitware.github.io/vtk-js/examples/index.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4981,7 +4981,7 @@ https://kitware.github.io/vtk-js/api/index.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4990,7 +4990,7 @@ https://kitware.github.io/vtk-js/coverage/home.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -4999,7 +4999,7 @@ https://kitware.github.io/vtk-js/docs/concepts_widgets.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5008,7 +5008,7 @@ https://kitware.github.io/vtk-js/docs/develop_build.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5017,7 +5017,7 @@ https://kitware.github.io/vtk-js/docs/develop_class.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5026,7 +5026,7 @@ https://kitware.github.io/vtk-js/docs/develop_example.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5035,7 +5035,7 @@ https://kitware.github.io/vtk-js/docs/develop_requirement.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5044,7 +5044,7 @@ https://kitware.github.io/vtk-js/docs/develop_test.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5053,7 +5053,7 @@ https://kitware.github.io/vtk-js/docs/develop_webgpu.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5062,7 +5062,7 @@ https://kitware.github.io/vtk-js/docs/develop_webxr.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5071,7 +5071,7 @@ https://kitware.github.io/vtk-js/docs/develop_widget.html - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5080,7 +5080,7 @@ https://kitware.github.io/vtk-js/2016/04/29/kw-doc/ - 2024-01-03 + 2024-01-04 monthly 0.6 @@ -5089,7 +5089,7 @@ https://kitware.github.io/vtk-js - 2024-01-03 + 2024-01-04 daily 1.0